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 itemFetchResult(KJob *job);
32 void done();
33 void slotExpireDeleteDone();
34
35 Akonadi::Item::List mRemovedMsgs;
36 qint64 mMaxUnreadTime = 0;
37 qint64 mMaxReadTime = 0;
38 bool mExpireMessagesWithoutInvalidDate = false;
39 Akonadi::Collection mMoveToFolder;
40};
41
42/// A scheduled "expire mails in this folder" task.
44{
45public:
46 /// If immediate is set, the job will execute synchronously. This is used when
47 /// the user requests explicitly that the operation should happen immediately.
49 : ScheduledTask(folder, immediate)
50 {
51 }
52
53 ~ScheduledExpireTask() override = default;
54
55 ScheduledJob *run() override
56 {
57 return folder().isValid() ? new ExpireJob(folder(), isImmediate()) : nullptr;
58 }
59
60 int taskTypeId() const override
61 {
62 return 1;
63 }
64};
65} // namespace
bool isValid() const
QList< Item > List
A scheduled "expire mails in this folder" task.
Definition expirejob.h:44
int taskTypeId() const override
An identifier for the type of task (a bit like QListViewItem::rtti).
Definition expirejob.h:60
ScheduledJob * run() override
Run this task, i.e.
Definition expirejob.h:55
ScheduledExpireTask(const Akonadi::Collection &folder, bool immediate)
If immediate is set, the job will execute synchronously.
Definition expirejob.h:48
Base class for scheduled jobs.
ScheduledTask(const Akonadi::Collection &folder, bool immediate)
Creates a scheduled task for a given folder.
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-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:35 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.