korganizer Library API Documentation

history.h

00001 /* 00002 This file is part of KOrganizer. 00003 00004 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00019 00020 As a special exception, permission is given to link this program 00021 with any edition of Qt, and distribute the resulting executable, 00022 without including the source code for Qt in the source distribution. 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 void startMultiModify( const QString &description ); 00050 void endMultiModify(); 00051 00052 public slots: 00053 void undo(); 00054 void redo(); 00055 00056 signals: 00057 void undone(); 00058 void redone(); 00059 00060 void undoAvailable( const QString & ); 00061 void redoAvailable( const QString & ); 00062 00063 protected: 00064 void truncate(); 00065 00066 private: 00067 00068 class Entry 00069 { 00070 public: 00071 Entry( KCal::Calendar * ); 00072 virtual ~Entry(); 00073 00074 virtual void undo() = 0; 00075 virtual void redo() = 0; 00076 00077 virtual QString text() = 0; 00078 00079 protected: 00080 KCal::Calendar *mCalendar; 00081 }; 00082 00083 class EntryDelete : public Entry 00084 { 00085 public: 00086 EntryDelete( KCal::Calendar *, KCal::Incidence * ); 00087 ~EntryDelete(); 00088 00089 void undo(); 00090 void redo(); 00091 00092 QString text(); 00093 00094 private: 00095 KCal::Incidence *mIncidence; 00096 }; 00097 00098 class EntryAdd : public Entry 00099 { 00100 public: 00101 EntryAdd( KCal::Calendar *, KCal::Incidence * ); 00102 ~EntryAdd(); 00103 00104 void undo(); 00105 void redo(); 00106 00107 QString text(); 00108 00109 private: 00110 KCal::Incidence *mIncidence; 00111 }; 00112 00113 class EntryEdit : public Entry 00114 { 00115 public: 00116 EntryEdit( KCal::Calendar *calendar, KCal::Incidence *oldIncidence, 00117 KCal::Incidence *newIncidence ); 00118 ~EntryEdit(); 00119 00120 void undo(); 00121 void redo(); 00122 00123 QString text(); 00124 00125 private: 00126 KCal::Incidence *mOldIncidence; 00127 KCal::Incidence *mNewIncidence; 00128 }; 00129 00130 class MultiEntry : public Entry 00131 { 00132 public: 00133 MultiEntry( KCal::Calendar *calendar, QString text ); 00134 ~MultiEntry(); 00135 00136 void appendEntry( Entry* entry ); 00137 void undo(); 00138 void redo(); 00139 00140 QString text(); 00141 00142 private: 00143 QPtrList<Entry> mEntries; 00144 QString mText; 00145 }; 00146 00147 KCal::Calendar *mCalendar; 00148 MultiEntry *mCurrentMultiEntry; 00149 00150 QPtrList<Entry> mEntries; 00151 QPtrListIterator<Entry> mUndoEntry; 00152 QPtrListIterator<Entry> mRedoEntry; 00153 }; 00154 00155 } 00156 #endif
KDE Logo
This file is part of the documentation for korganizer Library Version 3.3.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Aug 27 12:53:20 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003