File indexing completed on 2025-01-05 04:49:51

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QHash>
0010 #include <QObject>
0011 class QStandardItemModel;
0012 namespace KSieveCore
0013 {
0014 class SieveImapAccountSettings;
0015 }
0016 class SelectImapFolderModel : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit SelectImapFolderModel(QObject *parent = nullptr);
0021     ~SelectImapFolderModel() override;
0022 
0023     static SelectImapFolderModel *self();
0024 
0025     QStandardItemModel *folderModel(const KSieveCore::SieveImapAccountSettings &account, bool &modelIsInitialized);
0026 
0027     void reloadFolderModel(const KSieveCore::SieveImapAccountSettings &account);
0028 
0029     void createNewFolder(const KSieveCore::SieveImapAccountSettings &account, const QString &folderName);
0030 
0031 Q_SIGNALS:
0032     void modelLoaded(QStandardItemModel *model, bool success);
0033 
0034 private:
0035     void slotLoaded(bool success, QStandardItemModel *model);
0036     void slotCreateFolderDone(const KSieveCore::SieveImapAccountSettings &account, bool success);
0037     void fillModel(const KSieveCore::SieveImapAccountSettings &account, QStandardItemModel *model);
0038     QHash<QString, QStandardItemModel *> mHashFolderModel;
0039 };