File indexing completed on 2024-12-22 05:01:00
0001 /* 0002 This file is part of KMail, the KDE mail client. 0003 SPDX-FileCopyrightText: 2005 Till Adam <adam@kde.org> 0004 SPDX-FileCopyrightText: 2011-2024 Laurent Montel <montel@kde.org> 0005 SPDX-FileCopyrightText: 2012 Jonathan Marten <jjm@keelhaul.me.uk> 0006 0007 SPDX-License-Identifier: GPL-2.0-only 0008 */ 0009 0010 #pragma once 0011 0012 #include <MailCommon/FolderSettings> 0013 #include <MessageCore/MailingList> 0014 0015 #include <Akonadi/Collection> 0016 #include <Akonadi/CollectionPropertiesPage> 0017 0018 class QCheckBox; 0019 class QPushButton; 0020 0021 template<typename T> 0022 class QSharedPointer; 0023 0024 class QComboBox; 0025 class QPushButton; 0026 class KJob; 0027 class KEditListWidget; 0028 class KSqueezedTextLabel; 0029 0030 class CollectionMailingListPage : public Akonadi::CollectionPropertiesPage 0031 { 0032 Q_OBJECT 0033 public: 0034 explicit CollectionMailingListPage(QWidget *parent = nullptr); 0035 ~CollectionMailingListPage() override; 0036 0037 void load(const Akonadi::Collection &col) override; 0038 void save(Akonadi::Collection &col) override; 0039 0040 [[nodiscard]] bool canHandle(const Akonadi::Collection &col) const override; 0041 0042 private: 0043 void slotFetchDone(KJob *job); 0044 void init(const Akonadi::Collection &); 0045 /* 0046 * Detects mailing-list related stuff 0047 */ 0048 void slotDetectMailingList(); 0049 void slotInvokeHandler(); 0050 void slotMLHandling(int element); 0051 void slotHoldsML(bool holdsML); 0052 void slotAddressChanged(int addr); 0053 void slotConfigChanged(); 0054 void fillMLFromWidgets(); 0055 void fillEditBox(); 0056 0057 Akonadi::Collection mCurrentCollection; 0058 QSharedPointer<MailCommon::FolderSettings> mFolder; 0059 0060 MailingList mMailingList; 0061 QCheckBox *mHoldsMailingList = nullptr; 0062 QComboBox *mMLHandlerCombo = nullptr; 0063 QPushButton *mDetectButton = nullptr; 0064 QComboBox *mAddressCombo = nullptr; 0065 KEditListWidget *mEditList = nullptr; 0066 KSqueezedTextLabel *mMLId = nullptr; 0067 QPushButton *mHandleButton = nullptr; 0068 int mLastItem = 0; 0069 bool changed = false; 0070 }; 0071 0072 AKONADI_COLLECTION_PROPERTIES_PAGE_FACTORY(CollectionMailingListPageFactory, CollectionMailingListPage)