-rw-r--r-- | kaddressbook/undo.h | 4 |
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 | |||
@@ -1,95 +1,95 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of KAddressBook. | 2 | This file is part of KAddressBook. |
3 | Copyright (C) 1999 Don Sanders <sanders@kde.org> | 3 | Copyright (C) 1999 Don Sanders <sanders@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
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 | ||
31 | class Command | 31 | class Command |
32 | { | 32 | { |
33 | public: | 33 | public: |
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 |
45 | * the edit menu and toolbar up to date. | 45 | * the edit menu and toolbar up to date. |
46 | * | 46 | * |
47 | * Really this is a simple observable stack. | 47 | * Really this is a simple observable stack. |
48 | */ | 48 | */ |
49 | class StackBase : public QObject | 49 | class StackBase : public QObject |
50 | { | 50 | { |
51 | Q_OBJECT | 51 | Q_OBJECT |
52 | 52 | ||
53 | public: | 53 | public: |
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 | ||
73 | class UndoStack : public StackBase | 73 | class UndoStack : public StackBase |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | static UndoStack *instance(); | 76 | static UndoStack *instance(); |
77 | void undo(); | 77 | void undo(); |
78 | 78 | ||
79 | protected: | 79 | protected: |
80 | UndoStack(); | 80 | UndoStack(); |
81 | static UndoStack* instance_; | 81 | static UndoStack* instance_; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | class RedoStack : public StackBase | 84 | class RedoStack : public StackBase |
85 | { | 85 | { |
86 | public: | 86 | public: |
87 | static RedoStack *instance(); | 87 | static RedoStack *instance(); |
88 | void redo(); | 88 | void redo(); |
89 | 89 | ||
90 | protected: | 90 | protected: |
91 | RedoStack(); | 91 | RedoStack(); |
92 | static RedoStack* instance_; | 92 | static RedoStack* instance_; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | #endif | 95 | #endif |