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 
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
KDE Logo
This file is part of the documentation for korganizer Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:27 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003