on xenial help sign in
added DBusActionState action group property. variant -> var. removed spaces before properties.
3623cdcNick Dedekind
modules/Unity/Indicators/qml/BasicMenuItem.qml+1−1
@@ -23,7 +23,7 @@ import Ubuntu.Components.ListItems 0.1 as ListItem
23ListItem.Standard {
23ListItem.Standard {
24 id: _priv
24 id: _priv
25
25
26− property bool menuActivated : false
26+ property bool menuActivated: false
27 property QtObject menu
27 property QtObject menu
28 property QtObject actionGroup
28 property QtObject actionGroup
29 property alias color: __bg.color
29 property alias color: __bg.color
modules/Unity/Indicators/qml/DBusActionState.qml+31−8
@@ -30,6 +30,7 @@ import QtQuick 2.0
30 id: slide
30 id: slide
31 }
31 }
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 {
48 */
49 */
49 property string action : ""
50 property string action : ""
50
51
52+ /*!
53+ \preliminary
54+ The dbus action group object
55+ */
56+ property QtObject actionGroup : null
57+
51 /*!
58 /*!
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
54 */
61 */
55− property variant value : undefined
62+ property var value : undefined
56
63
57 /*!
64 /*!
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
66 */
73 */
67− property alias property: propertyBinding.property
74+ property string property: propertyBinding.property
68
75
69 /*!
76 /*!
70 \preliminary
77 \preliminary
@@ -72,26 +79,42 @@ Item {
72 */
79 */
73 property bool active: true
80 property bool active: true
74
81
75− Component.onCompleted: connectViewChanges ()
82+ Component.onCompleted: connectViewChanges()
76 onTargetChanged: connectViewChanges()
83 onTargetChanged: connectViewChanges()
77 onPropertyChanged: connectViewChanges()
84 onPropertyChanged: connectViewChanges()
78
85
79 Item {
86 Item {
80 id: priv
87 id: priv
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
90+
91+ property var currentTarget: undefined
92+ property string currentSignal
83
93
84 Binding {
94 Binding {
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
88 }
99 }
89 }
100 }
90
101
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);
106+ }
107+ }
108+
109+ priv.currentTarget = null;
110+ priv.currentSignal = "";
111+ if (target) {
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;
117+ }
95 }
118 }
96 }
119 }
97
120
modules/Unity/Indicators/qml/IndicatorBase.qml+5−5
@@ -29,18 +29,18 @@ Item {
29
29
30 //const
30 //const
31 property string title
31 property string title
32− property string device: "phone"
33 property int busType
32 property int busType
34 property string busName
33 property string busName
35 property string actionsObjectPath
34 property string actionsObjectPath
36− property var menuObjectPaths : undefined
35+ property var menuObjectPaths: undefined
36+ readonly property string device: "phone"
37
37
38− property string deviceMenuObjectPath : menuObjectPaths.hasOwnProperty(device) ? menuObjectPaths[device] : ""
38+ property string deviceMenuObjectPath: menuObjectPaths.hasOwnProperty(device) ? menuObjectPaths[device] : ""
39
39
40 signal actionGroupUpdated()
40 signal actionGroupUpdated()
41 signal modelUpdated()
41 signal modelUpdated()
42
42
43− property var actionGroup : QDBusActionGroup {
43+ property var actionGroup: QDBusActionGroup {
44 busType: indicatorItem.busType
44 busType: indicatorItem.busType
45 busName: indicatorItem.busName
45 busName: indicatorItem.busName
46 objectPath: indicatorItem.actionsObjectPath
46 objectPath: indicatorItem.actionsObjectPath
@@ -48,7 +48,7 @@ Item {
48 onActionAppear: indicatorItem.actionGroupUpdated();
48 onActionAppear: indicatorItem.actionGroupUpdated();
49 }
49 }
50
50
51− property var proxyModel : Indicators.FlatMenuProxyModel {
51+ property var proxyModel: Indicators.FlatMenuProxyModel {
52 busType: indicatorItem.busType
52 busType: indicatorItem.busType
53 busName: indicatorItem.busName
53 busName: indicatorItem.busName
54 objectPath: indicatorItem.deviceMenuObjectPath
54 objectPath: indicatorItem.deviceMenuObjectPath
modules/Unity/Indicators/qml/IndicatorPage.qml+4−4
@@ -30,11 +30,8 @@ IndicatorBase {
30 //const
30 //const
31 property alias emptyText: emptyLabel.text
31 property alias emptyText: emptyLabel.text
32 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
32 property alias highlightFollowsCurrentItem : mainMenu.highlightFollowsCurrentItem
33− readonly property real overshootHeight: (mainMenu.contentY < 0) ? -mainMenu.contentY : 0
34 property bool __active: false
33 property bool __active: false
35
34
36− anchors.fill: parent
37−
38 ListView {
35 ListView {
39 id: mainMenu
36 id: mainMenu
40
37
@@ -51,7 +48,10 @@ IndicatorBase {
51 easing.type: Easing.OutQuad
48 easing.type: Easing.OutQuad
52 }
49 }
53 }
50 }
51+ // TODO - does ever frame.
52+ onBottomMarginChanged: {
54− onBottomMarginChanged: mainMenu.positionViewAtIndex(mainMenu.currentIndex, ListView.End)
53+ mainMenu.positionViewAtIndex(mainMenu.currentIndex, ListView.End)
54+ }
55 }
55 }
56
56
57 // Ensure all delegates are cached in order to improve smoothness of scrolling
57 // Ensure all delegates are cached in order to improve smoothness of scrolling
modules/Unity/Indicators/qml/ProgressMenuItem.qml+2−1
@@ -21,7 +21,7 @@ import QtQuick 2.0
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22
22
23MenuItem {
23MenuItem {
24−
24+ id: _progressMenu
25 property alias value : progressBar.value
25 property alias value : progressBar.value
26
26
27 // TODO: Replace this with the official ProgressBar component as soon as
27 // TODO: Replace this with the official ProgressBar component as soon as
@@ -55,6 +55,7 @@ MenuItem {
55 }
55 }
56
56
57 DBusActionState {
57 DBusActionState {
58+ actionGroup: _progressMenu.actionGroup
58 action: menu ? menu.action : ""
59 action: menu ? menu.action : ""
59 target: progressBar
60 target: progressBar
60 property: "value"
61 property: "value"
modules/Unity/Indicators/qml/SliderMenuItem.qml+1
@@ -59,6 +59,7 @@ MenuItem {
59 }
59 }
60
60
61 DBusActionState {
61 DBusActionState {
62+ actionGroup: _sliderMenu.actionGroup
62 action: menu ? menu.action : ""
63 action: menu ? menu.action : ""
63 target: slider
64 target: slider
64 property: "value"
65 property: "value"
modules/Unity/Indicators/qml/SwitchMenuItem.qml+1
@@ -33,6 +33,7 @@ MenuItem {
33 }
33 }
34
34
35 DBusActionState {
35 DBusActionState {
36+ actionGroup: _switchMenu.actionGroup
36 action: menu ? menu.action : ""
37 action: menu ? menu.action : ""
37 target: switcher
38 target: switcher
38 property: "checked"
39 property: "checked"
modules/Unity/Indicators/qml/TextMenuItem.qml+1
@@ -74,6 +74,7 @@ MenuItem {
74 }
74 }
75
75
76 DBusActionState {
76 DBusActionState {
77+ actionGroup: _textMenu.actionGroup
77 action: menu ? menu.action : ""
78 action: menu ? menu.action : ""
78 target: _textField
79 target: _textField
79 property: "text"
80 property: "text"
modules/Unity/Indicators/qml/messaging/GroupedMessage.qml+1−1
@@ -23,7 +23,7 @@ import Ubuntu.Components 0.1
23import Unity.Indicators 0.1 as Indicators
23import Unity.Indicators 0.1 as Indicators
24
24
25Indicators.BasicMenuItem {
25Indicators.BasicMenuItem {
26− property variant action: menu && menu.action!="" && actionGroup ? actionGroup.action(menu.action) : null
26+ property var action: menu && menu.action != "" && actionGroup ? actionGroup.action(menu.action) : null
27 property alias count: label.text
27 property alias count: label.text
28
28
29 color: "#221e1b"
29 color: "#221e1b"
modules/Unity/Indicators/qml/messaging/HeroMessage.qml+1−1
@@ -26,7 +26,7 @@ Indicators.BasicMenuItem {
26 id: __heroMessage
26 id: __heroMessage
27
27
28 property variant actionsDescription: null
28 property variant actionsDescription: null
29− property variant action: menu && menu.action!="" && actionGroup ? actionGroup.action(menu.action) : null
29+ property var action: menu && menu.action != "" && actionGroup ? actionGroup.action(menu.action) : null
30 property alias heroMessageHeader: __heroMessageHeader
30 property alias heroMessageHeader: __heroMessageHeader
31 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
31 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
32 property real expandedHeight: collapsedHeight
32 property real expandedHeight: collapsedHeight
modules/Unity/Indicators/qml/network/AccessPoint.qml+3−2
@@ -23,6 +23,7 @@ import Ubuntu.Components.ListItems 0.1 as ListItem
23import Unity.Indicators 0.1 as Indicators
23import Unity.Indicators 0.1 as Indicators
24
24
25Indicators.MenuItem {
25Indicators.MenuItem {
26+ id: _accessPoint
26 property variant actionWifiApStrength : menu && actionGroup ? actionGroup.action(menu.extra.canonical_wifi_ap_strength_action) : null
27 property variant actionWifiApStrength : menu && actionGroup ? actionGroup.action(menu.extra.canonical_wifi_ap_strength_action) : null
27 property variant wifiApStrength : actionWifiApStrength && actionWifiApStrength.valid ? actionWifiApStrength.state : "0"
28 property variant wifiApStrength : actionWifiApStrength && actionWifiApStrength.valid ? actionWifiApStrength.state : "0"
28
29
@@ -57,11 +58,11 @@ Indicators.MenuItem {
57 id: checkBoxActive
58 id: checkBoxActive
58 height: units.gu(4)
59 height: units.gu(4)
59 width: units.gu(4)
60 width: units.gu(4)
60− anchors.horizontalCenter: parent.horizontalCenter
61+ anchors.centerIn: parent
61− anchors.verticalCenter: parent.verticalCenter
62 }
62 }
63
63
64 Indicators.DBusActionState {
64 Indicators.DBusActionState {
65+ actionGroup: _accessPoint.actionGroup
65 action: menu ? menu.action : ""
66 action: menu ? menu.action : ""
66 target: checkBoxActive
67 target: checkBoxActive
67 property: "checked"
68 property: "checked"