File indexing completed on 2024-12-22 05:01:01

0001 /*
0002   SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #pragma once
0008 
0009 #include "configuredialog_p.h"
0010 #include "kmail_export.h"
0011 #include "ui_accountspagereceivingtab.h"
0012 
0013 class QCheckBox;
0014 class QComboBox;
0015 class UndoSendCombobox;
0016 class OrgFreedesktopAkonadiNewMailNotifierInterface;
0017 namespace KLDAPWidgets
0018 {
0019 class LdapConfigureWidget;
0020 }
0021 // subclasses: one class per tab:
0022 class AccountsPageSendingTab : public ConfigModuleTab
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit AccountsPageSendingTab(QWidget *parent = nullptr);
0027     ~AccountsPageSendingTab() override;
0028     [[nodiscard]] QString helpAnchor() const;
0029     void save() override;
0030 
0031 private:
0032     void doLoadFromGlobalSettings() override;
0033     void doLoadOther() override;
0034 
0035 private:
0036     QCheckBox *mConfirmSendCheck = nullptr;
0037     QCheckBox *mCheckSpellingBeforeSending = nullptr;
0038     QComboBox *mSendOnCheckCombo = nullptr;
0039     QComboBox *mSendMethodCombo = nullptr;
0040     UndoSendCombobox *mUndoSendComboBox = nullptr;
0041     QCheckBox *mUndoSend = nullptr;
0042 };
0043 
0044 // subclasses: one class per tab:
0045 class LdapCompetionTab : public ConfigModuleTab
0046 {
0047     Q_OBJECT
0048 public:
0049     explicit LdapCompetionTab(QWidget *parent = nullptr);
0050     ~LdapCompetionTab() override;
0051     QString helpAnchor() const;
0052     void save() override;
0053 
0054 private:
0055     void doLoadOther() override;
0056 
0057 private:
0058     KLDAPWidgets::LdapConfigureWidget *const mLdapConfigureWidget;
0059 };
0060 
0061 class AccountsPageReceivingTab : public ConfigModuleTab
0062 {
0063     Q_OBJECT
0064 public:
0065     explicit AccountsPageReceivingTab(QWidget *parent = nullptr);
0066     ~AccountsPageReceivingTab() override;
0067     QString helpAnchor() const;
0068     void save() override;
0069 
0070 Q_SIGNALS:
0071     void accountListChanged(const QStringList &);
0072 
0073 private:
0074     void slotEditNotifications();
0075     void slotShowMailCheckMenu(const QString &, const QPoint &);
0076     void slotCustomizeAccountOrder();
0077     void slotIncludeInCheckChanged(bool checked);
0078     void slotOfflineOnShutdownChanged(bool checked);
0079     void slotCheckOnStatupChanged(bool checked);
0080     void doLoadFromGlobalSettings() override;
0081 
0082     struct RetrievalOptions {
0083         RetrievalOptions(bool manualCheck, bool offline, bool checkOnStartup)
0084             : IncludeInManualChecks(manualCheck)
0085             , OfflineOnShutdown(offline)
0086             , CheckOnStartup(checkOnStartup)
0087         {
0088         }
0089 
0090         bool IncludeInManualChecks = false;
0091         bool OfflineOnShutdown = false;
0092         bool CheckOnStartup = false;
0093     };
0094 
0095     QHash<QString, QSharedPointer<RetrievalOptions>> mRetrievalHash;
0096 
0097 private:
0098     void slotAddCustomAccount();
0099     void slotAddMailAccount();
0100     Ui_AccountsPageReceivingTab mAccountsReceiving;
0101     OrgFreedesktopAkonadiNewMailNotifierInterface *mNewMailNotifierInterface = nullptr;
0102 };
0103 
0104 class KMAIL_EXPORT AccountsPage : public ConfigModuleWithTabs
0105 {
0106     Q_OBJECT
0107 public:
0108     explicit AccountsPage(QObject *parent, const KPluginMetaData &data);
0109     QString helpAnchor() const override;
0110 
0111 Q_SIGNALS:
0112     void accountListChanged(const QStringList &);
0113 };