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-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "ksievecore_export.h" //TODO use specific export for testing ?
0010 #include "util.h"
0011 #include <QObject>
0012 class OrgKdeAkonadiImapSettingsInterface;
0013 namespace KSieveCore
0014 {
0015 class SieveImapPasswordProvider;
0016 class AbstractAkonadiImapSettingInterface;
0017 class KSIEVECORE_EXPORT FindAccountInfoJob : public QObject
0018 {
0019     Q_OBJECT
0020 public:
0021     explicit FindAccountInfoJob(QObject *parent = nullptr);
0022     ~FindAccountInfoJob() override;
0023 
0024     void start();
0025 
0026     [[nodiscard]] QString identifier() const;
0027     void setIdentifier(const QString &newIdentifier);
0028 
0029     [[nodiscard]] bool withVacationFileName() const;
0030     void setWithVacationFileName(bool newWithVacationFileName);
0031 
0032     SieveImapPasswordProvider *provider() const;
0033     void setProvider(SieveImapPasswordProvider *newProvider);
0034 
0035     [[nodiscard]] bool canStart() const;
0036 
0037     void setCustomImapSettingsInterface(KSieveCore::AbstractAkonadiImapSettingInterface *newCustomImapSettingsInterface);
0038 
0039 Q_SIGNALS:
0040     void findAccountInfoFinished(const KSieveCore::Util::AccountInfo &info);
0041 
0042 private:
0043     KSIEVECORE_NO_EXPORT void sendAccountInfo();
0044     KSIEVECORE_NO_EXPORT void slotPasswordsRequested(const QString &sievePassword, const QString &sieveCustomPassword);
0045     KSieveCore::Util::AccountInfo mAccountInfo;
0046     QString mIdentifier;
0047     KSieveCore::AbstractAkonadiImapSettingInterface *mCustomImapSettingsInterface = nullptr;
0048     SieveImapPasswordProvider *mPasswordProvider = nullptr;
0049     bool mWithVacationFileName = true;
0050     std::unique_ptr<OrgKdeAkonadiImapSettingsInterface> mInterfaceImap;
0051     std::unique_ptr<KSieveCore::AbstractAkonadiImapSettingInterface> mInterface;
0052 };
0053 }