File indexing completed on 2024-12-29 04:54:51

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 "widgets/managesievewidget.h"
0010 #include <KSieveCore/SieveImapInstance>
0011 #include <KSieveCore/Util>
0012 namespace KSieveCore
0013 {
0014 class SieveImapPasswordProvider;
0015 }
0016 namespace KSieveUi
0017 {
0018 class SieveTreeWidgetItem;
0019 class CustomManageSieveWidget : public KSieveUi::ManageSieveWidget
0020 {
0021     Q_OBJECT
0022 public:
0023     explicit CustomManageSieveWidget(KSieveCore::SieveImapPasswordProvider *passwordProvider, QWidget *parent = nullptr);
0024     ~CustomManageSieveWidget() override;
0025 
0026 protected:
0027     [[nodiscard]] bool refreshList() override;
0028     void updateSieveSettings() override;
0029 
0030 private:
0031     void searchNextServerSieve();
0032     void searchSieveScript();
0033     void slotSearchSieveScript(const QString &name, const QString &identifier);
0034     void slotFindAccountInfoFinished(const KSieveCore::Util::AccountInfo &info);
0035     QList<KSieveCore::SieveImapInstance> mSieveImapInstances;
0036     QMap<QString, QString>::const_iterator mSieveServerMapIterator;
0037     // name, identifier
0038     QMap<QString, QString> mServerSieveInfos;
0039     KSieveCore::SieveImapPasswordProvider *const mPasswordProvider;
0040     SieveTreeWidgetItem *mLastSieveTreeWidgetItem = nullptr;
0041     bool mRefreshInProgress = false;
0042 };
0043 }