Mailcommon

expirejob.h
1 /* -*- mode: C++ -*-
2  * SPDX-FileCopyrightText: 2004 David Faure <[email protected]>
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  */
6 
7 #pragma once
8 
9 #include "jobscheduler.h"
10 
11 #include <Akonadi/Collection>
12 #include <Akonadi/Item>
13 
14 class KJob;
15 
16 namespace MailCommon
17 {
18 class ExpireJob : public ScheduledJob
19 {
20  Q_OBJECT
21 public:
22  explicit ExpireJob(const Akonadi::Collection &folder, bool immediate);
23  ~ExpireJob() override;
24 
25  void execute() override;
26  void kill() override;
27 
28 private:
29  void slotDoWork();
30  void slotExpireDone(KJob *job);
31  void slotMoveDone(KJob *job);
32  void itemFetchResult(KJob *job);
33  void done();
34 
35 private:
36  Akonadi::Item::List mRemovedMsgs;
37  qint64 mMaxUnreadTime = 0;
38  qint64 mMaxReadTime = 0;
39  bool mExpireMessagesWithoutInvalidDate = false;
40  Akonadi::Collection mMoveToFolder;
41 };
42 
43 /// A scheduled "expire mails in this folder" task.
45 {
46 public:
47  /// If immediate is set, the job will execute synchronously. This is used when
48  /// the user requests explicitly that the operation should happen immediately.
50  : ScheduledTask(folder, immediate)
51  {
52  }
53 
54  ~ScheduledExpireTask() override = default;
55 
56  ScheduledJob *run() override
57  {
58  return folder().isValid() ? new ExpireJob(folder(), isImmediate()) : nullptr;
59  }
60 
61  int taskTypeId() const override
62  {
63  return 1;
64  }
65 };
66 } // namespace
Q_OBJECTQ_OBJECT
Akonadi::Collection folder() const
The folder which this task is supposed to handle, 0 if it was deleted meanwhile.
ScheduledExpireTask(const Akonadi::Collection &folder, bool immediate)
If immediate is set, the job will execute synchronously.
Definition: expirejob.h:49
A scheduled "expire mails in this folder" task.
Definition: expirejob.h:44
A scheduled task is some information about a folder job that should be run later.
Definition: jobscheduler.h:33
ScheduledJob * run() override
Run this task, i.e.
Definition: expirejob.h:56
int taskTypeId() const override
An identifier for the type of task (a bit like QListViewItem::rtti).
Definition: expirejob.h:61
bool isValid() const
Base class for scheduled jobs.
Definition: jobscheduler.h:126
The filter dialog.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Sep 24 2022 03:58:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.