File indexing completed on 2024-05-26 05:22:17

0001 /*
0002  *   kmail: KDE mail client
0003  *   SPDX-FileCopyrightText: 2000 Espen Sand <espen@kde.org>
0004  *   SPDX-FileCopyrightText: 2001-2003 Marc Mutz <mutz@kde.org>
0005  *   Contains code segments and ideas from earlier kmail dialog code.
0006  *   SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
0007  *
0008  *   SPDX-License-Identifier: GPL-2.0-or-later
0009  *
0010  */
0011 
0012 #pragma once
0013 
0014 #include "kmail_export.h"
0015 
0016 #include "configuredialog/configuredialog_p.h"
0017 #include "ui_identitypage.h"
0018 namespace KIdentityManagementCore
0019 {
0020 class IdentityManager;
0021 }
0022 
0023 namespace KMail
0024 {
0025 class IdentityDialog;
0026 class IdentityListView;
0027 class IdentityListViewItem;
0028 
0029 class KMAIL_EXPORT IdentityPage : public ConfigModuleTab
0030 {
0031     Q_OBJECT
0032 public:
0033     explicit IdentityPage(QWidget *parent = nullptr);
0034     ~IdentityPage() override;
0035 
0036     [[nodiscard]] QString helpAnchor() const;
0037 
0038     void load();
0039     void save() override;
0040 
0041 private:
0042     void slotNewIdentity();
0043     void slotModifyIdentity();
0044     void slotRemoveIdentity();
0045     /** Connected to @p mRenameButton's clicked() signal. Just does a
0046       QTreeWidget::editItem on the selected item */
0047     void slotRenameIdentity();
0048     /** connected to @p mIdentityList's renamed() signal. Validates the
0049       new name and sets it in the KIdentityManagementCore::IdentityManager */
0050     void slotRenameIdentityFromItem(KMail::IdentityListViewItem *, const QString &);
0051     void slotContextMenu(KMail::IdentityListViewItem *, const QPoint &);
0052     void slotSetAsDefault();
0053     void slotIdentitySelectionChanged();
0054 
0055     void refreshList();
0056     void updateButtons();
0057 
0058 private: // data members
0059     Ui_IdentityPage mIPage;
0060     KMail::IdentityDialog *mIdentityDialog = nullptr;
0061     int mOldNumberOfIdentities = 0;
0062     KIdentityManagementCore::IdentityManager *mIdentityManager = nullptr;
0063 };
0064 }