dbusmenu-qt  0.9.2
dbusmenuimporter.h
1 /* This file is part of the dbusmenu-qt library
2  Copyright 2009 Canonical
3  Author: Aurelien Gateau <aurelien.gateau@canonical.com>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License (LGPL) as published by the Free Software Foundation;
8  either version 2 of the License, or (at your option) any later
9  version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 #ifndef DBUSMENUIMPORTER_H
22 #define DBUSMENUIMPORTER_H
23 
24 // Qt
25 #include <QtCore/QObject>
26 
27 // Local
28 #include <dbusmenu_export.h>
29 
30 class QAction;
31 class QDBusAbstractInterface;
32 class QDBusPendingCallWatcher;
33 class QDBusVariant;
34 class QIcon;
35 class QMenu;
36 
37 class DBusMenuImporterPrivate;
38 
43 enum DBusMenuImporterType {
44  ASYNCHRONOUS,
45  SYNCHRONOUS
46 };
47 
52 class DBUSMENU_EXPORT DBusMenuImporter : public QObject
53 {
54  Q_OBJECT
55 public:
59  DBusMenuImporter(const QString &service, const QString &path, QObject *parent = 0);
60 
65  DBusMenuImporter(const QString &service, const QString &path, DBusMenuImporterType type, QObject *parent = 0);
66 
67  virtual ~DBusMenuImporter();
68 
72  QMenu *menu() const;
73  QMenu *menu(QWidget *parent) const;
74 
75 public Q_SLOTS:
89  void updateMenu();
90 
91 Q_SIGNALS:
96  void menuUpdated();
97 
105  void menuReadyToBeShown();
106 
110  void actionActivationRequested(QAction *);
111 
112 protected:
117  virtual QMenu *createMenu(QWidget *parent);
118 
123  virtual QIcon iconForName(const QString &);
124 
125 private Q_SLOTS:
126  void sendClickedEvent(int);
127  void slotMenuAboutToShow();
128  void slotMenuAboutToHide();
129  void slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *);
130  void slotItemActivationRequested(int id, uint timestamp);
131  void processPendingLayoutUpdates();
132  void slotLayoutUpdated(uint revision, int parentId);
133  void slotGetLayoutFinished(QDBusPendingCallWatcher *);
134 
135 private:
136  Q_DISABLE_COPY(DBusMenuImporter)
137  DBusMenuImporterPrivate *const d;
138  friend class DBusMenuImporterPrivate;
139 
140  // Use Q_PRIVATE_SLOT to avoid exposing DBusMenuItemList
141  Q_PRIVATE_SLOT(d, void slotItemsPropertiesUpdated(const DBusMenuItemList &updatedList, const DBusMenuItemKeysList &removedList))
142 };
143 
144 #endif /* DBUSMENUIMPORTER_H */
Definition: dbusmenuimporter.h:52