aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-10-30 12:51:31 +0100
committerRenato Araujo Oliveira Filho <renato.filho@canonical.com>2012-10-30 12:51:31 +0100
commitfd715d4758a1ebf92c30b7194af39fd7e924a473 (patch)
treedf68cca922a2374388606faf3320c7d012ab1638 /libqmenumodel
parent24966876aecc8e554b7133cafe60181515976b6f (diff)
downloadqmenumodel-fd715d4758a1ebf92c30b7194af39fd7e924a473.tar.gz
qmenumodel-fd715d4758a1ebf92c30b7194af39fd7e924a473.tar.bz2
qmenumodel-fd715d4758a1ebf92c30b7194af39fd7e924a473.zip
Created function actionActivate on QDbusActionGroup.
Diffstat (limited to 'libqmenumodel')
-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);