@@ -30,6 +30,7 @@ import QtQuick 2.0
32 DBusActionState {
32 DBusActionState {
33+ actionGroup: menuItem.actionGroup
33 action: "/ubuntu/sound/volume"
34 action: "/ubuntu/sound/volume"
34 target: slider
35 target: slider
35 property: "value"
36 property: "value"
@@ -48,11 +49,17 @@ Item {
49 property string action : ""
50 property string action : ""
54+ The dbus action group object
56+ property QtObject actionGroup : null
52 \preliminary
59 \preliminary
53 This is a read-only property with the action current value
60 This is a read-only property with the action current value
55− property variant value : undefined
62+ property var value : undefined
58 \preliminary
65 \preliminary
@@ -64,7 +71,7 @@ Item {
64 \preliminary
71 \preliminary
65 The property name of \l target component which will be linked with action state
72 The property name of \l target component which will be linked with action state
67− property alias property: propertyBinding.property
74+ property string property: propertyBinding.property
70 \preliminary
77 \preliminary
@@ -72,26 +79,42 @@ Item {
73 property bool active: true
80 property bool active: true
75− Component.onCompleted: connectViewChanges ()
82+ Component.onCompleted: connectViewChanges()
76 onTargetChanged: connectViewChanges()
83 onTargetChanged: connectViewChanges()
77 onPropertyChanged: connectViewChanges()
84 onPropertyChanged: connectViewChanges()
81− property variant actionObject : action!="" && actionGroup ? actionGroup.action(action) : null
88+ property var actionObject: action != "" && dbusActionState.actionGroup ? dbusActionState.actionGroup.action(action) : null
82− property variant actionState: actionObject ? actionObject.state : undefined
89+ property var actionState: actionObject ? actionObject.state : undefined
91+ property var currentTarget: undefined
92+ property string currentSignal
85 id: propertyBinding
95 id: propertyBinding
86 value: priv.actionState
96 value: priv.actionState
87 when: (actionGroup && active && priv.actionObject)
97 when: (actionGroup && active && priv.actionObject)
98+ property: dbusActionState.property
91 function connectViewChanges() {
102 function connectViewChanges() {
92− if (target && property) {
103+ if (priv.currentTarget != undefined && priv.currentSignal !== "") {
104+ if (priv.currentTarget[priv.currentSignal] != undefined) {
105+ priv.currentTarget[priv.currentSignal].disconnect(onViewValueChanged);
109+ priv.currentTarget = null;
110+ priv.currentSignal = "";
93− var signalName = "on%1Changed".arg(property.charAt(0).toUpperCase() + property.slice(1));
112+ var signal = "on%1Changed".arg(property.charAt(0).toUpperCase() + property.slice(1));
113+ if (target[signal] != undefined) {
94− target[signalName].connect(onViewValueChanged);
114+ target[signal].connect(onViewValueChanged);
115+ priv.currentTarget = target;
116+ priv.currentSignal = signal;