File indexing completed on 2024-12-22 05:00:50
0001 /* 0002 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/Collection> 0010 #include <MailCommon/JobScheduler> 0011 class ArchiveMailInfo; 0012 class ArchiveMailManager; 0013 0014 class ArchiveJob : public MailCommon::ScheduledJob 0015 { 0016 Q_OBJECT 0017 public: 0018 explicit ArchiveJob(ArchiveMailManager *manager, ArchiveMailInfo *info, const Akonadi::Collection &folder, bool immediate); 0019 ~ArchiveJob() override; 0020 0021 void execute() override; 0022 void kill() override; 0023 0024 private: 0025 void slotBackupDone(const QString &info); 0026 void slotError(const QString &error); 0027 QString mDefaultIconName; 0028 ArchiveMailInfo *const mInfo; 0029 ArchiveMailManager *const mManager; 0030 }; 0031 0032 /// A scheduled "expire mails in this folder" task. 0033 class ScheduledArchiveTask : public MailCommon::ScheduledTask 0034 { 0035 public: 0036 /// If immediate is set, the job will execute synchronously. This is used when 0037 /// the user requests explicitly that the operation should happen immediately. 0038 ScheduledArchiveTask(ArchiveMailManager *manager, ArchiveMailInfo *info, const Akonadi::Collection &folder, bool immediate) 0039 : MailCommon::ScheduledTask(folder, immediate) 0040 , mInfo(info) 0041 , mManager(manager) 0042 { 0043 } 0044 0045 ~ScheduledArchiveTask() override = default; 0046 0047 MailCommon::ScheduledJob *run() override; 0048 0049 int taskTypeId() const override 0050 { 0051 return 2; 0052 } 0053 0054 private: 0055 ArchiveMailInfo *const mInfo; 0056 ArchiveMailManager *const mManager; 0057 };