Mailcommon

expirejob.h
1/* -*- mode: C++ -*-
2 * SPDX-FileCopyrightText: 2004 David Faure <faure@kde.org>
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
14class KJob;
15
16namespace MailCommon
17{
18class ExpireJob : public ScheduledJob
19{
21public:
22 explicit ExpireJob(const Akonadi::Collection &folder, bool immediate);
23 ~ExpireJob() override;
24
25 void execute() override;
26 void kill() override;
27
28private:
29 void slotDoWork();
30 void slotExpireDone(KJob *job);
31 void slotMoveDone(KJob *job);
32 void itemFetchResult(KJob *job);
33 void done();
34 void slotExpireDeleteDone();
35
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{
46public:
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
bool isValid() const
A scheduled "expire mails in this folder" task.
Definition expirejob.h:45
int taskTypeId() const override
An identifier for the type of task (a bit like QListViewItem::rtti).
Definition expirejob.h:61
ScheduledJob * run() override
Run this task, i.e.
Definition expirejob.h:56
ScheduledExpireTask(const Akonadi::Collection &folder, bool immediate)
If immediate is set, the job will execute synchronously.
Definition expirejob.h:49
Base class for scheduled jobs.
A scheduled task is some information about a folder job that should be run later.
Akonadi::Collection folder() const
The folder which this task is supposed to handle, 0 if it was deleted meanwhile.
The filter dialog.
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:12:19 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.