CalendarSupport

eventarchiver.h
1/*
2 SPDX-FileCopyrightText: 2000, 2001 Cornelius Schumacher <schumacher@kde.org>
3 SPDX-FileCopyrightText: 2004 David Faure <faure@kde.org>
4 SPDX-FileCopyrightText: 2004 Reinhold Kainhofer <reinhold@kainhofer.com>
5
6 SPDX-License-Identifier: GPL-2.0-or-later WITH Qt-Commercial-exception-1.0
7*/
8
9#pragma once
10
11#include "calendarsupport_export.h"
12
13#include <Akonadi/ETMCalendar>
14#include <Akonadi/Item>
15#include <KCalendarCore/Event>
16#include <KCalendarCore/Todo>
17
18#include <QObject>
19
20class QDate;
21
22namespace Akonadi
23{
24class IncidenceChanger;
25}
26
27namespace CalendarSupport
28{
29/**
30 * This class handles expiring and archiving of events.
31 * It is used directly by the archivedialog, and it is also
32 * triggered by actionmanager's timer for auto-archiving.
33 *
34 * The settings are not held in this class, but directly in KOPrefs (from korganizer.kcfg)
35 * Be sure to set mArchiveAction and mArchiveFile before a manual archiving
36 * mAutoArchive is used for auto archiving.
37 */
38class CALENDARSUPPORT_EXPORT EventArchiver : public QObject
39{
40 Q_OBJECT
41public:
42 explicit EventArchiver(QObject *parent = nullptr);
43 ~EventArchiver() override;
44
45 /**
46 * Delete or archive events once
47 * @param calendar the calendar to archive
48 * @param limitDate all events *before* the limitDate (not included) will be deleted/archived.
49 * @param widget parent widget for message boxes
50 * Confirmation and "no events to process" dialogs will be shown
51 */
52 void runOnce(const Akonadi::ETMCalendar::Ptr &calendar, Akonadi::IncidenceChanger *changer, QDate limitDate, QWidget *widget);
53
54 /**
55 * Delete or archive events. This is called regularly, when auto-archiving
56 * is enabled
57 * @param calendar the calendar to archive
58 * @param widget parent widget for message boxes
59 * @param withGUI whether this is called from the dialog, so message boxes should be shown.
60 * Note that error dialogs like "cannot save" are shown even if from this method, so widget
61 * should be set in all cases.
62 */
63 void runAuto(const Akonadi::ETMCalendar::Ptr &calendar, Akonadi::IncidenceChanger *changer, QWidget *widget, bool withGUI);
64
65Q_SIGNALS:
66 void eventsDeleted();
67
68private:
69 CALENDARSUPPORT_NO_EXPORT void
70 run(const Akonadi::ETMCalendar::Ptr &calendar, Akonadi::IncidenceChanger *changer, QDate limitDate, QWidget *widget, bool withGUI, bool errorIfNone);
71
72 CALENDARSUPPORT_NO_EXPORT void
73 deleteIncidences(Akonadi::IncidenceChanger *changer, QDate limitDate, QWidget *widget, const Akonadi::Item::List &items, bool withGUI);
74
75 CALENDARSUPPORT_NO_EXPORT void archiveIncidences(const Akonadi::ETMCalendar::Ptr &calendar,
76 Akonadi::IncidenceChanger *changer,
77 QDate limitDate,
78 QWidget *widget,
79 const KCalendarCore::Incidence::List &incidences,
80 bool withGUI);
81
82 /**
83 * Checks if all to-dos under @p todo and including @p todo were completed before @p limitDate.
84 * If not, we can't archive this to-do.
85 * @param todo root of the sub-tree we are checking
86 * @param limitDate
87 * @param checkedUids used internally to prevent infinite recursion due to invalid calendar files
88 */
89 CALENDARSUPPORT_NO_EXPORT bool isSubTreeComplete(const Akonadi::ETMCalendar::Ptr &calendar,
90 const KCalendarCore::Todo::Ptr &todo,
91 QDate limitDate,
92 QStringList checkedUids = QStringList()) const;
93};
94}
This class handles expiring and archiving of events.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.