dbusmenu-qt 0.8.2
/builddir/build/BUILD/libdbusmenu-qt-0.8.2/src/dbusmenuimporter.h
00001 /* This file is part of the dbusmenu-qt library
00002    Copyright 2009 Canonical
00003    Author: Aurelien Gateau <aurelien.gateau@canonical.com>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License (LGPL) as published by the Free Software Foundation;
00008    either version 2 of the License, or (at your option) any later
00009    version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 #ifndef DBUSMENUIMPORTER_H
00022 #define DBUSMENUIMPORTER_H
00023 
00024 // Qt
00025 #include <QtCore/QObject>
00026 
00027 // Local
00028 #include <dbusmenu_export.h>
00029 
00030 class QAction;
00031 class QDBusAbstractInterface;
00032 class QDBusPendingCallWatcher;
00033 class QDBusVariant;
00034 class QIcon;
00035 class QMenu;
00036 
00037 class DBusMenuImporterPrivate;
00042 class DBUSMENU_EXPORT DBusMenuImporter : public QObject
00043 {
00044     Q_OBJECT
00045 public:
00049     DBusMenuImporter(const QString &service, const QString &path, QObject *parent = 0);
00050 
00051     ~DBusMenuImporter();
00052 
00056     QMenu *menu() const;
00057 
00058 public Q_SLOTS:
00072     void updateMenu();
00073 
00074 Q_SIGNALS:
00079     void menuUpdated();
00080 
00088     void menuReadyToBeShown();
00089 
00093     void actionActivationRequested(QAction *);
00094 
00095 protected:
00100     virtual QMenu *createMenu(QWidget *parent);
00101 
00106     virtual QIcon iconForName(const QString &);
00107 
00108 private Q_SLOTS:
00109     void dispatch(QDBusPendingCallWatcher *);
00110     void sendClickedEvent(int);
00111     void slotMenuAboutToShow();
00112     void slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *);
00113     void slotItemActivationRequested(int id, uint timestamp);
00114     void processPendingLayoutUpdates();
00115     void slotLayoutUpdated(uint revision, int parentId);
00116 
00117 private:
00118     Q_DISABLE_COPY(DBusMenuImporter)
00119     DBusMenuImporterPrivate *const d;
00120     friend class DBusMenuImporterPrivate;
00121 
00122     void GetLayoutCallback(int id, QDBusPendingCallWatcher *);
00123     void GetPropertiesCallback(int id, QDBusPendingCallWatcher *);
00124 
00125     // Use Q_PRIVATE_SLOT to avoid exposing DBusMenuItemList
00126     Q_PRIVATE_SLOT(d, void slotItemsPropertiesUpdated(const DBusMenuItemList &updatedList, const DBusMenuItemKeysList &removedList));
00127 };
00128 
00129 #endif /* DBUSMENUIMPORTER_H */
 All Classes Functions