aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src
diff options
context:
space:
mode:
Diffstat (limited to 'libqmenumodel/src')
-rw-r--r--libqmenumodel/src/qdbusactiongroup.cpp7
-rw-r--r--libqmenumodel/src/qdbusactiongroup.h1
-rw-r--r--libqmenumodel/src/qstateaction.cpp2
-rw-r--r--libqmenumodel/src/qstateaction.h4
4 files changed, 11 insertions, 3 deletions
diff --git a/libqmenumodel/src/qdbusactiongroup.cpp b/libqmenumodel/src/qdbusactiongroup.cpp
index 75ab852..6d3515a 100644
--- a/libqmenumodel/src/qdbusactiongroup.cpp
+++ b/libqmenumodel/src/qdbusactiongroup.cpp
@@ -211,6 +211,13 @@ void QDBusActionGroup::updateActionState(const QString &name, const QVariant &st
}
}
+void QDBusActionGroup::activateAction(const QString &name, const QVariant &parameter)
+{
+ if (m_actionGroup != NULL) {
+ g_action_group_activate_action(m_actionGroup, name.toLatin1(), Converter::toGVariant(parameter));
+ }
+}
+
/*! \internal */
void QDBusActionGroup::onActionAdded(GDBusActionGroup *, gchar *name, gpointer data)
{
diff --git a/libqmenumodel/src/qdbusactiongroup.h b/libqmenumodel/src/qdbusactiongroup.h
index beaca24..0292a8f 100644
--- a/libqmenumodel/src/qdbusactiongroup.h
+++ b/libqmenumodel/src/qdbusactiongroup.h
@@ -46,6 +46,7 @@ public:
~QDBusActionGroup();
void updateActionState(const QString &name, const QVariant &state);
+ void activateAction(const QString &name, const QVariant &parameter);
bool hasAction(const QString &name);
Q_INVOKABLE QStateAction *action(const QString &name);
diff --git a/libqmenumodel/src/qstateaction.cpp b/libqmenumodel/src/qstateaction.cpp
index 5dda39f..dd4e541 100644
--- a/libqmenumodel/src/qstateaction.cpp
+++ b/libqmenumodel/src/qstateaction.cpp
@@ -115,7 +115,7 @@ void QStateAction::setState(const QVariant &state)
/*! \internal */
void QStateAction::onTriggered()
{
- updateState(QVariant());
+ m_group->activateAction(text(), QVariant());
}
/*! \internal */
diff --git a/libqmenumodel/src/qstateaction.h b/libqmenumodel/src/qstateaction.h
index 1a5a0fa..85f207a 100644
--- a/libqmenumodel/src/qstateaction.h
+++ b/libqmenumodel/src/qstateaction.h
@@ -30,8 +30,8 @@ class QStateAction : public QAction
Q_OBJECT
Q_PROPERTY(QVariant state READ state WRITE setState NOTIFY stateChanged)
Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
-public:
- QVariant state() const;
+public:
+ QVariant state() const;
bool isValid() const;
Q_INVOKABLE void updateState(const QVariant &state);