diff options
Diffstat (limited to 'tests/script')
-rw-r--r-- | tests/script/dbusmenuscript.cpp | 11 | ||||
-rw-r--r-- | tests/script/dbusmenuscript.h | 2 | ||||
-rw-r--r-- | tests/script/menuscript.py | 12 |
3 files changed, 16 insertions, 9 deletions
diff --git a/tests/script/dbusmenuscript.cpp b/tests/script/dbusmenuscript.cpp index b190d5b..8fa46c7 100644 --- a/tests/script/dbusmenuscript.cpp +++ b/tests/script/dbusmenuscript.cpp @@ -92,15 +92,20 @@ void DBusMenuScript::run() } } -QString DBusMenuScript::popActivatedAction() +QPair<QString, QVariant> DBusMenuScript::popActivatedAction() { if (m_script) { QDBusMessage reply = m_script->call("popActivatedAction"); if (reply.arguments().count() > 0) { - return reply.arguments()[0].toString(); + QVariant value; + QString name = reply.arguments()[0].toString(); + if (reply.arguments().count() > 1) { + value = reply.arguments()[1]; + } + return qMakePair(name, value); } } - return QString(); + return qMakePair(QString(), QVariant()); } diff --git a/tests/script/dbusmenuscript.h b/tests/script/dbusmenuscript.h index 8a93e83..862686c 100644 --- a/tests/script/dbusmenuscript.h +++ b/tests/script/dbusmenuscript.h @@ -47,7 +47,7 @@ public: void publishMenu(); void unpublishMenu(); - QString popActivatedAction(); + QPair<QString, QVariant> popActivatedAction(); private: QDBusInterface *m_script; diff --git a/tests/script/menuscript.py b/tests/script/menuscript.py index 60cb33b..d30adc5 100644 --- a/tests/script/menuscript.py +++ b/tests/script/menuscript.py @@ -53,8 +53,9 @@ class Script(dbus.service.Object): self._list.walk() steps -= 1 + """ TODO: We only support string states for now """ @dbus.service.method(dbus_interface=INTERFACE_NAME, - in_signature='', out_signature='s') + in_signature='', out_signature='ss') def popActivatedAction(self): return self._list._activatedActions.pop(0) @@ -94,7 +95,7 @@ class Action(object): parent.append_item(item) # Action - act = Gio.SimpleAction.new(self._kargs['actionName'], None) + act = Gio.SimpleAction.new(self._kargs['actionName'], self._kargs['actionStateType']) act.connect('activate', self._list._onActionActivated) self._list._rootAction.insert(act) @@ -135,13 +136,14 @@ class ActionList(object): self._rootAction = None self._activatedActions = [] - def appendItem(self, label, actionName, link=None, parentId=None, properties=None): + def appendItem(self, label, actionName, link=None, parentId=None, properties=None, actionStateType=None): self._actions.append(Action(self, 'append', parentId=parentId, label=label, actionName=actionName, link=link, - properties=properties)) + properties=properties, + actionStateType=actionStateType)) def removeItem(self, menuId, actionName=None): self._actions.append(Action(self, 'remove', @@ -208,4 +210,4 @@ class ActionList(object): self._restore() def _onActionActivated(self, action, parameter): - self._activatedActions.append(action.get_name()) + self._activatedActions.append((action.get_name(), parameter.get_string())) |