Akonadi Calendar

todopurger.h
1/*
2 SPDX-FileCopyrightText: 2013 Sérgio Martins <iamsergio@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "akonadi-calendar_export.h"
10#include "calendarbase.h"
11
12#include <QObject>
13
14#include <memory>
15
16namespace Akonadi
17{
18class IncidenceChanger;
19class TodoPurgerPrivate;
20
21/**
22 * @short Class to delete completed to-dos.
23 *
24 * @author Sérgio Martins <iamsergio@gmail.com>
25 * @since 4.12
26 */
27class AKONADI_CALENDAR_EXPORT TodoPurger : public QObject
28{
29 Q_OBJECT
30public:
31 explicit TodoPurger(QObject *parent = nullptr);
32 ~TodoPurger() override;
33
34 /**
35 * Sets an IncidenceChanger.
36 * If you don't call this method, an internal IncidenceChanger will be created.
37 * Use this if you want more control over the deletion operations, like iTip management, ACL, undo/redo support.
38 */
39 void setIncidenceChager(IncidenceChanger *changer);
40
41 /**
42 * Sets the calendar to be used for retrieving the to-do hierarchy.
43 * If you don't call this method, an internal FetchJobCalendar will be created.
44 * Use this if you want to reuse an existing calendar, for performance reasons for example.
45 */
46 void setCalendar(const CalendarBase::Ptr &calendar);
47
48 /**
49 * Deletes completed to-dos. A to-do with incomplete children won't be deleted.
50 * @see purgeCompletedTodos()
51 */
52 void purgeCompletedTodos();
53
54 /**
55 * Use this after receiving the an unsuccessful todosPurged() signal to get a i18n error message.
56 */
57 [[nodiscard]] QString lastError() const;
58
59Q_SIGNALS:
60 /**
61 * Emitted when purging completed to-dos finished.
62 * @param success True if the operation could be completed. @see lastError()
63 * @param numDeleted Number of to-dos that were deleted.
64 * @param numIgnored Number of completed to-dos that weren't deleted because they are read-only
65 * or have incomplete or read-only children.
66 */
67 void todosPurged(bool success, int numDeleted, int numIgnored);
68
69private:
70 std::unique_ptr<TodoPurgerPrivate> const d;
71};
72}
Class to delete completed to-dos.
Definition todopurger.h:28
void todosPurged(bool success, int numDeleted, int numIgnored)
Emitted when purging completed to-dos finished.
FreeBusyManager::Singleton.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.