1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
/*
SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de>
SPDX-License-Identifier: LGPL-2.1-or-later
*/
#pragma once
#include <QObject>
#include <QString>
#include <QStringList>
#include "gdbusmenutypes_p.h"
class Actions : public QObject
{
Q_OBJECT
public:
Actions(const QString &serviceName, const QString &objectPath, QObject *parent = nullptr);
~Actions() override;
void load();
bool get(const QString &name, GMenuAction &action) const;
GMenuActionMap getAll() const;
void trigger(const QString &name, const QVariant &target, uint timestamp = 0);
bool isValid() const; // basically "has actions"
Q_SIGNALS:
void loaded();
void failedToLoad(); // expose error?
void actionsChanged(const QStringList &dirtyActions);
private Q_SLOTS:
void onActionsChanged(const QStringList &removed, const StringBoolMap &enabledChanges, const QVariantMap &stateChanges, const GMenuActionMap &added);
private:
GMenuActionMap m_actions;
QString m_serviceName;
QString m_objectPath;
};
|