Akonadi Calendar

history.h
1 /*
2  SPDX-FileCopyrightText: 2010-2012 Sérgio Martins <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #ifndef AKONADI_HISTORY_H
8 #define AKONADI_HISTORY_H
9 
10 #include "akonadi-calendar_export.h"
11 #include "incidencechanger.h"
12 
13 #include <KCalendarCore/Incidence>
14 #include <item.h>
15 #include <QWidget>
16 
17 class HistoryTest;
18 
19 namespace Akonadi {
20 class IncidenceChanger;
21 
44 class AKONADI_CALENDAR_EXPORT History : public QObject
45 {
46  Q_OBJECT
47 public:
54  enum ResultCode {
55  ResultCodeSuccess = 0,
56  ResultCodeError
57  };
58 
62  ~History();
63 
75  void recordCreation(const Akonadi::Item &item, const QString &description, const uint atomicOperationId = 0);
76 
91  void recordModification(const Akonadi::Item &oldItem, const Akonadi::Item &newItem, const QString &description, const uint atomicOperationId = 0);
92 
105  void recordDeletion(const Akonadi::Item &item, const QString &description, const uint atomicOperationId = 0);
106 
117  void recordDeletions(const Akonadi::Item::List &items, const QString &description, const uint atomicOperationId = 0);
118 
127  Q_REQUIRED_RESULT QString lastErrorString() const;
128 
135  void undoAll(QWidget *parent = nullptr);
136 
140  Q_REQUIRED_RESULT bool undoAvailable() const;
141 
145  Q_REQUIRED_RESULT bool redoAvailable() const;
146 
155  Q_REQUIRED_RESULT QString nextUndoDescription() const;
156 
165  Q_REQUIRED_RESULT QString nextRedoDescription() const;
166 
167 public Q_SLOTS:
174  bool clear();
175 
189  void undo(QWidget *parent = nullptr);
190 
204  void redo(QWidget *parent = nullptr);
205 
206 Q_SIGNALS:
212  void undone(Akonadi::History::ResultCode resultCode);
213 
219  void redone(Akonadi::History::ResultCode resultCode);
220 
224  void changed();
225 
226 private:
227 
228  friend class ::HistoryTest;
229  friend class IncidenceChanger;
230  friend class Entry;
231 
232  // Only IncidenceChanger can create History classes
233  explicit History(QObject *parent = nullptr);
234 
235  // Used by unit-tests
236  Akonadi::IncidenceChanger *incidenceChanger() const;
237 
238  //@cond PRIVATE
239  class Private;
240  Private *const d;
241  //@endcond
242 };
243 }
244 
245 #endif
History class for implementing undo/redo of calendar operations.
Definition: history.h:44
ResultCode
This enum describes the possible result codes (success/error values) for an undo or redo operation...
Definition: history.h:54
FreeBusyManager::Singleton.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jul 9 2020 23:09:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.