history.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KORG_HISTORY_H
00025 #define KORG_HISTORY_H
00026
00027 #include <qobject.h>
00028 #include <qptrlist.h>
00029
00030 namespace KCal {
00031
00032 class Calendar;
00033 class Incidence;
00034
00035 }
00036
00037 namespace KOrg {
00038
00039 class History : public QObject
00040 {
00041 Q_OBJECT
00042 public:
00043 History( KCal::Calendar * );
00044
00045 void recordDelete( KCal::Incidence * );
00046 void recordAdd( KCal::Incidence * );
00047 void recordEdit( KCal::Incidence *oldIncidence,
00048 KCal::Incidence *newIncidence );
00049
00050 public slots:
00051 void undo();
00052 void redo();
00053
00054 signals:
00055 void undone();
00056 void redone();
00057
00058 void undoAvailable( const QString & );
00059 void redoAvailable( const QString & );
00060
00061 protected:
00062 void truncate();
00063
00064 private:
00065
00066 class Entry
00067 {
00068 public:
00069 Entry( KCal::Calendar * );
00070 virtual ~Entry();
00071
00072 virtual void undo() = 0;
00073 virtual void redo() = 0;
00074
00075 virtual QString text() = 0;
00076
00077 protected:
00078 KCal::Calendar *mCalendar;
00079 };
00080
00081 class EntryDelete : public Entry
00082 {
00083 public:
00084 EntryDelete( KCal::Calendar *, KCal::Incidence * );
00085 ~EntryDelete();
00086
00087 void undo();
00088 void redo();
00089
00090 QString text();
00091
00092 private:
00093 KCal::Incidence *mIncidence;
00094 };
00095
00096 class EntryAdd : public Entry
00097 {
00098 public:
00099 EntryAdd( KCal::Calendar *, KCal::Incidence * );
00100 ~EntryAdd();
00101
00102 void undo();
00103 void redo();
00104
00105 QString text();
00106
00107 private:
00108 KCal::Incidence *mIncidence;
00109 };
00110
00111 class EntryEdit : public Entry
00112 {
00113 public:
00114 EntryEdit( KCal::Calendar *calendar, KCal::Incidence *oldIncidence,
00115 KCal::Incidence *newIncidence );
00116 ~EntryEdit();
00117
00118 void undo();
00119 void redo();
00120
00121 QString text();
00122
00123 private:
00124 KCal::Incidence *mOldIncidence;
00125 KCal::Incidence *mNewIncidence;
00126 };
00127
00128 KCal::Calendar *mCalendar;
00129
00130 QPtrList<Entry> mEntries;
00131 QPtrListIterator<Entry> mUndoEntry;
00132 QPtrListIterator<Entry> mRedoEntry;
00133 };
00134
00135 }
00136 #endif
This file is part of the documentation for korganizer Library Version 3.2.2.