File indexing completed on 2024-11-24 04:49:54
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 #include "ksievecore_export.h" 0009 #include <QObject> 0010 0011 #include <QUrl> 0012 0013 namespace KManageSieve 0014 { 0015 class SieveJob; 0016 } 0017 0018 namespace KSieveCore 0019 { 0020 class ParseUserScriptJob; 0021 class GenerateGlobalScriptJob; 0022 class KSIEVECORE_EXPORT VacationCreateScriptJob : public QObject 0023 { 0024 Q_OBJECT 0025 public: 0026 explicit VacationCreateScriptJob(QObject *parent = nullptr); 0027 ~VacationCreateScriptJob() override; 0028 0029 void start(); 0030 void kill(); 0031 0032 void setServerUrl(const QUrl &url); 0033 void setScript(const QString &script); 0034 void setServerName(const QString &servername); 0035 const QString &serverName() const; 0036 void setStatus(bool activate, bool wasActive); 0037 void setKep14Support(bool kep14Support); 0038 0039 Q_SIGNALS: 0040 void result(bool); 0041 void scriptActive(bool activated, const QString &serverName); 0042 0043 private Q_SLOTS: 0044 void slotPutResult(KManageSieve::SieveJob *job, bool success); 0045 void slotGetScript(KManageSieve::SieveJob *job, bool success, const QString &oldScript, bool active); 0046 void slotGotActiveScripts(KSieveCore::ParseUserScriptJob *job); 0047 void slotGenerateDone(const QString &error = QString()); 0048 0049 private: 0050 Q_DISABLE_COPY(VacationCreateScriptJob) 0051 void handleResult(); 0052 void createScript(); 0053 QUrl mUrl; 0054 QString mScript; 0055 QString mServerName; 0056 bool mActivate = false; 0057 bool mScriptActive = false; 0058 bool mKep14Support = false; 0059 bool mUserJobRunning = false; 0060 bool mScriptJobRunning = false; 0061 bool mSuccess = true; 0062 KManageSieve::SieveJob *mSieveJob = nullptr; 0063 KSieveCore::ParseUserScriptJob *mParseUserJob = nullptr; 0064 KSieveCore::GenerateGlobalScriptJob *mCreateJob = nullptr; 0065 }; 0066 }