1 | /* |
2 | * Copyright (C) 2003 Waldo Bastian <bastian@kde.org> |
3 | * |
4 | * This program is free software; you can redistribute it and/or modify |
5 | * it under the terms of the GNU General Public License version 2 as |
6 | * published by the Free Software Foundation. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License |
14 | * along with this program; if not, write to the Free Software |
15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * |
17 | */ |
18 | |
19 | #ifndef menufile_h |
20 | #define menufile_h |
21 | |
22 | #include <QtXml/qdom.h> |
23 | |
24 | #include <QList> |
25 | #include <QStringList> |
26 | |
27 | class |
28 | { |
29 | public: |
30 | (const QString &file); |
31 | (); |
32 | |
33 | bool (); |
34 | bool (); |
35 | void (); |
36 | QString () const { return m_error; } // Returns the last error message |
37 | |
38 | void (const QString &); |
39 | |
40 | enum { |
41 | = 0, |
42 | , |
43 | , |
44 | , |
45 | |
46 | }; |
47 | |
48 | struct |
49 | { |
50 | ActionType ; |
51 | QString ; |
52 | QString ; |
53 | }; |
54 | |
55 | /** |
56 | * Create action atom and push it on the stack |
57 | */ |
58 | ActionAtom *(ActionType action, const QString &arg1, const QString &arg2); |
59 | |
60 | /** |
61 | * Pop @p atom from the stack. |
62 | * @p atom must be last item on the stack |
63 | */ |
64 | void (ActionAtom *atom); |
65 | |
66 | /** |
67 | * Perform the specified action |
68 | */ |
69 | void (const ActionAtom *); |
70 | |
71 | /** |
72 | * Perform all actions currently on the stack, remove them from the stack and |
73 | * save result |
74 | * @return whether save was successful |
75 | */ |
76 | bool (); |
77 | |
78 | /** |
79 | * Returns whether the stack contains any actions |
80 | */ |
81 | bool () const; |
82 | |
83 | void (const QString &, const QString &); |
84 | void (const QString &, const QString &); |
85 | |
86 | void (const QString &, const QString &); |
87 | void (const QString &, const QString &); |
88 | void (const QString &); |
89 | |
90 | void (const QString &, const QStringList &layout); |
91 | |
92 | /** |
93 | * Returns a unique menu-name for a new menu under @p menuName |
94 | * inspired by @p newMenu and not part of @p excludeList |
95 | */ |
96 | QString (const QString &, const QString &, const QStringList &excludeList); |
97 | |
98 | protected: |
99 | /** |
100 | * Finds menu @p menuName in @p elem. |
101 | * If @p create is true, the menu is created if it doesn't exist yet. |
102 | * @return The menu dom-node of @p menuName |
103 | */ |
104 | QDomElement (QDomElement elem, const QString &, bool create); |
105 | |
106 | private: |
107 | QString ; |
108 | QString ; |
109 | |
110 | QDomDocument ; |
111 | bool ; |
112 | |
113 | QList<ActionAtom*> ; |
114 | QStringList ; |
115 | }; |
116 | |
117 | |
118 | #endif |
119 | |