dbusmenu-lxqt 0.3.0
Loading...
Searching...
No Matches
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#include <QMenu>
27
28// Local
29#include <dbusmenu_export.h>
30
31class QAction;
32class QDBusAbstractInterface;
33class QDBusPendingCallWatcher;
34class QDBusVariant;
35class QIcon;
36class QEvent;
37
38class DBusMenuImporterPrivate;
39
40// For working around a crash triggered by "QMenu::timerEvent"
41class Menu : public QMenu {
42 Q_OBJECT
43public:
44 Menu(QWidget *parent = nullptr);
45 bool blockEvents;
46
47protected:
48 bool event(QEvent *e) override;
49};
50
55enum DBusMenuImporterType {
56 ASYNCHRONOUS,
57 SYNCHRONOUS
58};
59
64class DBUSMENU_EXPORT DBusMenuImporter : public QObject
65{
66 Q_OBJECT
67public:
71 DBusMenuImporter(const QString &service, const QString &path, QObject *parent = 0);
72
77 DBusMenuImporter(const QString &service, const QString &path, DBusMenuImporterType type, QObject *parent = 0);
78
79 virtual ~DBusMenuImporter();
80
84 QMenu *menu() const;
85
86public Q_SLOTS:
101
102Q_SIGNALS:
108
117
122
123protected:
128 virtual QMenu *createMenu(QWidget *parent);
129
134 virtual QIcon iconForName(const QString &);
135
136private Q_SLOTS:
137 void sendClickedEvent(int);
138 void slotMenuAboutToShow();
139 void slotMenuAboutToHide();
140 void slotAboutToShowDBusCallFinished(QDBusPendingCallWatcher *);
141 void slotItemActivationRequested(int id, uint timestamp);
142 void processPendingLayoutUpdates();
143 void slotLayoutUpdated(uint revision, int parentId);
144 void slotGetLayoutFinished(QDBusPendingCallWatcher *);
145
146private:
147 Q_DISABLE_COPY(DBusMenuImporter)
148 DBusMenuImporterPrivate *const d;
149 friend class DBusMenuImporterPrivate;
150
151 // Use Q_PRIVATE_SLOT to avoid exposing DBusMenuItemList
152 Q_PRIVATE_SLOT(d, void slotItemsPropertiesUpdated(const DBusMenuItemList &updatedList, const DBusMenuItemKeysList &removedList))
153};
154
155#endif /* DBUSMENUIMPORTER_H */
DBusMenuImporter(const QString &service, const QString &path, DBusMenuImporterType type, QObject *parent=0)
void actionActivationRequested(QAction *)
QMenu * menu() const
virtual QMenu * createMenu(QWidget *parent)
virtual QIcon iconForName(const QString &)
DBusMenuImporter(const QString &service, const QString &path, QObject *parent=0)
void menuReadyToBeShown()