28 #include <kalarmcal/kaevent.h>
31 #include <akonadi/collection.h>
34 #include <QStringList>
40 using namespace KAlarmCal;
55 Event(
const KAEvent&,
const Akonadi::Collection&);
57 Event(
const KAEvent&, AlarmResource*);
61 mutable Akonadi::Collection collection;
77 static Undo* instance();
79 static void saveAdd(
const KAEvent&,
const Akonadi::Collection&,
const QString& name = QString());
81 static void saveAdd(
const KAEvent&, AlarmResource*,
const QString& name = QString());
83 static void saveAdds(
const EventList&,
const QString& name = QString());
84 static void saveEdit(
const Event& oldEvent,
const KAEvent& newEvent);
85 static void saveDelete(
const Event&,
const QString& name = QString());
86 static void saveDeletes(
const EventList&,
const QString& name = QString());
88 static void saveReactivate(
const KAEvent&,
const Akonadi::Collection&,
const QString& name = QString());
90 static void saveReactivate(
const KAEvent&, AlarmResource*,
const QString& name = QString());
92 static void saveReactivates(
const EventList&,
const QString& name = QString());
94 {
return undo(0, UNDO, parent, action); }
95 static bool undo(
int id,
QWidget* parent,
const QString& action)
96 {
return undo(findItem(
id, UNDO), UNDO, parent, action); }
98 {
return undo(0, REDO, parent, action); }
99 static bool redo(
int id,
QWidget* parent,
const QString& action)
100 {
return undo(findItem(
id, REDO), REDO, parent, action); }
102 static bool haveUndo() {
return !mUndoList.isEmpty(); }
103 static bool haveRedo() {
return !mRedoList.isEmpty(); }
104 static QString actionText(Type);
105 static QString actionText(Type,
int id);
106 static QString description(Type,
int id);
108 static void emitChanged();
114 void changed(
const QString& undo,
const QString& redo);
118 static void add(UndoItem*,
bool undo);
119 static void remove(UndoItem*,
bool undo);
120 static void replace(UndoItem* old, UndoItem* New);
124 static void removeRedos(
const QString& eventID);
125 static bool undo(
int index, Type,
QWidget* parent,
const QString& action);
126 static UndoItem* getItem(
int id, Type);
127 static int findItem(
int id, Type);
128 void emitChanged(
const QString& undo,
const QString& redo)
129 { emit changed(undo, redo); }
131 static Undo* mInstance;
132 static List mUndoList;
133 static List mRedoList;
135 friend class UndoItem;
QStringList dontShowErrors
static bool redo(QWidget *parent, const QString &action)
static bool redo(int id, QWidget *parent, const QString &action)
static bool undo(int id, QWidget *parent, const QString &action)
static bool undo(QWidget *parent, const QString &action)
AutoDeleteList< UndoItem > List
void append(const KAEvent &e, AlarmResource *r)