File: actions.h

package info (click to toggle)
plasma-workspace 4%3A5.27.5-2%2Bdeb12u2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 102,040 kB
  • sloc: cpp: 121,800; xml: 3,238; python: 645; perl: 586; sh: 254; javascript: 113; ruby: 62; makefile: 15; ansic: 13
file content (44 lines) | stat: -rw-r--r-- 1,063 bytes parent folder | download
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;
};