Changeset View
Changeset View
Standalone View
Standalone View
gmenu-dbusmenu-proxy/actions.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * Copyright (C) 2018 Kai Uwe Broulik <kde@privat.broulik.de> | ||||
3 | * | ||||
4 | * This library is free software; you can redistribute it and/or | ||||
5 | * modify it under the terms of the GNU Lesser General Public | ||||
6 | * License as published by the Free Software Foundation; either | ||||
7 | * version 2.1 of the License, or (at your option) any later version. | ||||
8 | * | ||||
9 | * This library is distributed in the hope that it will be useful, | ||||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
12 | * Lesser General Public License for more details. | ||||
13 | * | ||||
14 | * You should have received a copy of the GNU Lesser General Public | ||||
15 | * License along with this library; if not, write to the Free Software | ||||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
17 | * | ||||
18 | */ | ||||
19 | | ||||
20 | #pragma once | ||||
21 | | ||||
22 | #include <QObject> | ||||
23 | #include <QString> | ||||
24 | | ||||
25 | #include "gdbusmenutypes_p.h" | ||||
26 | | ||||
27 | class QStringList; | ||||
28 | | ||||
29 | class Actions : public QObject | ||||
30 | { | ||||
31 | Q_OBJECT | ||||
32 | | ||||
33 | public: | ||||
34 | Actions(const QString &serviceName, const QString &objectPath, QObject *parent = nullptr); | ||||
35 | ~Actions(); | ||||
36 | | ||||
37 | void load(); | ||||
38 | | ||||
39 | bool get(const QString &name, GMenuAction &action) const; | ||||
40 | GMenuActionMap getAll() const; | ||||
41 | void trigger(const QString &name, uint timestamp = 0); | ||||
42 | | ||||
43 | bool isValid() const; // basically "has actions" | ||||
44 | | ||||
45 | signals: | ||||
46 | void loaded(); | ||||
47 | void failedToLoad(); // expose error? | ||||
48 | void actionsChanged(const QStringList &dirtyActions); | ||||
49 | | ||||
50 | private slots: | ||||
51 | void onActionsChanged(const QStringList &removed, | ||||
52 | const StringBoolMap &enabledChanges, | ||||
53 | const QVariantMap &stateChanges, | ||||
54 | const GMenuActionMap &added); | ||||
55 | | ||||
56 | private: | ||||
57 | GMenuActionMap m_actions; | ||||
58 | | ||||
59 | QString m_serviceName; | ||||
60 | QString m_objectPath; | ||||
61 | | ||||
62 | }; |