2 * Copyright (C) 2003 Waldo Bastian <bastian@kde.org>
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.
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.
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.
19 #ifndef __menufile_h__
20 #define __menufile_h__
22 #include <QtXml/qdom.h>
30 MenuFile(const QString
&file
);
36 QString
error() const { return m_error
; } // Returns the last error message
38 void restoreMenuSystem(const QString
&);
56 * Create action atom and push it on the stack
58 ActionAtom
*pushAction(ActionType action
, const QString
&arg1
, const QString
&arg2
);
61 * Pop @p atom from the stack.
62 * @p atom must be last item on the stack
64 void popAction(ActionAtom
*atom
);
67 * Perform the specified action
69 void performAction(const ActionAtom
*);
72 * Perform all actions currently on the stack, remove them from the stack and
74 * @return whether save was successful
76 bool performAllActions();
79 * Returns whether the stack contains any actions
83 void addEntry(const QString
&menuName
, const QString
&menuId
);
84 void removeEntry(const QString
&menuName
, const QString
&menuId
);
86 void addMenu(const QString
&menuName
, const QString
&menuFile
);
87 void moveMenu(const QString
&oldMenu
, const QString
&newMenu
);
88 void removeMenu(const QString
&menuName
);
90 void setLayout(const QString
&menuName
, const QStringList
&layout
);
93 * Returns a unique menu-name for a new menu under @p menuName
94 * inspired by @p newMenu and not part of @p excludeList
96 QString
uniqueMenuName(const QString
&menuName
, const QString
&newMenu
, const QStringList
&excludeList
);
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
104 QDomElement
findMenu(QDomElement elem
, const QString
&menuName
, bool create
);
113 QList
<ActionAtom
*> m_actionList
;
114 QStringList m_removedEntries
;