File indexing completed on 2024-05-12 05:37:25
0001 /* 0002 SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de> 0003 0004 SPDX-License-Identifier: LGPL-2.1-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QObject> 0010 #include <QString> 0011 #include <QStringList> 0012 0013 #include "gtkactions_interface.h" 0014 0015 #include "gdbusmenutypes_p.h" 0016 0017 class Actions : public QObject 0018 { 0019 Q_OBJECT 0020 0021 public: 0022 Actions(const QString &serviceName, const QString &objectPath, QObject *parent = nullptr); 0023 ~Actions() override; 0024 0025 void load(); 0026 0027 bool get(const QString &name, GMenuAction &action) const; 0028 GMenuActionMap getAll() const; 0029 void trigger(const QString &name, const QVariant &target, uint timestamp = 0); 0030 0031 bool isValid() const; // basically "has actions" 0032 0033 Q_SIGNALS: 0034 void loaded(); 0035 void failedToLoad(); // expose error? 0036 void actionsChanged(const QStringList &dirtyActions); 0037 0038 private Q_SLOTS: 0039 void onActionsChanged(const QStringList &removed, const StringBoolMap &enabledChanges, const QVariantMap &stateChanges, const GMenuActionMap &added); 0040 0041 private: 0042 QScopedPointer<OrgGtkActionsInterface, QScopedPointerDeleteLater> m_interface; 0043 GMenuActionMap m_actions; 0044 };