Go to the documentation of this file. 26 #include <tqvaluelist.h> 27 #include <tqstringlist.h> 33 class Undo : public TQObject 38 enum Type { NONE, UNDO, REDO }; 40 static Undo* instance(); 41 static void saveAdd( const KAEvent&); 42 static void saveEdit( const KAEvent& oldEvent, const KAEvent& newEvent); 43 static void saveDelete( const KAEvent&); 44 static void saveDeletes( const TQValueList<KAEvent>&); 45 static void saveReactivate( const KAEvent&); 46 static void saveReactivates( const TQValueList<KAEvent>&); 47 static bool undo(TQWidget* parent, const TQString& action) 48 { return undo(mUndoList.begin(), UNDO, parent, action); } 49 static bool undo( int id, TQWidget* parent, const TQString& action) 50 { return undo(findItem( id, UNDO), UNDO, parent, action); } 51 static bool redo(TQWidget* parent, const TQString& action) 52 { return undo(mRedoList.begin(), REDO, parent, action); } 53 static bool redo( int id, TQWidget* parent, const TQString& action) 54 { return undo(findItem( id, REDO), REDO, parent, action); } 56 static bool haveUndo() { return !mUndoList.isEmpty(); } 57 static bool haveRedo() { return !mRedoList.isEmpty(); } 58 static TQString actionText(Type); 59 static TQString actionText(Type, int id); 60 static TQString description(Type, int id); 61 static TQValueList<int> ids(Type); 62 static void emitChanged(); 65 typedef TQValueList<UndoItem*> List; 68 void changed( const TQString& undo, const TQString& redo); 72 static void add(UndoItem*, bool undo); 73 static void remove(UndoItem*, bool undo); 74 static void replace(UndoItem* old, UndoItem* New); 77 typedef TQValueList<UndoItem*>::Iterator Iterator; 79 Undo(TQObject* parent) : TQObject(parent) { } 80 static void removeRedos( const TQString& eventID); 81 static bool undo(Iterator, Type, TQWidget* parent, const TQString& action); 82 static UndoItem* getItem( int id, Type); 83 static Iterator findItem( int id, Type); 84 void emitChanged( const TQString& undo, const TQString& redo) 85 { emit changed(undo, redo); } 87 static Undo* mInstance; 88 static List mUndoList; 89 static List mRedoList; 91 friend class UndoItem; KAEvent corresponds to a KCal::Event instance.
|