@@ -20,7 +20,7 @@
2020import QtQuick 2.0
2121
2222/*!
23− \qmltype DBusActionState
23+ \qmltype MenuItemActionValue
2424 \inqmlmodule Indicators 0.1
2525 \brief Helper class to connect dbus action state with qml components property
2626
@@ -29,7 +29,7 @@ import QtQuick 2.0
2929 Slider {
3030 id: slide
3131 }
32− DBusActionState {
32+ MenuItemActionValue {
3333 actionGroup: menuItem.actionGroup
3434 action: "/ubuntu/sound/volume"
3535 target: slider
@@ -40,27 +40,9 @@ import QtQuick 2.0
4040 \b{This component is under heavy development.}
4141*/
4242
43−Item {
43+MenuItemAction {
4444 id: dbusActionState
4545
46− /*!
47− \preliminary
48− The dbus action name
49− */
50− property string action : ""
51−
52− /*!
53− \preliminary
54− The dbus action group object
55− */
56− property QtObject actionGroup : null
57−
58− /*!
59− \preliminary
60− This is a read-only property with the action current value
61− */
62− property var value : undefined
63−
6446 /*!
6547 \preliminary
6648 The component which will have the property changed by action
@@ -85,23 +67,23 @@ Item {
8567
8668 Item {
8769 id: priv
88− property var actionObject: action != "" && dbusActionState.actionGroup ? dbusActionState.actionGroup.action(action) : null
89− property var actionState: actionObject ? actionObject.state : undefined
70+ property alias actionObject : dbusActionState.__actionObject
9071
9172 property var currentTarget: undefined
9273 property string currentSignal
9374
75+
9476 Binding {
9577 id: propertyBinding
96− value: priv.actionState
97− when: (actionGroup && active && priv.actionObject)
78+ value: dbusActionState.state
79+ when: priv.actionObject && dbusActionState.active
9880 property: dbusActionState.property
9981 }
10082 }
10183
10284 function connectViewChanges() {
10385 if (priv.currentTarget != undefined && priv.currentSignal !== "") {
104− if (priv.currentTarget[priv.currentSignal] != undefined) {
86+ if (priv.currentTarget[priv.currentSignal] !== undefined) {
10587 priv.currentTarget[priv.currentSignal].disconnect(onViewValueChanged);
10688 }
10789 }
@@ -110,7 +92,7 @@ Item {
11092 priv.currentSignal = "";
11193 if (target) {
11294 var signal = "on%1Changed".arg(property.charAt(0).toUpperCase() + property.slice(1));
113− if (target[signal] != undefined) {
95+ if (target[signal] !== undefined) {
11496 target[signal].connect(onViewValueChanged);
11597 priv.currentTarget = target;
11698 priv.currentSignal = signal;
@@ -119,7 +101,7 @@ Item {
119101 }
120102
121103 function onViewValueChanged() {
122− if (priv.actionObject.valid) {
104+ if (valid) {
123105 var propertyValue = target[property];
124106 priv.actionObject.updateState(propertyValue);
125107 }