summaryrefslogtreecommitdiffabout
path: root/kaddressbook/undo.h
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kaddressbook/undo.h
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
Diffstat (limited to 'kaddressbook/undo.h') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/undo.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/kaddressbook/undo.h b/kaddressbook/undo.h
index 843bc26..a8ba2ee 100644
--- a/kaddressbook/undo.h
+++ b/kaddressbook/undo.h
@@ -12,33 +12,33 @@
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#ifndef UNDO_H 24#ifndef UNDO_H
25#define UNDO_H 25#define UNDO_H
26 26
27#include <qobject.h> 27#include <qobject.h>
28#include <qptrstack.h> 28#include <q3ptrstack.h>
29#include <qstring.h> 29#include <qstring.h>
30 30
31class Command 31class Command
32{ 32{
33public: 33public:
34 Command() {} 34 Command() {}
35 virtual ~Command() {}; 35 virtual ~Command() {};
36 virtual QString name() = 0; 36 virtual QString name() = 0;
37 virtual void redo() = 0; // egcs requires these methods to have 37 virtual void redo() = 0; // egcs requires these methods to have
38 virtual void undo() = 0; // implementations (Seems like a bug) 38 virtual void undo() = 0; // implementations (Seems like a bug)
39 // pure virtual may not work 39 // pure virtual may not work
40}; 40};
41 41
42/** The Undo and Redo stacks now no longer inherit directly from a stack. 42/** The Undo and Redo stacks now no longer inherit directly from a stack.
43* They now contain a stack internally and inherit from StackBase, which 43* They now contain a stack internally and inherit from StackBase, which
44* has a signal for when the stack is modified. This is need to keep 44* has a signal for when the stack is modified. This is need to keep
@@ -54,33 +54,33 @@ class StackBase : public QObject
54 StackBase() : QObject() {} 54 StackBase() : QObject() {}
55 55
56 void push(Command *c); 56 void push(Command *c);
57 bool isEmpty(); 57 bool isEmpty();
58 Command *top(); 58 Command *top();
59 void clear(); 59 void clear();
60 60
61 signals: 61 signals:
62 void changed(); 62 void changed();
63 63
64 protected: 64 protected:
65 /** Protect the pop method so users must call undo/redo to properly 65 /** Protect the pop method so users must call undo/redo to properly
66 * use the stack, however the subclasses need it to modify the stack. 66 * use the stack, however the subclasses need it to modify the stack.
67 */ 67 */
68 Command *pop(); 68 Command *pop();
69 69
70 QPtrStack<Command> mCommandStack; 70 Q3PtrStack<Command> mCommandStack;
71}; 71};
72 72
73class UndoStack : public StackBase 73class UndoStack : public StackBase
74{ 74{
75public: 75public:
76 static UndoStack *instance(); 76 static UndoStack *instance();
77 void undo(); 77 void undo();
78 78
79protected: 79protected:
80 UndoStack(); 80 UndoStack();
81 static UndoStack* instance_; 81 static UndoStack* instance_;
82}; 82};
83 83
84class RedoStack : public StackBase 84class RedoStack : public StackBase
85{ 85{
86public: 86public: