File indexing completed on 2024-10-27 04:51:11

0001 /*
0002    SPDX-FileCopyrightText: 2011-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "MailCommon/Tag"
0010 #include "kmail_private_export.h"
0011 #include <Akonadi/Item>
0012 #include <Akonadi/Tag>
0013 #include <QDialog>
0014 #include <QList>
0015 
0016 class QListWidget;
0017 class KActionCollection;
0018 class KMAILTESTS_TESTS_EXPORT TagSelectDialog : public QDialog
0019 {
0020     Q_OBJECT
0021 public:
0022     explicit TagSelectDialog(QWidget *parent, int numberOfSelectedMessages, const Akonadi::Item &selectedItem);
0023     ~TagSelectDialog() override;
0024     [[nodiscard]] Akonadi::Tag::List selectedTag() const;
0025 
0026     void setActionCollection(const QList<KActionCollection *> &actionCollectionList);
0027 
0028 private:
0029     void slotAddNewTag();
0030     void slotTagsFetched(KJob *);
0031     void writeConfig();
0032     void readConfig();
0033     void createTagList(bool updateList);
0034     enum ItemType { UrlTag = Qt::UserRole + 1 };
0035     const int mNumberOfSelectedMessages = -1;
0036     const Akonadi::Item mSelectedItem;
0037 
0038     Akonadi::Tag::List mCurrentSelectedTags;
0039     QList<MailCommon::Tag::Ptr> mTagList;
0040     QList<KActionCollection *> mActionCollectionList;
0041     QListWidget *const mListTag;
0042 };