aboutsummaryrefslogtreecommitdiff
path: root/libqmenumodel/src/qdbusactiongroup.cpp
diff options
context:
space:
mode:
authorNick Dedekind <nick.dedekind@canonical.com>2014-11-11 14:49:40 +0000
committerNick Dedekind <nick.dedekind@canonical.com>2014-11-11 14:49:40 +0000
commit0ca199d4f212de9f998b4bc70616f9662134c9ef (patch)
tree4f64fef1ef9b06812727c84fdc6139f6fff6c562 /libqmenumodel/src/qdbusactiongroup.cpp
parentf3a203bbe1350c5c69d19c1d4d82f984ad23e28d (diff)
downloadqmenumodel-0ca199d4f212de9f998b4bc70616f9662134c9ef.tar.gz
qmenumodel-0ca199d4f212de9f998b4bc70616f9662134c9ef.tar.bz2
qmenumodel-0ca199d4f212de9f998b4bc70616f9662134c9ef.zip
Allow override of action state parser
Diffstat (limited to 'libqmenumodel/src/qdbusactiongroup.cpp')
-rw-r--r--libqmenumodel/src/qdbusactiongroup.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/libqmenumodel/src/qdbusactiongroup.cpp b/libqmenumodel/src/qdbusactiongroup.cpp
index 0ef907a..b29ece0 100644
--- a/libqmenumodel/src/qdbusactiongroup.cpp
+++ b/libqmenumodel/src/qdbusactiongroup.cpp
@@ -17,6 +17,7 @@
* Renato Araujo Oliveira Filho <renato@canonical.com>
*/
+#include "actionstateparser.h"
#include "qdbusactiongroup.h"
#include "qstateaction.h"
#include "converter.h"
@@ -58,7 +59,8 @@ extern "C" {
QDBusActionGroup::QDBusActionGroup(QObject *parent)
:QObject(parent),
QDBusObject(this),
- m_actionGroup(NULL)
+ m_actionGroup(NULL),
+ m_actionStateParser(new ActionStateParser(this))
{
}
@@ -89,7 +91,13 @@ QVariant QDBusActionGroup::actionState(const QString &name)
{
QVariant result;
GVariant *state = g_action_group_get_action_state(m_actionGroup, name.toUtf8().data());
- result = Converter::toQVariant(state);
+
+ if (m_actionStateParser != NULL) {
+ result = m_actionStateParser->toQVariant(state);
+ } else {
+ result = Converter::toQVariant(state);
+ }
+
if (state) {
g_variant_unref(state);
}
@@ -190,6 +198,19 @@ void QDBusActionGroup::setActionGroup(GDBusActionGroup *ag)
}
}
+ActionStateParser* QDBusActionGroup::actionStateParser() const
+{
+ return m_actionStateParser;
+}
+
+void QDBusActionGroup::setActionStateParser(ActionStateParser* actionStateParser)
+{
+ if (m_actionStateParser != actionStateParser) {
+ m_actionStateParser = actionStateParser;
+ Q_EMIT actionStateParserChanged(actionStateParser);
+ }
+}
+
/*! \internal */
void QDBusActionGroup::clear()
{