File indexing completed on 2024-11-24 04:49:53

0001 /*
0002   SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ksievecore_export.h"
0010 #include <KSieveCore/Util>
0011 #include <QMap>
0012 #include <QObject>
0013 namespace KSieveCore
0014 {
0015 class SieveImapPasswordProvider;
0016 class KSIEVECORE_EXPORT SearchServerWithVacationSupportJob : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit SearchServerWithVacationSupportJob(QObject *parent = nullptr);
0021     ~SearchServerWithVacationSupportJob() override;
0022     void start();
0023 
0024     [[nodiscard]] bool canStart() const;
0025 
0026     KSieveCore::SieveImapPasswordProvider *passwordProvider() const;
0027     void setPasswordProvider(KSieveCore::SieveImapPasswordProvider *newProvider);
0028 
0029 Q_SIGNALS:
0030     void searchServerWithVacationSupportFinished(const QMap<QString, KSieveCore::Util::AccountInfo> &info);
0031 
0032 private:
0033     KSIEVECORE_NO_EXPORT void slotFindAccountInfoFinished(const KSieveCore::Util::AccountInfo &info);
0034     KSIEVECORE_NO_EXPORT void sendAccountList();
0035     KSIEVECORE_NO_EXPORT void searchNextInfo();
0036     KSIEVECORE_NO_EXPORT void slotSearchSieveScript(const QString &name, const QString &identifier);
0037     KSIEVECORE_NO_EXPORT void searchNextServerSieve();
0038 
0039     QMap<QString, QString>::const_iterator mSieveServerMapIterator;
0040     // name, identifier
0041     QMap<QString, QString> mServerSieveInfos;
0042 
0043     // Result
0044     QMap<QString, KSieveCore::Util::AccountInfo> mAccountList;
0045     KSieveCore::SieveImapPasswordProvider *mPasswordProvider = nullptr;
0046 };
0047 }