Kross

actioncollection.h
1 /***************************************************************************
2  * actioncollection.h
3  * This file is part of the KDE project
4  * copyright (C)2004-2007 by Sebastian Sauer ([email protected])
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Library General Public License for more details.
14  * You should have received a copy of the GNU Library General Public License
15  * along with this program; see the file COPYING. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  ***************************************************************************/
19 
20 #ifndef KROSS_ACTIONCOLLECTION_H
21 #define KROSS_ACTIONCOLLECTION_H
22 
23 #include "krossconfig.h"
24 #include "action.h"
25 
26 #include <QObject>
27 #include <QDir>
28 
29 class QDomElement;
30 class QIODevice;
31 
32 namespace Kross
33 {
34 
46 class KROSSCORE_EXPORT ActionCollection : public QObject
47 {
48  Q_OBJECT
49 
50 public:
51 
62  explicit ActionCollection(const QString &name, ActionCollection *parent = nullptr);
63 
67  virtual ~ActionCollection();
68 
72  QString name() const;
73 
77  QString text() const;
78 
82  void setText(const QString &text);
83 
87  QString description() const;
88 
92  void setDescription(const QString &description);
93 
97  QString iconName() const;
98 
102  void setIconName(const QString &iconname);
103 
107  QIcon icon() const;
108 
112  bool isEnabled() const;
113 
117  void setEnabled(bool enabled);
118 
124  ActionCollection *parentCollection() const;
126  void setParentCollection(ActionCollection *parent);
131  bool hasCollection(const QString &name) const;
132 
137  ActionCollection *collection(const QString &name) const;
138 
143  QStringList collections() const;
144 
145  QList<Action *> actions() const;
146 
150  Action *action(const QString &name) const;
151  void addAction(Action *action);
152  void addAction(const QString &name, Action *action);
153  void removeAction(const QString &name);
154  void removeAction(Action *action);
155 
166  bool readXml(const QDomElement &element, const QDir &directory = QDir());
167  bool readXml(const QDomElement &element, const QStringList &searchPath/* = QStringList()*/);
168 
172  bool readXml(QIODevice *device, const QDir &directory = QDir());
173  bool readXml(QIODevice *device, const QStringList &searchPath/* = QStringList()*/);
174 
181  bool readXmlFile(const QString &file);
182 
187  QDomElement writeXml();
188  QDomElement writeXml(const QStringList &searchPath/* = QStringList()*/);
189 
194  bool writeXml(QIODevice *device, int indent = 2);
195  bool writeXml(QIODevice *device, int indent/* = 2*/, const QStringList &searchPath/* = QStringList()*/);
196 
197 Q_SIGNALS:
198 
203  void updated();
204 
206  void dataChanged(Action *);
208  void dataChanged(ActionCollection *);
209 
211  void collectionToBeInserted(ActionCollection *child, ActionCollection *parent);
213  void collectionInserted(ActionCollection *child, ActionCollection *parent);
215  void collectionToBeRemoved(ActionCollection *child, ActionCollection *parent);
217  void collectionRemoved(ActionCollection *child, ActionCollection *parent);
218 
220  void actionToBeInserted(Action *child, ActionCollection *parent);
222  void actionInserted(Action *child, ActionCollection *parent);
224  void actionToBeRemoved(Action *child, ActionCollection *parent);
226  void actionRemoved(Action *child, ActionCollection *parent);
227 
228 protected:
229  void registerCollection(ActionCollection *collection);
230  void unregisterCollection(const QString &name);
231  void connectSignals(ActionCollection *collection, bool conn);
232  void connectSignals(Action *collection, bool conn);
233 
234 private Q_SLOTS:
235  void emitUpdated();
236 
237 private:
239  class Private;
241  Private *const d;
242 };
243 
244 }
245 
246 #endif
247 
Definition: action.cpp:36
The Action class is an abstract container to deal with scripts like a single standalone script file...
Definition: action.h:95
The ActionCollection class manages collections of Action instances.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Nov 21 2020 22:59:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.