on xenial help sign in
Ported indicators to using ubuntu-settings-components
commit280438d312b9b380800338f17d58797b0a2bfb5d authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 29 Jan 2014, 16:11 (13 years ago) parent52119c190c1598
38 files changed+528−1770
debian/control+2 plugins/Unity/Indicators/CMakeLists.txt−2 plugins/Unity/Indicators/Messaging/CMakeLists.txt−1 plugins/Unity/Indicators/Messaging/qml/ActionTextField.qml−69 plugins/Unity/Indicators/Messaging/qml/CMakeLists.txt−5 plugins/Unity/Indicators/Messaging/qml/GroupedMessage.qml−91 plugins/Unity/Indicators/Messaging/qml/HeroMessage.qml−123 plugins/Unity/Indicators/Messaging/qml/HeroMessageHeader.qml−161 plugins/Unity/Indicators/Messaging/qml/QuickReply.qml−165 plugins/Unity/Indicators/Messaging/qml/SimpleTextMessage.qml−108 plugins/Unity/Indicators/Messaging/qml/SnapDecision.qml−167 plugins/Unity/Indicators/Messaging/qml/TextMessage.qml−43 plugins/Unity/Indicators/Messaging/qml/qmldir−12 plugins/Unity/Indicators/Network/CMakeLists.txt−1 plugins/Unity/Indicators/Network/qml/AccessPoint.qml−117 plugins/Unity/Indicators/Network/qml/CMakeLists.txt−5 plugins/Unity/Indicators/Network/qml/qmldir−3 plugins/Unity/Indicators/qml/BaseMenuItem.qml−38 plugins/Unity/Indicators/qml/ButtonMenuItem.qml−44 plugins/Unity/Indicators/qml/DivMenuItem.qml−26 plugins/Unity/Indicators/qml/FramedMenuItem.qml−39 plugins/Unity/Indicators/qml/HLine.qml−29 plugins/Unity/Indicators/qml/MenuItemFactory.qml+226−42 plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml → plugins/Unity/Indicators/qml/MessageMenuItemFactory.qml+69−28 plugins/Unity/Indicators/qml/ProgressMenuItem.qml−38 plugins/Unity/Indicators/qml/SectionMenuItem.qml−54 plugins/Unity/Indicators/qml/SliderMenuItem.qml−106 plugins/Unity/Indicators/qml/StandardMenuItem.qml−71 plugins/Unity/Indicators/qml/SwitchMenuItem.qml−53 plugins/Unity/Indicators/qml/qmldir+1−12 plugins/Unity/Indicators/resources/artwork/messaging/message_sms01_54px.png plugins/Unity/Indicators/resources/artwork/network/secure.svg−71 plugins/Unity/Indicators/resources/indicators.qrc−2 qml/Panel/Indicators/DefaultIndicatorPage.qml+9−5 qml/Panel/Indicators/client/IndicatorsList.qml+14−13 tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml−4 tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+194−18 tests/qmltests/Panel/Indicators/tst_MessageMenuItemFactory.qml+13−4
debian/control+2
@@ -37,6 +37,7 @@ Build-Depends: cmake,
3737 qtdeclarative5-private-dev,
3838 qtdeclarative5-qtquick2-plugin,
3939 qtdeclarative5-test-plugin,
40+ qtdeclarative5-ubuntu-settings-components,
4041 qtdeclarative5-ubuntu-ui-toolkit-plugin,
4142 qtdeclarative5-xmllistmodel-plugin,
4243 libqt5xmlpatterns5-dev,
@@ -76,6 +77,7 @@ Depends: gsettings-desktop-schemas,
7677 qmenumodel-qml (>= 0.2.7),
7778 qtdeclarative5-dee-plugin,
7879 qtdeclarative5-gsettings1.0,
80+ qtdeclarative5-ubuntu-settings-components,
7981 qtdeclarative5-ubuntu-ui-toolkit-plugin,
8082 qtdeclarative5-unity-notifications-plugin | unity-notifications-impl,
8183 qtdeclarative5-xmllistmodel-plugin,
plugins/Unity/Indicators/CMakeLists.txt−2
@@ -12,8 +12,6 @@ find_package(Qt5Core REQUIRED)
1212find_package(Qt5Quick REQUIRED)
1313
1414add_subdirectory(qml)
15−add_subdirectory(Messaging)
16−add_subdirectory(Network)
1715
1816include_directories(
1917 ${CMAKE_CURRENT_SOURCE_DIR}
plugins/Unity/Indicators/Messaging/CMakeLists.txtdeleted−1
@@ -1 +0,0 @@
1−add_subdirectory(qml)
plugins/Unity/Indicators/Messaging/qml/ActionTextField.qmldeleted−69
@@ -1,69 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−
24−Item {
25− id: textField
26− property alias text: replyField.text
27− property alias buttonText: sendButton.text
28− property bool activateEnabled: false
29−
30− signal activate(var value)
31−
32− TextField {
33− id: replyField
34−
35− anchors {
36− top: parent.top
37− bottom: parent.bottom
38− left: parent.left
39− right: sendButton.left
40− rightMargin: units.gu(1)
41− }
42− placeholderText: "Reply"
43− hasClearButton: false
44−
45− onEnabledChanged: {
46− //Make sure that the component lost focus when enabled = false,
47− //otherwise it will get focus again when enable = true
48− if (!enabled) {
49− focus = false;
50− }
51− }
52− }
53−
54− Button {
55− id: sendButton
56− anchors {
57− top: parent.top
58− bottom: parent.bottom
59− right: parent.right
60− }
61− width: units.gu(9)
62− enabled: replyField.text !== "" && textField.activateEnabled
63− color: enabled ? "#c94212" : "#bababa"
64−
65− onClicked: {
66− textField.activate(replyField.text);
67− }
68− }
69−}
plugins/Unity/Indicators/Messaging/qml/CMakeLists.txtdeleted−5
@@ -1,5 +0,0 @@
1−# export_qmlfiles macro
2−include(Plugins)
3−
4−# export the qmldir, *.qml files.
5−export_qmlfiles(Unity.Indicators.Messaging Unity/Indicators/Messaging)
plugins/Unity/Indicators/Messaging/qml/GroupedMessage.qmldeleted−91
@@ -1,91 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24−
25−Indicators.BaseMenuItem {
26− id: groupedMessage
27−
28− property alias title: __title.text
29− property alias count: label.text
30− property string appIcon: "qrc:/indicators/artwork/messaging/default_app.svg"
31−
32− signal activateApp()
33− signal dismiss()
34−
35− implicitHeight: units.gu(10)
36−
37− Row {
38− anchors.fill: parent
39− anchors.margins: units.gu(2)
40− spacing: units.gu(4)
41−
42− UbuntuShape {
43− height: units.gu(6)
44− width: units.gu(6)
45− image: Image {
46− source: groupedMessage.appIcon
47− fillMode: Image.PreserveAspectFit
48− }
49− }
50−
51− Label {
52− id: __title
53− anchors.verticalCenter: parent.verticalCenter
54− color: "#e8e1d0"
55− font.weight: Font.DemiBold
56− fontSize: "medium"
57− }
58−
59− Label {
60− id: label
61− anchors.verticalCenter: parent.verticalCenter
62− width: parent.width - x
63− horizontalAlignment: Text.AlignRight
64− color: "#e8e1d0"
65− font.weight: Font.DemiBold
66− fontSize: "medium"
67− text: "0"
68− }
69− }
70−
71− Indicators.HLine {
72− anchors.top: parent.top
73− color: "#403b37"
74− }
75−
76− Indicators.HLine {
77− anchors.bottom: parent.bottom
78− color: "#060606"
79− }
80−
81− MouseArea {
82− anchors.fill: parent
83− onClicked: {
84− groupedMessage.activateApp();
85− }
86− }
87−
88− onItemRemoved: {
89− groupedMessage.dismiss();
90− }
91−}
plugins/Unity/Indicators/Messaging/qml/HeroMessage.qmldeleted−123
@@ -1,123 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24−
25−Indicators.BaseMenuItem {
26− id: heroMessage
27−
28− property alias heroMessageHeader: __heroMessageHeader
29− property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
30− property real expandedHeight: collapsedHeight
31−
32− property alias avatar: __heroMessageHeader.avatar
33− property alias appIcon: __heroMessageHeader.icon
34−
35− signal activateApp
36− signal dismiss
37−
38− removable: state !== "expanded"
39− implicitHeight: collapsedHeight
40−
41− Rectangle {
42− id: background
43− property real alpha: 0.0
44− anchors.fill: parent
45− color: Qt.rgba(1.0, 1.0, 1.0, alpha)
46− z: -1
47− }
48−
49− HeroMessageHeader {
50− id: __heroMessageHeader
51−
52− anchors.top: parent.top
53− anchors.left: parent.left
54− anchors.right: parent.right
55−
56− avatar: "qrc:/indicators/artwork/messaging/default_contact.png"
57− appIcon: icon
58−
59− state: heroMessage.state
60−
61− onAppIconClicked: {
62− deselectMenu();
63− heroMessage.activateApp();
64− }
65− }
66−
67− onClicked: {
68− if (menuSelected) {
69− deselectMenu();
70− } else {
71− selectMenu();
72− }
73− }
74−
75− Indicators.HLine {
76− id: __topHLine
77− anchors.top: parent.top
78− color: "#403b37"
79− }
80−
81− Indicators.HLine {
82− id: __bottomHLine
83− anchors.bottom: parent.bottom
84− color: "#060606"
85− }
86−
87− states: State {
88− name: "expanded"
89− when: menuSelected
90−
91− PropertyChanges {
92− target: heroMessage
93− implicitHeight: heroMessage.expandedHeight
94− }
95− PropertyChanges {
96− target: background
97− alpha: 0.05
98− }
99− PropertyChanges {
100− target: __topHLine
101− opacity: 0.0
102− }
103− PropertyChanges {
104− target: __bottomHLine
105− opacity: 0.0
106− }
107− }
108−
109− transitions: Transition {
110− ParallelAnimation {
111− NumberAnimation {
112− properties: "opacity,implicitHeight"
113− duration: 200
114− easing.type: Easing.OutQuad
115− }
116− ColorAnimation {}
117− }
118− }
119−
120− onItemRemoved: {
121− heroMessage.dismiss();
122− }
123−}
plugins/Unity/Indicators/Messaging/qml/HeroMessageHeader.qmldeleted−161
@@ -1,161 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−
24−Item {
25− id: heroMessageHeader
26−
27− property alias avatar: avatarImage.source
28− property alias icon: iconImage.source
29− property alias appIcon: appIconImage.source
30− property alias titleText: __titleText
31− property alias subtitleText: __subtitleText
32− property alias bodyText: __bodyText
33− property real bodyBottom: bodyText.y + bodyText.height
34−
35− signal appIconClicked()
36−
37− height: units.gu(9)
38−
39− UbuntuShape {
40− id: avatarImageContainer
41− anchors {
42− top: parent.top
43− topMargin: units.gu(2)
44− left: parent.left
45− leftMargin: units.gu(2)
46− }
47− height: units.gu(6)
48− width: units.gu(6)
49− image: Image {
50− id: avatarImage
51− fillMode: Image.PreserveAspectFit
52− }
53− }
54−
55− Image {
56− id: iconImage
57− anchors {
58− top: parent.top
59− topMargin: units.gu(2)
60− left: avatarImageContainer.right
61− leftMargin: units.gu(1)
62− }
63− height: units.gu(1.5)
64− width: units.gu(2)
65− horizontalAlignment: Image.AlignHCenter
66− verticalAlignment: Image.AlignBottom
67− fillMode: Image.PreserveAspectFit
68− }
69−
70− Label {
71− id: __titleText
72− anchors {
73− baseline: iconImage.bottom
74− left: iconImage.right
75− leftMargin: units.gu(1)
76− right: __appIcon.left
77− rightMargin: units.gu(2)
78− }
79− elide: Text.ElideRight
80− color: "#e8e1d0"
81− font.weight: Font.DemiBold
82− fontSize: "medium"
83− }
84−
85− Label {
86− id: __subtitleText
87− anchors {
88− baseline: __titleText.baseline
89− baselineOffset: units.gu(2.5)
90− left: __titleText.left
91− right: __titleText.right
92− }
93− elide: Text.ElideRight
94− color: "#8f8f88"
95− fontSize: "small"
96− }
97−
98− Label {
99− id: __bodyText
100− anchors {
101− baseline: __subtitleText.baseline
102− baselineOffset: units.gu(2.5)
103− left: __titleText.left
104− right: parent.right
105− rightMargin: units.gu(2)
106− }
107− maximumLineCount: 2
108− wrapMode: Text.WordWrap
109− elide: Text.ElideRight
110− color: "#e8e1d0"
111− fontSize: "small"
112− }
113−
114− Item {
115− id: __appIcon
116− width: units.gu(7)
117− height: units.gu(7)
118− anchors {
119− top: parent.top
120− right: parent.right
121− }
122− opacity: 0.0
123− enabled: heroMessageHeader.state === "expanded"
124−
125− Image {
126− id: appIconImage
127− height: width
128− anchors {
129− left: parent.left
130− leftMargin: units.gu(2)
131− right: parent.right
132− rightMargin: units.gu(2)
133− topMargin: units.gu(1)
134− verticalCenter: parent.verticalCenter
135− }
136− fillMode: Image.PreserveAspectFit
137− }
138−
139− MouseArea {
140− anchors.fill: parent
141− onClicked: heroMessageHeader.appIconClicked()
142− }
143− }
144−
145− states: State {
146− name: "expanded"
147−
148− PropertyChanges {
149− target: __appIcon
150− opacity: 1.0
151− }
152− }
153−
154− transitions: Transition {
155− NumberAnimation {
156− property: "opacity"
157− duration: 200
158− easing.type: Easing.OutQuad
159− }
160− }
161−}
plugins/Unity/Indicators/Messaging/qml/QuickReply.qmldeleted−165
@@ -1,165 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24−
25−Item {
26− id: quickReply
27− property alias buttonText: actionTextField.buttonText
28− property real expandedHeight: childrenRect.height
29− property alias messages : messagelistRepeater.model
30− property alias replyEnabled: actionTextField.activateEnabled
31−
32− signal reply(var value)
33−
34− Item {
35− id: header
36− anchors.top: parent.top
37− anchors.left: parent.left
38− anchors.right: parent.right
39− height: units.gu(4)
40−
41− Row {
42− anchors {
43− fill: parent
44− leftMargin: units.gu(2)
45− rightMargin: units.gu(2)
46− topMargin: units.gu(1)
47− bottomMargin: units.gu(1)
48− }
49− spacing: units.gu(1)
50−
51− Image {
52− width: units.gu(2)
53− height: width
54− fillMode: Image.PreserveAspectFit
55− source: "qrc:/indicators/artwork/messaging/message_sms01_54px.png"
56− }
57−
58− Label {
59− height: parent.height
60− verticalAlignment: Text.AlignVCenter
61− fontSize: "small"
62− color: "#8f8f88"
63− text: "Quick reply with:"
64− }
65− }
66−
67− Indicators.HLine {
68− anchors.bottom: parent.bottom
69− color: "#20201F"
70− }
71− }
72−
73− Column {
74− id: messagelist
75− anchors {
76− left: parent.left
77− right: parent.right
78− top: header.bottom
79− }
80− height: childrenRect.height
81−
82− Repeater {
83− id: messagelistRepeater
84−
85− height: childrenRect.height
86−
87− Item {
88− width: messagelist.width
89− height: units.gu(5)
90−
91− Label {
92− id: __label
93−
94− anchors {
95− fill: parent
96− leftMargin: units.gu(2)
97− rightMargin: units.gu(2)
98− }
99− verticalAlignment: Text.AlignVCenter
100− fontSize: "medium"
101− color: "#e8e1d0"
102− text: modelData
103− }
104−
105− Indicators.HLine {
106− anchors.top: parent.top
107− color: "#464543"
108− }
109−
110− Indicators.HLine {
111− anchors.bottom: parent.bottom
112− color: "#20201F"
113− }
114−
115− MouseArea {
116− id: __mouseArea
117−
118− anchors.fill: parent
119− onClicked: {
120− actionTextField.text = modelData;
121− }
122− }
123−
124− Rectangle {
125− id: __mask
126−
127− anchors.fill: parent
128− color: "black"
129− opacity: __mouseArea.pressed ? 0.3 : 0.0
130− Behavior on opacity {
131− NumberAnimation {
132− duration: 200
133− easing.type: Easing.OutQuad
134− }
135− }
136− }
137− }
138−
139− }
140− }
141−
142− Item {
143− anchors.top: messagelist.bottom
144− anchors.left: parent.left
145− anchors.right: parent.right
146− height: units.gu(6)
147−
148− ActionTextField {
149− id: actionTextField
150−
151− anchors.fill: parent
152− anchors.margins: units.gu(1)
153− activateEnabled: replyEnabled
154−
155− onActivate: {
156− quickReply.reply(value)
157− }
158− }
159−
160− Indicators.HLine {
161− anchors.top: parent.top
162− color: "#464543"
163− }
164− }
165−}
plugins/Unity/Indicators/Messaging/qml/SimpleTextMessage.qmldeleted−108
@@ -1,108 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1
24−import Utils 0.1 as Utils
25−
26−HeroMessage {
27− id: __heroMessage
28−
29− property string title: ""
30− property var time
31− property string message: ""
32−
33− property alias footer: footerLoader.sourceComponent
34−
35− expandedHeight: fullMessage.y + fullMessage.height + units.gu(2)
36− heroMessageHeader.titleText.text: title
37− heroMessageHeader.subtitleText.text: timeFormatter.timeString
38− heroMessageHeader.bodyText.text: message
39−
40− Item {
41− id: fullMessage
42−
43− anchors {
44− left: parent.left
45− leftMargin: units.gu(2)
46− right: parent.right
47− rightMargin: units.gu(2)
48− top: heroMessageHeader.bottom
49− }
50− height: childrenRect.height
51− opacity: 0.0
52− enabled: false
53−
54− Utils.TimeFormatter {
55− id: timeFormatter
56− time: __heroMessage.time
57− format: "hh:mm - MMM dd"
58− }
59−
60− Label {
61− id: bodyText
62− anchors {
63− top: parent.top
64− left: parent.left
65− right: parent.right
66− }
67− wrapMode: Text.WordWrap
68− elide: Text.ElideRight
69− color: "#e8e1d0"
70− fontSize: "medium"
71− text: heroMessageHeader.bodyText.text
72− }
73−
74− Loader {
75− id: footerLoader
76−
77− anchors {
78− top: bodyText.bottom
79− topMargin: units.gu(2)
80− left: parent.left
81− right: parent.right
82− }
83− height: item != undefined ? units.gu(4) : 0
84− }
85−
86− states: State {
87− name: "expanded"
88− when: __heroMessage.state === "expanded"
89−
90− PropertyChanges {
91− target: heroMessageHeader.bodyText
92− opacity: 0.0
93− }
94−
95− PropertyChanges {
96− target: fullMessage
97− opacity: 1.0
98− enabled: true
99− }
100− }
101− transitions: Transition {
102− NumberAnimation {
103− property: "opacity"
104− duration: 200
105− }
106− }
107− }
108−}
plugins/Unity/Indicators/Messaging/qml/SnapDecision.qmldeleted−167
@@ -1,167 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1
24−import Utils 0.1 as Utils
25−
26−HeroMessage {
27− id: snapDecision
28−
29− property string title: ""
30− property var time
31− property string message: ""
32−
33− property bool activateEnabled: true
34− property alias actionButtonText: actionButton.text
35−
36− property bool replyEnabled: true
37− property alias replyMessages: quickreply.messages
38− property alias replyButtonText: quickreply.buttonText
39−
40− expandedHeight: buttons.y + buttons.height + quickreply.height + units.gu(2)
41− heroMessageHeader.titleText.text: title
42− heroMessageHeader.subtitleText.text: message
43− heroMessageHeader.subtitleText.color: "#e8e1d0"
44− heroMessageHeader.bodyText.text: timeFormatter.timeString
45− heroMessageHeader.bodyText.color: "#8f8f88"
46−
47− signal activate
48− signal reply(string value)
49−
50− Item {
51− id: buttons
52−
53− anchors.left: parent.left
54− anchors.leftMargin: units.gu(2)
55− anchors.right: parent.right
56− anchors.rightMargin: units.gu(2)
57− anchors.top: heroMessageHeader.bottom
58− anchors.topMargin: units.gu(1)
59− height: units.gu(4)
60− opacity: 0.0
61−
62− Utils.TimeFormatter {
63− id: timeFormatter
64− time: snapDecision.time
65− format: "hh:mm - MMM dd"
66− }
67−
68− Button {
69− text: "Message"
70− color: "#bababa"
71− anchors.left: parent.left
72− anchors.top: parent.top
73− anchors.bottom: parent.bottom
74− width: (parent.width - units.gu(1)) / 2
75−
76− onClicked: {
77− if (quickreply.state === "") {
78− quickreply.state = "expanded";
79− } else {
80− quickreply.state = "";
81− }
82− }
83− }
84−
85− Button {
86− id: actionButton
87− text: "Call back"
88− color: enabled ? "#c94212" : "#bababa"
89− anchors.right: parent.right
90− anchors.top: parent.top
91− anchors.bottom: parent.bottom
92− width: (parent.width - units.gu(1)) / 2
93− enabled: snapDecision.activateEnabled
94−
95− onClicked: {
96− snapDecision.activate();
97− }
98− }
99−
100− states: State {
101− name: "expanded"
102− when: snapDecision.state === "expanded"
103−
104− PropertyChanges {
105− target: buttons
106− opacity: 1.0
107− }
108− }
109− transitions: Transition {
110− NumberAnimation {
111− property: "opacity"
112− duration: 200
113− easing.type: Easing.OutQuad
114− }
115− }
116− }
117−
118− QuickReply {
119− id: quickreply
120−
121− onReply: {
122− snapDecision.reply(value);
123− }
124−
125− messages: ""
126− buttonText: "Send"
127− anchors {
128− top: buttons.bottom
129− topMargin: units.gu(2)
130− left: parent.left
131− right: parent.right
132− }
133− height: 0
134− opacity: 0.0
135− enabled: false
136− replyEnabled: snapDecision.replyEnabled
137−
138− states: State {
139− name: "expanded"
140−
141− PropertyChanges {
142− target: quickreply
143− height: expandedHeight
144− opacity: 1.0
145− }
146−
147− PropertyChanges {
148− target: quickreply
149− enabled: true
150− }
151− }
152−
153− transitions: Transition {
154− NumberAnimation {
155− properties: "opacity,height"
156− duration: 200
157− easing.type: Easing.OutQuad
158− }
159− }
160− }
161−
162− onStateChanged: {
163− if (state === "") {
164− quickreply.state = "";
165− }
166− }
167−}
plugins/Unity/Indicators/Messaging/qml/TextMessage.qmldeleted−43
@@ -1,43 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Olivier Tilloy <olivier.tilloy@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24−
25−SimpleTextMessage {
26− id: simpleMessage
27−
28− property bool replyEnabled: false
29− property string replyButtonText: "Send"
30−
31− signal reply(string value)
32−
33− footer: ActionTextField {
34− anchors.fill: parent
35−
36− activateEnabled: simpleMessage.replyEnabled
37− buttonText: simpleMessage.replyButtonText
38−
39− onActivate: {
40− simpleMessage.reply(value);
41− }
42− }
43−}
plugins/Unity/Indicators/Messaging/qml/qmldirdeleted−12
@@ -1,12 +0,0 @@
1−module Unity.Indicators.Messaging
2−
3−ActionButton 0.1 ActionButton.qml
4−ActionTextField 0.1 ActionTextField.qml
5−GroupedMessage 0.1 GroupedMessage.qml
6−HeroMessage 0.1 HeroMessage.qml
7−HeroMessageHeader 0.1 HeroMessageHeader.qml
8−MessageMenuItemFactory 0.1 MessageMenuItemFactory.qml
9−QuickReply 0.1 QuickReply.qml
10−SimpleTextMessage 0.1 SimpleTextMessage.qml
11−SnapDecision 0.1 SnapDecision.qml
12−TextMessage 0.1 TextMessage.qml
plugins/Unity/Indicators/Network/CMakeLists.txtdeleted−1
@@ -1 +0,0 @@
1−add_subdirectory(qml)
plugins/Unity/Indicators/Network/qml/AccessPoint.qmldeleted−117
@@ -1,117 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−import Unity.Indicators 0.1 as Indicators
24−
25−Indicators.BaseMenuItem {
26− id: menuItem
27− implicitHeight: units.gu(5.5)
28−
29− property bool checked: false
30− property bool secure: false
31− property bool adHoc: false
32− property int signalStrength: 0
33− property alias label: _label.text
34−
35− signal activate()
36−
37− onCheckedChanged: {
38− // Can't rely on binding. Checked is assigned on click.
39− checkBoxActive.checked = checked;
40− }
41−
42− onClicked: {
43− checkBoxActive.clicked();
44− }
45−
46− CheckBox {
47− id: checkBoxActive
48− height: units.gu(3)
49− width: units.gu(3)
50−
51− anchors {
52− left: parent.left
53− leftMargin: menuItem.__contentsMargins
54− verticalCenter: parent.verticalCenter
55− }
56−
57− onClicked: {
58− menuItem.activate();
59− }
60− }
61−
62− Image {
63− id: iconSignal
64−
65− width: height
66− height: Math.min(units.gu(5), parent.height - units.gu(1))
67− anchors {
68− left: checkBoxActive.right
69− leftMargin: units.gu(1)
70− verticalCenter: parent.verticalCenter
71− }
72−
73− source: {
74− var imageName = "nm-signal-100"
75−
76− if (adHoc) {
77− imageName = "nm-adhoc";
78− } else if (signalStrength == 0) {
79− imageName = "nm-signal-00";
80− } else if (signalStrength <= 25) {
81− imageName = "nm-signal-25";
82− } else if (signalStrength <= 50) {
83− imageName = "nm-signal-50";
84− } else if (signalStrength <= 75) {
85− imageName = "nm-signal-75";
86− }
87− return "image://theme/" + imageName;
88− }
89− }
90−
91− Label {
92− id: _label
93− anchors {
94− left: iconSignal.right
95− leftMargin: units.gu(1)
96− verticalCenter: parent.verticalCenter
97− right: iconSecure.visible ? iconSecure.left : parent.right
98− rightMargin: menuItem.__contentsMargins
99− }
100− elide: Text.ElideRight
101− opacity: label.enabled ? 1.0 : 0.5
102− }
103−
104− Image {
105− id: iconSecure
106− visible: secure
107− source: "qrc:/indicators/artwork/network/secure.svg"
108−
109− width: height
110− height: Math.min(units.gu(4), parent.height - units.gu(1))
111− anchors {
112− right: parent.right
113− rightMargin: units.gu(1)
114− verticalCenter: parent.verticalCenter
115− }
116− }
117−}
plugins/Unity/Indicators/Network/qml/CMakeLists.txtdeleted−5
@@ -1,5 +0,0 @@
1−# export_qmlplugin macro
2−include(Plugins)
3−
4−# export the qmldir, *.qml files.
5−export_qmlfiles(Unity.Indicators.Network Unity/Indicators/Network)
plugins/Unity/Indicators/Network/qml/qmldirdeleted−3
@@ -1,3 +0,0 @@
1−module Unity.Indicators.Network
2−
3−AccessPoint 0.1 AccessPoint.qml
plugins/Unity/Indicators/qml/BaseMenuItem.qmldeleted−38
@@ -1,38 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−
24−ListItem.Standard {
25− id: baseMenu
26−
27− property bool menuSelected: false
28−
29− signal selectMenu()
30− signal deselectMenu()
31−
32− showDivider: false
33− __foregroundColor: "#e8e1d0" // FIXME not in palette yet
34−
35− backgroundIndicator: RemoveBackground {
36− state: baseMenu.swipingState
37− }
38−}
plugins/Unity/Indicators/qml/ButtonMenuItem.qmldeleted−44
@@ -1,44 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24−
25−BaseMenuItem {
26− id: menuItem
27− implicitHeight: units.gu(7)
28−
29− property alias buttonText: button.text
30−
31− signal activate()
32−
33− Button {
34− id: button
35− anchors.centerIn: parent
36− height: units.gu(4)
37− width: units.gu(16)
38− color: "#1b1817"
39−
40− onClicked: {
41− menuItem.activate();
42− }
43− }
44−}
plugins/Unity/Indicators/qml/DivMenuItem.qmldeleted−26
@@ -1,26 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Olivier Tilloy <olivier.tilloy@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−Rectangle {
24− color: "#181514" // FIXME not in palette yet
25− implicitHeight: units.gu(1)
26−}
plugins/Unity/Indicators/qml/FramedMenuItem.qmldeleted−39
@@ -1,39 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Ubuntu.Components.ListItems 0.1 as ListItem
24−
25−BaseMenuItem {
26− implicitHeight: units.gu(7)
27−
28− iconFrame: false
29−
30− HLine {
31− anchors.top: parent.top
32− color: "#403b37" // FIXME not in palette yet
33− }
34−
35− HLine {
36− anchors.bottom: parent.bottom
37− color: "#060606" // FIXME not in palette yet
38− }
39−}
plugins/Unity/Indicators/qml/HLine.qmldeleted−29
@@ -1,29 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−
23−Rectangle {
24− height: units.dp(1)
25− anchors {
26− left: parent.left
27− right: parent.right
28− }
29−}
plugins/Unity/Indicators/qml/MenuItemFactory.qml+226−42
@@ -18,11 +18,10 @@
1818 */
1919
2020import QtQuick 2.0
21−import Unity.Indicators 0.1 as Indicators
22−import Unity.Indicators.Network 0.1 as ICNetwork
23−import Unity.Indicators.Messaging 0.1 as ICMessaging
21+import Ubuntu.Settings.Menus 0.1 as Menus
2422import QMenuModel 0.1 as QMenuModel
25−import Ubuntu.Components 0.1
23+import Utils 0.1 as Utils
24+import Ubuntu.Components.ListItems 0.1 as ListItems
2625
2726Item {
2827 id: menuFactory
@@ -33,12 +32,14 @@ Item {
3332 "unity.widgets.systemsettings.tablet.volumecontrol" : sliderMenu,
3433 "unity.widgets.systemsettings.tablet.switch" : switchMenu,
3534
36− "com.canonical.indicator.button" : buttonMenu,
37− "com.canonical.indicator.div" : divMenu,
38− "com.canonical.indicator.section" : sectionMenu,
39− "com.canonical.indicator.progress" : progressMenu,
40− "com.canonical.indicator.slider" : sliderMenu,
41− "com.canonical.indicator.switch" : switchMenu,
35+ "com.canonical.indicator.button" : buttonMenu,
36+ "com.canonical.indicator.div" : separatorMenu,
37+ "com.canonical.indicator.section" : sectionMenu,
38+ "com.canonical.indicator.progress" : progressMenu,
39+ "com.canonical.indicator.slider" : sliderMenu,
40+ "com.canonical.indicator.switch" : switchMenu,
41+ "com.canonical.indicator.alarm" : alarmMenu,
42+ "com.canonical.indicator.appointment" : appointmentMenu,
4243
4344 "com.canonical.indicator.messages.messageitem" : messageItem,
4445 "com.canonical.indicator.messages.sourceitem" : groupedMessage,
@@ -46,6 +47,9 @@ Item {
4647 "com.canonical.unity.slider" : sliderMenu,
4748 "com.canonical.unity.switch" : switchMenu,
4849
50+ "com.canonical.unity.media-player" : mediaPayerMenu,
51+ "com.canonical.unity.playback-item" : playbackItemMenu,
52+
4953 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
5054 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
5155 }
@@ -58,15 +62,15 @@ Item {
5862 }
5963
6064 Component {
61− id: divMenu;
62− Indicators.DivMenuItem {
63− objectName: "divMenu"
65+ id: separatorMenu;
66+ Menus.SeparatorMenu {
67+ objectName: "separatorMenu"
6468 }
6569 }
6670
6771 Component {
6872 id: sliderMenu;
69− Indicators.SliderMenuItem {
73+ Menus.SliderMenu {
7074 objectName: "sliderMenu"
7175 property QtObject menuData: null
7276 property var menuModel: menuFactory.menuModel
@@ -95,12 +99,12 @@ Item {
9599 onMenuIndexChanged: {
96100 loadAttributes();
97101 }
98− onChangeState: {
102+ onUpdated: {
99103 menuModel.changeState(menuIndex, value);
100104 }
101105
102106 function loadAttributes() {
103− if (!menuModel || menuIndex == undefined) return;
107+ if (!menuModel || menuIndex == -1) return;
104108 menuModel.loadExtendedAttributes(menuIndex, {'min-value': 'double',
105109 'max-value': 'double',
106110 'min-icon': 'icon',
@@ -111,7 +115,7 @@ Item {
111115
112116 Component {
113117 id: buttonMenu;
114− Indicators.ButtonMenuItem {
118+ Menus.ButtonMenu {
115119 objectName: "buttonMenu"
116120 property QtObject menuData: null
117121 property var menuModel: menuFactory.menuModel
@@ -120,7 +124,7 @@ Item {
120124 buttonText: menuData && menuData.label || ""
121125 enabled: menuData && menuData.sensitive || false
122126
123− onActivate: {
127+ onTriggered: {
124128 menuModel.activate(menuIndex);
125129 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
126130 }
@@ -128,18 +132,19 @@ Item {
128132 }
129133 Component {
130134 id: sectionMenu;
131− Indicators.SectionMenuItem {
135+ Menus.SectionMenu {
132136 objectName: "sectionMenu"
133137 property QtObject menuData: null
134138 property var menuIndex: undefined
135139
136140 text: menuData && menuData.label || ""
141+ busy: false
137142 }
138143 }
139144
140145 Component {
141146 id: progressMenu;
142− Indicators.ProgressMenuItem {
147+ Menus.ProgressValueMenu {
143148 objectName: "progressMenu"
144149 property QtObject menuData: null
145150 property int menuIndex: -1
@@ -153,7 +158,7 @@ Item {
153158
154159 Component {
155160 id: standardMenu;
156− Indicators.StandardMenuItem {
161+ ListItems.Standard {
157162 objectName: "standardMenu"
158163 property QtObject menuData: null
159164 property int menuIndex: -1
@@ -161,19 +166,36 @@ Item {
161166 text: menuData && menuData.label || ""
162167 iconSource: menuData && menuData.icon || ""
163168 enabled: menuData && menuData.sensitive || false
164− checkable: menuData ? (menuData.isCheck || menuData.isRadio) : false
165− checked: checkable ? menuData.isToggled : false
166169
167− onActivate: {
170+ onTriggered: {
171+ menuModel.activate(menuIndex);
172+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
173+ }
174+ }
175+ }
176+
177+ Component {
178+ id: checkableMenu;
179+ Menus.CheckableMenu {
180+ objectName: "checkableMenu"
181+ property QtObject menuData: null
182+ property int menuIndex: -1
183+
184+ text: menuData && menuData.label || ""
185+ enabled: menuData && menuData.sensitive || false
186+ checked: menuData && menuData.isToggled || false
187+
188+ onTriggered: {
168189 menuModel.activate(menuIndex);
169190 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
170191 }
171192 }
172193 }
173194
195+
174196 Component {
175197 id: switchMenu;
176− Indicators.SwitchMenuItem {
198+ Menus.SwitchMenu {
177199 objectName: "switchMenu"
178200 property QtObject menuData: null
179201 property int menuIndex: -1
@@ -181,18 +203,94 @@ Item {
181203 text: menuData && menuData.label || ""
182204 iconSource: menuData && menuData.icon || ""
183205 enabled: menuData && menuData.sensitive || false
184− checked: menuData ? menuData.isToggled : false
206+ checked: menuData && menuData.isToggled || false
185207
186− onActivate: {
208+ onTriggered: {
187209 menuModel.activate(menuIndex);
188210 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
189211 }
190212 }
191213 }
192214
215+ Component {
216+ id: alarmMenu;
217+ Menus.EventMenu {
218+ objectName: "alarmMenu"
219+ property QtObject menuData: null
220+ property var menuModel: menuFactory.menuModel
221+ property int menuIndex: -1
222+ property var extendedData: menuData && menuData.ext || undefined
223+ // TODO - bug #1260728
224+ property var timeFormatter: Utils.GDateTimeFormatter {
225+ time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
226+ format: getExtendedProperty(extendedData, "xCanonicalTimeFormat", "")
227+ }
228+
229+ text: menuData && menuData.label || ""
230+ iconSource: menuData && menuData.icon || "image://theme/alarm-clock"
231+ time: timeFormatter.timeString
232+ enabled: menuData && menuData.sensitive || false
233+
234+ onMenuModelChanged: {
235+ loadAttributes();
236+ }
237+ onMenuIndexChanged: {
238+ loadAttributes();
239+ }
240+ onTriggered: {
241+ menuModel.activate(menuIndex);
242+ }
243+
244+ function loadAttributes() {
245+ if (!menuModel || menuIndex == -1) return;
246+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-time': 'int64',
247+ 'x-canonical-time-format': 'string'});
248+ }
249+ }
250+ }
251+
252+ Component {
253+ id: appointmentMenu;
254+ Menus.EventMenu {
255+ objectName: "appointmentMenu"
256+ property QtObject menuData: null
257+ property var menuModel: menuFactory.menuModel
258+ property int menuIndex: -1
259+ property var extendedData: menuData && menuData.ext || undefined
260+ // TODO - bug #1260728
261+ property var timeFormatter: Utils.GDateTimeFormatter {
262+ time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
263+ format: getExtendedProperty(extendedData, "xCanonicalTimeFormat", "")
264+ }
265+
266+ text: menuData && menuData.label || ""
267+ iconSource: menuData && menuData.icon || "image://theme/calendar"
268+ time: timeFormatter.timeString
269+ eventColor: menu && menu.ext.hasOwnProperty("xCanonicalColor") ? menu.ext.xCanonicalColor : Qt.rgba(0.0, 0.0, 0.0, 0.0)
270+ enabled: menuData && menuData.sensitive || false
271+
272+ onMenuModelChanged: {
273+ loadAttributes();
274+ }
275+ onMenuIndexChanged: {
276+ loadAttributes();
277+ }
278+ onTriggered: {
279+ menuModel.activate(menuIndex);
280+ }
281+
282+ function loadAttributes() {
283+ if (!menuModel || menuIndex == -1) return;
284+ menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-color': 'string',
285+ 'x-canonical-time': 'int64',
286+ 'x-canonical-time-format': 'string'});
287+ }
288+ }
289+ }
290+
193291 Component {
194292 id: wifiSection;
195− Indicators.SectionMenuItem {
293+ Menus.SectionMenu {
196294 objectName: "wifiSection"
197295 property QtObject menuData: null
198296 property var menuModel: menuFactory.menuModel
@@ -210,7 +308,7 @@ Item {
210308 }
211309
212310 function loadAttributes() {
213− if (!menuModel || menuIndex == undefined) return;
311+ if (!menuModel || menuIndex == -1) return;
214312 menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-busy-action': 'bool'})
215313 }
216314 }
@@ -218,7 +316,7 @@ Item {
218316
219317 Component {
220318 id: accessPoint;
221− ICNetwork.AccessPoint {
319+ Menus.AccessPointMenu {
222320 objectName: "accessPoint"
223321 property QtObject menuData: null
224322 property var menuModel: menuFactory.menuModel
@@ -231,11 +329,11 @@ Item {
231329 name: getExtendedProperty(extendedData, "xCanonicalWifiApStrengthAction", "")
232330 }
233331
234− label: menuData && menuData.label || ""
332+ text: menuData && menuData.label || ""
235333 enabled: menuData && menuData.sensitive || false
334+ checked: menuData && menuData.isToggled || false
236335 secure: getExtendedProperty(extendedData, "xCanonicalWifiApIsSecure", false)
237336 adHoc: getExtendedProperty(extendedData, "xCanonicalWifiApIsAdhoc", false)
238− checked: menuData ? menuData.isToggled : false
239337 signalStrength: strengthAction.valid ? strengthAction.state : 0
240338
241339 onMenuModelChanged: {
@@ -244,13 +342,13 @@ Item {
244342 onMenuIndexChanged: {
245343 loadAttributes();
246344 }
247− onActivate: {
345+ onTriggered: {
248346 menuModel.activate(menuIndex);
249347 shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
250348 }
251349
252350 function loadAttributes() {
253− if (!menuModel || menuIndex == undefined) return;
351+ if (!menuModel || menuIndex == -1) return;
254352 menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-wifi-ap-is-adhoc': 'bool',
255353 'x-canonical-wifi-ap-is-secure': 'bool',
256354 'x-canonical-wifi-ap-strength-action': 'string'});
@@ -260,7 +358,7 @@ Item {
260358
261359 Component {
262360 id: messageItem
263− ICMessaging.MessageMenuItemFactory {
361+ MessageMenuItemFactory {
264362 objectName: "messageItem"
265363 menuModel: menuFactory.menuModel
266364 }
@@ -268,17 +366,18 @@ Item {
268366
269367 Component {
270368 id: groupedMessage
271− ICMessaging.GroupedMessage {
369+ Menus.GroupedMessageMenu {
272370 objectName: "groupedMessage"
273371 property QtObject menuData: null
274372 property var menuModel: menuFactory.menuModel
275373 property int menuIndex: -1
276374 property var extendedData: menuData && menuData.ext || undefined
277375
278− title: menuData && menuData.label || ""
279− appIcon: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_app.svg")
376+ text: menuData && menuData.label || ""
377+ iconSource: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_app.svg")
280378 count: menuData && menuData.actionState.length > 0 ? menuData.actionState[0] : "0"
281379 enabled: menuData && menuData.sensitive || false
380+ removable: true
282381
283382 onMenuModelChanged: {
284383 loadAttributes();
@@ -286,21 +385,103 @@ Item {
286385 onMenuIndexChanged: {
287386 loadAttributes();
288387 }
289− onActivateApp: {
388+ onClicked: {
290389 menuModel.activate(menuIndex, true);
291390 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
292391 }
293− onDismiss: {
392+ onDismissed: {
294393 menuModel.activate(menuIndex, false);
295394 }
296395
297396 function loadAttributes() {
298− if (!menuModel || menuIndex == undefined) return;
397+ if (!menuModel || menuIndex == -1) return;
299398 menuModel.loadExtendedAttributes(modelIndex, {'icon': 'icon'});
300399 }
301400 }
302401 }
303402
403+ Component {
404+ id: mediaPayerMenu;
405+ Menus.MediaPlayerMenu {
406+ objectName: "mediaPayerMenu"
407+ property QtObject menuData: null
408+ property var menuModel: menuFactory.menuModel
409+ property int menuIndex: -1
410+ property var actionState: menuData && menuData.actionState || undefined
411+
412+ playerIcon: menuData && menuData.icon || ""
413+ playerName: menuData && menuData.label || ""
414+
415+ albumArt: getExtendedProperty(actionState, "art-url", "")
416+ song: getExtendedProperty(actionState, "title", "unknown")
417+ artist: getExtendedProperty(actionState, "artist", "unknown")
418+ album: getExtendedProperty(actionState, "album", "unknown")
419+ running: getExtendedProperty(actionState, "running", false)
420+ state: getExtendedProperty(actionState, "state", "")
421+ enabled: menuData && menuData.sensitive || false
422+
423+ onTriggered: {
424+ model.activate(modelIndex);
425+ }
426+ }
427+ }
428+
429+ Component {
430+ id: playbackItemMenu;
431+ Menus.PlaybackItemMenu {
432+ objectName: "playbackItemMenu"
433+ property QtObject menuData: null
434+ property var menuModel: menuFactory.menuModel
435+ property int menuIndex: -1
436+ property var extendedData: menuData && menuData.ext || undefined
437+
438+ property var playAction: QMenuModel.UnityMenuAction {
439+ model: menuModel
440+ index: menuIndex
441+ name: getExtendedProperty(extendedData, "xCanonicalPlayAction", "")
442+ }
443+ property var nextAction: QMenuModel.UnityMenuAction {
444+ model: menuModel
445+ index: menuIndex
446+ name: getExtendedProperty(extendedData, "xCanonicalNextAction", "")
447+ }
448+ property var previousAction: QMenuModel.UnityMenuAction {
449+ model: menuModel
450+ index: menuIndex
451+ name: getExtendedProperty(extendedData, "xCanonicalPreviousAction", "")
452+ }
453+
454+ playing: playAction.state === "Playing"
455+ canPlay: playAction.valid
456+ canGoNext: nextAction.valid
457+ canGoPrevious: previousAction.valid
458+ enabled: menuData && menuData.sensitive || false
459+
460+ onPlay: {
461+ playAction.activate();
462+ }
463+ onNext: {
464+ nextAction.activate();
465+ }
466+ onPrevious: {
467+ previousAction.activate();
468+ }
469+ onMenuModelChanged: {
470+ loadAttributes();
471+ }
472+ onMenuIndexChanged: {
473+ loadAttributes();
474+ }
475+
476+ function loadAttributes() {
477+ if (!menuModel || menuIndex == -1) return;
478+ menuModel.loadExtendedAttributes(modelIndex, {'x-canonical-play-action': 'string',
479+ 'x-canonical-next-action': 'string',
480+ 'x-canonical-previous-action': 'string'});
481+ }
482+ }
483+ }
484+
304485 function load(modelData) {
305486 if (modelData.type !== undefined) {
306487 var component = _map[modelData.type];
@@ -308,8 +489,11 @@ Item {
308489 return component;
309490 }
310491 }
492+ if (modelData.isCheck || modelData.isRadio) {
493+ return checkableMenu;
494+ }
311495 if (modelData.isSeparator) {
312− return divMenu;
496+ return separatorMenu;
313497 }
314498 return standardMenu;
315499 }
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml → plugins/Unity/Indicators/qml/MessageMenuItemFactory.qmlrenamed+69−28
@@ -20,18 +20,29 @@
2020
2121import QtQuick 2.0
2222import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
23+import Ubuntu.Settings.Menus 0.1 as Menus
2424import QMenuModel 0.1 as QMenuModel
25+import Utils 0.1 as Utils
2526
26−Indicators.BaseMenuItem {
27+Item {
2728 id: messageFactoryItem
2829 property var menuModel: null
2930 property QtObject menuData: null
3031 property int menuIndex: -1
3132
33+ property bool selected: false
34+ signal menuSelected
35+ signal menuDeselected
36+
3237 property var extendedData: menuData && menuData.ext || undefined
3338 property var actionsDescription: getExtendedProperty(extendedData, "xCanonicalMessageActions", undefined)
3439
40+ // TODO - bug #1260728
41+ property var timeFormatter: Utils.TimeFormatter {
42+ time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
43+ format: "hh:mm - MMM dd"
44+ }
45+
3546 onMenuModelChanged: {
3647 loadAttributes();
3748 }
@@ -40,8 +51,7 @@ Indicators.BaseMenuItem {
4051 }
4152
4253 function loadAttributes() {
43− if (!menuModel || menuIndex == undefined) return;
44−
54+ if (!menuModel || menuIndex == -1) return;
4555 menuModel.loadExtendedAttributes(menuIndex, {'x-canonical-time': 'int64',
4656 'x-canonical-text': 'string',
4757 'x-canonical-message-actions': 'variant',
@@ -67,34 +77,46 @@ Indicators.BaseMenuItem {
6777
6878 Component {
6979 id: simpleTextMessage
70− SimpleTextMessage {
80+ Menus.SimpleTextMessageMenu {
81+ id: message
7182 objectName: "simpleTextMessage"
7283 // text
7384 title: menuData && menuData.label || ""
74− time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
85+ time: timeFormatter.timeString
7586 message: getExtendedProperty(extendedData, "xCanonicalText", "")
7687 // icons
7788 avatar: getExtendedProperty(extendedData, "icon", "qrc:/indicators/artwork/messaging/default_contact.png")
7889 appIcon: getExtendedProperty(extendedData, "xCanonicalAppIcon", "qrc:/indicators/artwork/messaging/default_app.svg")
7990 // actions
8091 enabled: menuData && menuData.sensitive || false
92+ removable: !selected
93+ selected: messageFactoryItem.selected
8194
82− onActivateApp: {
95+ onAppActivated: {
8396 menuModel.activate(menuIndex, true);
8497 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
8598 }
86− onDismiss: {
99+ onDismissed: {
87100 menuModel.activate(menuIndex, false);
88101 }
102+ onClicked: {
103+ if (selected) {
104+ menuDeselected();
105+ } else {
106+ menuSelected();
107+ }
108+ }
89109
90− menuSelected: messageFactoryItem.menuSelected
91− onSelectMenu: messageFactoryItem.selectMenu()
92− onDeselectMenu: messageFactoryItem.deselectMenu()
110+ backgroundIndicator: RemoveBackground {
111+ state: message.swipingState
112+ }
93113 }
94114 }
115+
95116 Component {
96117 id: textMessage
97− TextMessage {
118+ Menus.TextMessageMenu {
119+ id: message
98120 objectName: "textMessage"
99121 property var replyActionDescription: actionsDescription && actionsDescription.length > 0 ? actionsDescription[0] : undefined
100122
@@ -106,7 +128,7 @@ Indicators.BaseMenuItem {
106128
107129 // text
108130 title: menuData && menuData.label || ""
109− time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
131+ time: timeFormatter.timeString
110132 message: getExtendedProperty(extendedData, "xCanonicalText", "")
111133 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
112134 // icons
@@ -115,26 +137,36 @@ Indicators.BaseMenuItem {
115137 // actions
116138 replyEnabled: replyAction.valid && replyAction.enabled
117139 enabled: menuData && menuData.sensitive || false
140+ removable: !selected
141+ selected: messageFactoryItem.selected
118142
119− onActivateApp: {
143+ onAppActivated: {
120144 menuModel.activate(menuIndex, true);
121145 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
122146 }
123− onDismiss: {
147+ onDismissed: {
124148 menuModel.activate(menuIndex, false);
125149 }
126− onReply: {
150+ onReplied: {
127151 replyAction.activate(value);
128152 }
153+ onClicked: {
154+ if (selected) {
155+ menuDeselected();
156+ } else {
157+ menuSelected();
158+ }
159+ }
129160
130− menuSelected: messageFactoryItem.menuSelected
131− onSelectMenu: messageFactoryItem.selectMenu()
132− onDeselectMenu: messageFactoryItem.deselectMenu()
161+ backgroundIndicator: RemoveBackground {
162+ state: message.swipingState
163+ }
133164 }
134165 }
135166 Component {
136167 id: snapDecision
137− SnapDecision {
168+ Menus.SnapDecisionMenu {
169+ id: message
138170 objectName: "snapDecision"
139171 property var activateActionDescription: actionsDescription && actionsDescription.length > 0 ? actionsDescription[0] : undefined
140172 property var replyActionDescription: actionsDescription && actionsDescription.length > 1 ? actionsDescription[1] : undefined
@@ -152,7 +184,7 @@ Indicators.BaseMenuItem {
152184
153185 // text
154186 title: menuData && menuData.label || ""
155− time: getExtendedProperty(extendedData, "xCanonicalTime", 0)
187+ time: timeFormatter.timeString
156188 message: getExtendedProperty(extendedData, "xCanonicalText", "")
157189 actionButtonText: getExtendedProperty(activateActionDescription, "label", "Call back")
158190 replyButtonText: getExtendedProperty(replyActionDescription, "label", "Send")
@@ -164,24 +196,33 @@ Indicators.BaseMenuItem {
164196 activateEnabled: activateAction.valid && activateAction.enabled
165197 replyEnabled: replyAction.valid && replyAction.enabled
166198 enabled: menuData && menuData.sensitive || false
199+ removable: !selected
200+ selected: messageFactoryItem.selected
167201
168− onActivateApp: {
202+ onAppActivated: {
169203 menuModel.activate(menuIndex, true);
170204 shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
171205 }
172− onDismiss: {
206+ onDismissed: {
173207 menuModel.activate(menuIndex, false);
174208 }
175− onActivate: {
209+ onActivated: {
176210 activateAction.activate();
177211 }
178− onReply: {
212+ onReplied: {
179213 replyAction.activate(value);
180214 }
215+ onClicked: {
216+ if (selected) {
217+ menuDeselected();
218+ } else {
219+ menuSelected();
220+ }
221+ }
181222
182− menuSelected: messageFactoryItem.menuSelected
183− onSelectMenu: messageFactoryItem.selectMenu()
184− onDeselectMenu: messageFactoryItem.deselectMenu()
223+ backgroundIndicator: RemoveBackground {
224+ state: message.swipingState
225+ }
185226 }
186227 }
187228 }
plugins/Unity/Indicators/qml/ProgressMenuItem.qmldeleted−38
@@ -1,38 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Michael Zanetti <michael.zanetti@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Unity.Indicators 0.1 as Indicators
23−
24−FramedMenuItem {
25− id: menuItem
26−
27− property int value : 0.0
28−
29− control: Label {
30− id: progress
31− anchors.verticalCenter: parent.verticalCenter
32− anchors.right: parent.right
33−
34− text: menuItem.value + " %"
35− fontSize: "medium"
36− color: "#e8e1d0"
37− }
38−}
plugins/Unity/Indicators/qml/SectionMenuItem.qmldeleted−54
@@ -1,54 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1
22−import Ubuntu.Components.ListItems 0.1 as ListItem
23−
24−BaseMenuItem {
25− id: menuItem
26− property alias text: header.text
27− property bool busy: false
28−
29− implicitHeight: text !== "" ? header.height : 0
30−
31− ListItem.Header {
32− id: header
33−
34− height: units.gu(4)
35− anchors {
36− left: parent.left
37− right: parent.right
38− top: parent.top
39− }
40− visible: text != ""
41−
42− ActivityIndicator {
43− id: indicator
44− running: busy
45− anchors {
46− margins: units.gu(0.5)
47− right: parent.right
48− }
49− height: parent.height - (anchors.margins * 2)
50− width: height
51− anchors.verticalCenter: parent.verticalCenter
52− }
53− }
54−}
plugins/Unity/Indicators/qml/SliderMenuItem.qmldeleted−106
@@ -1,106 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1 as Components
23−import Unity.Indicators 0.1 as Indicators
24−
25−FramedMenuItem {
26− id: menuItem
27−
28− property alias minimumValue: slider.minimumValue
29− property alias maximumValue: slider.maximumValue
30− property double value: 0.0
31−
32− property alias minIcon: leftImage.source
33− property alias maxIcon: rightImage.source
34−
35− property QtObject d: QtObject {
36− property bool enableValueConnection: true
37− }
38−
39− signal changeState(real value)
40−
41− onValueChanged: {
42− // TODO: look into adding a component to manage bi-directional bindings.
43− var oldEnable = d.enableValueConnection
44− d.enableValueConnection = false;
45−
46− // Can't rely on binding. Slider value is assigned by user slide.
47− slider.value = value;
48−
49− d.enableValueConnection = oldEnable;
50− }
51−
52− control: Item {
53− id: row
54− width: menuItem.text ? units.gu(20) : menuItem.width - (2 * menuItem.__contentsMargins)
55− height: slider.height
56−
57− Image {
58− id: leftImage
59− visible: status === Image.Ready
60− anchors.left: row.left
61− anchors.verticalCenter: row.verticalCenter
62− height: units.gu(4)
63− width: height
64− }
65−
66− Components.Slider {
67− id: slider
68− anchors {
69− left: leftImage.visible ? leftImage.right : row.left
70− right: rightImage.visible ? rightImage.left : row.right
71− leftMargin: leftImage.visible ? units.gu(0.5) : 0
72− rightMargin: rightImage.visible ? units.gu(0.5) : 0
73− }
74− live: true
75−
76− Component.onCompleted: {
77− value = menuItem.value
78− }
79−
80− minimumValue: 0.0
81− maximumValue: 0.1
82−
83− // FIXME - to be deprecated in Ubuntu.Components.
84− // Use this to disable the label, since there is not way to do it on the component.
85− function formatValue(v) {
86− return "";
87− }
88−
89− Connections {
90− target: d.enableValueConnection ? slider : null
91− onValueChanged: {
92− menuItem.changeState(slider.value);
93− }
94− }
95− }
96−
97− Image {
98− id: rightImage
99− visible: status === Image.Ready
100− anchors.right: row.right
101− anchors.verticalCenter: row.verticalCenter
102− height: units.gu(4)
103− width: height
104− }
105− }
106−}
plugins/Unity/Indicators/qml/StandardMenuItem.qmldeleted−71
@@ -1,71 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Nick Dedekind <nick.dedekind@canonical.com>
18− */
19−
20−import QtQuick 2.0
21−import Ubuntu.Components 0.1 as Components
22−import Unity.Indicators 0.1 as Indicators
23−
24−FramedMenuItem {
25− id: menuItem
26−
27− property bool checkable: false
28− property bool checked: false
29−
30− signal activate()
31−
32− // FIXME : need a radio button from sdk
33− // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1211866
34− onCheckableChanged: {
35− if (checkable) {
36− icon = checkComponent.createObject(menuItem);
37− }
38− }
39−
40− onCheckedChanged: {
41− // Can't rely on binding. Checked is assigned on click.
42− if (icon) {
43− icon.checked = checked;
44− }
45− }
46−
47− onClicked: {
48− if (checkable && icon) {
49− icon.clicked();
50− } else {
51− menuItem.activate();
52− }
53− }
54−
55− property var checkComponent: Component {
56− Components.CheckBox {
57− anchors.verticalCenter: parent.verticalCenter
58− anchors.left: parent.left
59−
60− Component.onCompleted: {
61− checked = menuItem.checked;
62− }
63−
64− // FIXME : should use Checkbox.toggled signal
65− // lp:~nick-dedekind/ubuntu-ui-toolkit/checkbox.toggled
66− onClicked: {
67− menuItem.activate();
68− }
69− }
70− }
71−}
plugins/Unity/Indicators/qml/SwitchMenuItem.qmldeleted−53
@@ -1,53 +0,0 @@
1−/*
2− * Copyright 2013 Canonical Ltd.
3− *
4− * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU Lesser General Public License as published by
6− * the Free Software Foundation; version 3.
7− *
8− * This program is distributed in the hope that it will be useful,
9− * but WITHOUT ANY WARRANTY; without even the implied warranty of
10− * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU Lesser General Public License for more details.
12− *
13− * You should have received a copy of the GNU Lesser General Public License
14− * along with this program. If not, see <http://www.gnu.org/licenses/>.
15− *
16− * Authors:
17− * Renato Araujo Oliveira Filho <renato@canonical.com>
18− * Nick Dedekind <nick.dedekind@canonical.com>
19− */
20−
21−import QtQuick 2.0
22−import Ubuntu.Components 0.1
23−import Unity.Indicators 0.1 as Indicators
24−
25−FramedMenuItem {
26− id: menuItem
27−
28− property bool checked: false
29−
30− signal activate()
31−
32− onCheckedChanged: {
33− // Can't rely on binding. Checked is assigned on click.
34− switcher.checked = checked;
35− }
36−
37− control: Switch {
38− id: switcher
39−
40− Component.onCompleted: {
41− checked = menuItem.checked;
42− }
43−
44− anchors.verticalCenter: parent.verticalCenter
45− anchors.right: parent.right
46−
47− // FIXME : should use Checkbox.toggled signal
48− // lp:~nick-dedekind/ubuntu-ui-toolkit/checkbox.toggled
49− onClicked: {
50− menuItem.activate();
51− }
52− }
53−}
plugins/Unity/Indicators/qml/qmldir+1−12
@@ -2,20 +2,9 @@ module Unity.Indicators
22plugin IndicatorsQml
33typeinfo plugin.qmltypes
44
5−BaseMenuItem 0.1 BaseMenuItem.qml
6−ButtonMenuItem 0.1 ButtonMenuItem.qml
75CachedUnityMenuModel 0.1 CachedUnityMenuModel.qml
8−DivMenuItem 0.1 DivMenuItem.qml
9−FramedMenuItem 0.1 FramedMenuItem.qml
10−HLine 0.1 HLine.qml
116IndicatorBase 0.1 IndicatorBase.qml
12−MenuActionBinding 0.1 MenuActionBinding.qml
137MenuItemFactory 0.1 MenuItemFactory.qml
14−ProgressMenuItem 0.1 ProgressMenuItem.qml
15−SectionMenuItem 0.1 SectionMenuItem.qml
16−SliderMenuItem 0.1 SliderMenuItem.qml
17−StandardMenuItem 0.1 StandardMenuItem.qml
18−SwitchMenuItem 0.1 SwitchMenuItem.qml
19−
8+MessageMenuItemFactory 0.1 MessageMenuItemFactory.qml
209
2110internal RemoveBackground RemoveBackground.qml
plugins/Unity/Indicators/resources/artwork/messaging/message_sms01_54px.pngdeleted

Binary file not shown.

plugins/Unity/Indicators/resources/artwork/network/secure.svgdeleted−71
@@ -1,71 +0,0 @@
1−<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2−<!-- Created with Inkscape (http://www.inkscape.org/) -->
3−
4−<svg
5− xmlns:dc="http://purl.org/dc/elements/1.1/"
6− xmlns:cc="http://creativecommons.org/ns#"
7− xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8− xmlns:svg="http://www.w3.org/2000/svg"
9− xmlns="http://www.w3.org/2000/svg"
10− xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11− xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12− width="64"
13− height="64"
14− id="svg2986"
15− version="1.1"
16− inkscape:version="0.48.4 r9939"
17− sodipodi:docname="secure.svg">
18− <defs
19− id="defs2988" />
20− <sodipodi:namedview
21− id="base"
22− pagecolor="#ffffff"
23− bordercolor="#666666"
24− borderopacity="1.0"
25− inkscape:pageopacity="0.0"
26− inkscape:pageshadow="2"
27− inkscape:zoom="7.9180415"
28− inkscape:cx="7.5048745"
29− inkscape:cy="29.401628"
30− inkscape:current-layer="layer1"
31− showgrid="true"
32− inkscape:grid-bbox="true"
33− inkscape:document-units="px"
34− inkscape:snap-grids="false"
35− inkscape:window-width="1549"
36− inkscape:window-height="876"
37− inkscape:window-x="51"
38− inkscape:window-y="24"
39− inkscape:window-maximized="1">
40− <inkscape:grid
41− type="xygrid"
42− id="grid3012"
43− empspacing="5"
44− visible="true"
45− enabled="true"
46− snapvisiblegridlinesonly="true" />
47− </sodipodi:namedview>
48− <metadata
49− id="metadata2991">
50− <rdf:RDF>
51− <cc:Work
52− rdf:about="">
53− <dc:format>image/svg+xml</dc:format>
54− <dc:type
55− rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
56− <dc:title />
57− </cc:Work>
58− </rdf:RDF>
59− </metadata>
60− <g
61− id="layer1"
62− inkscape:label="Layer 1"
63− inkscape:groupmode="layer"
64− transform="translate(0,32)">
65− <path
66− inkscape:connector-curvature="0"
67− d="M 29.999999,-18 C 25.568001,-18 22,-14.432 22,-10 v 6 h -2 c -1.107999,0 -2,0.892 -2,2 v 18 c 0,1.108 0.892001,2 2,2 h 24 c 1.108,0 2,-0.892 2,-2 V -2 c 0,-1.108 -0.892,-2 -2,-2 h -2 v -6 c 0,-4.432 -3.568001,-8 -8.000001,-8 h -4 z m 0,4 h 4 c 2.216,0 4,1.784 4,4 v 6 H 26.000001 v -6 c 0,-2.216 1.784,-4 3.999998,-4 z"
68− style="fill:#dfdbd2;fill-rule:evenodd"
69− id="path8" />
70− </g>
71−</svg>
plugins/Unity/Indicators/resources/indicators.qrc−2
@@ -1,8 +1,6 @@
11<RCC>
22 <qresource prefix="/indicators">
3− <file>artwork/network/secure.svg</file>
43 <file>artwork/messaging/default_contact.png</file>
54 <file>artwork/messaging/default_app.svg</file>
6− <file>artwork/messaging/message_sms01_54px.png</file>
75 </qresource>
86</RCC>
qml/Panel/Indicators/DefaultIndicatorPage.qml+9−5
@@ -138,10 +138,14 @@ Indicators.IndicatorBase {
138138 sourceComponent: factory.load(model)
139139
140140 onLoaded: {
141+ if (item.hasOwnProperty("selected")) {
142+ item.selected = mainMenu.selectedIndex == index;
143+ }
141144 if (item.hasOwnProperty("menuSelected")) {
142− item.menuSelected = mainMenu.selectedIndex == index;
143− item.selectMenu.connect(function() { mainMenu.selectedIndex = index; });
144− item.deselectMenu.connect(function() { mainMenu.selectedIndex = -1; });
145+ item.menuSelected.connect(function() { mainMenu.selectedIndex = index; });
146+ }
147+ if (item.hasOwnProperty("menuDeselected")) {
148+ item.menuDeselected.connect(function() { mainMenu.selectedIndex = -1; });
145149 }
146150 if (item.hasOwnProperty("menuData")) {
147151 item.menuData = Qt.binding(function() { return model; });
@@ -162,8 +166,8 @@ Indicators.IndicatorBase {
162166 Connections {
163167 target: mainMenu
164168 onSelectedIndexChanged: {
165− if (loader.item && loader.item.hasOwnProperty("menuSelected")) {
166− loader.item.menuSelected = mainMenu.selectedIndex == index;
169+ if (loader.item && loader.item.hasOwnProperty("selected")) {
170+ loader.item.selected = mainMenu.selectedIndex == index;
167171 }
168172 }
169173 }
qml/Panel/Indicators/client/IndicatorsList.qml+14−13
@@ -40,24 +40,25 @@ Page {
4040 anchors.fill: parent
4141 model: indicatorsModel
4242
43− delegate: Indicators.FramedMenuItem {
43+ delegate: Rectangle {
44+ color: "#221e1c"
45+
4446 anchors.left: parent.left
4547 anchors.right: parent.right
46− objectName: identifier
47−
48− text: identifier
48+ height: menuItem.height
4949
50− onClicked: {
51− var new_page = Qt.createComponent("IndicatorsPage.qml");
52− page.pageStack.push(new_page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource});
53− }
50+ ListItem.Standard {
51+ id: menuItem
52+ anchors.left: parent.left
53+ anchors.right: parent.right
54+ objectName: identifier
5455
55− Rectangle {
56− id: background
56+ text: identifier
5757
58− anchors.fill: parent
59− color: "#221e1c"
60− z: -1
58+ onClicked: {
59+ var new_page = Qt.createComponent("IndicatorsPage.qml");
60+ page.pageStack.push(new_page.createObject(pages), {"indicatorProperties" : model.indicatorProperties, "pageSource" : model.pageSource});
61+ }
6162 }
6263 }
6364 }
tests/qmltests/Panel/Indicators/tst_DefaultIndicatorPage.qml−4
@@ -129,14 +129,10 @@ Item {
129129 function test_reloadData() {
130130 var mainMenu = findChild(page, "mainMenu");
131131
132− console.log("setting empty data");
133132 page.menuModel.modelData = [];
134133 tryCompare(mainMenu, "count", 0);
135− console.log("set empty data");
136134
137− console.log("setting full data");
138135 page.menuModel.modelData = fullMenuData;
139− console.log("set full data");
140136 tryCompare(mainMenu, "count", 3);
141137
142138 page.menuModel.modelData = [];
tests/qmltests/Panel/Indicators/tst_MenuItemFactory.qml+194−18
@@ -84,11 +84,13 @@ Item {
8484 { tag: 'switch1', type: "unity.widgets.systemsettings.tablet.switch", objectName: "switchMenu" },
8585
8686 { tag: 'button', type: "com.canonical.indicator.button", objectName: "buttonMenu" },
87− { tag: 'separator', type: "com.canonical.indicator.div", objectName: "divMenu" },
87+ { tag: 'separator', type: "com.canonical.indicator.div", objectName: "separatorMenu" },
8888 { tag: 'section', type: "com.canonical.indicator.section", objectName: "sectionMenu" },
8989 { tag: 'progress', type: "com.canonical.indicator.progress", objectName: "progressMenu" },
9090 { tag: 'slider1', type: "com.canonical.indicator.slider", objectName: "sliderMenu" },
9191 { tag: 'switch2', type: "com.canonical.indicator.switch", objectName: "switchMenu" },
92+ { tag: 'alarm', type: "com.canonical.indicator.alarm", objectName: "alarmMenu" },
93+ { tag: 'appointment', type: "com.canonical.indicator.appointment", objectName: "appointmentMenu" },
9294
9395 { tag: 'messageItem', type: "com.canonical.indicator.messages.messageitem", objectName: "messageItem" },
9496 { tag: 'sourceItem', type: "com.canonical.indicator.messages.sourceitem", objectName: "groupedMessage" },
@@ -96,8 +98,8 @@ Item {
9698 { tag: 'slider2', type: "com.canonical.unity.slider", objectName: "sliderMenu" },
9799 { tag: 'switch3', type: "com.canonical.unity.switch", objectName: "switchMenu" },
98100
99− { tag: 'mediaplayer', type: "com.canonical.unity.media-player", objectName: "standardMenu" },
100− { tag: 'playbackitem', type: "com.canonical.unity.playback-item", objectName: "standardMenu" },
101+ { tag: 'mediaplayer', type: "com.canonical.unity.media-player", objectName: "mediaPayerMenu" },
102+ { tag: 'playbackitem', type: "com.canonical.unity.playback-item", objectName: "playbackItemMenu" },
101103
102104 { tag: 'wifisection', type: "unity.widgets.systemsettings.tablet.wifisection", objectName: "wifiSection" },
103105 { tag: 'accesspoint', type: "unity.widgets.systemsettings.tablet.accesspoint", objectName: "accessPoint" },
@@ -115,6 +117,16 @@ Item {
115117 compare(loader.item.objectName, data.objectName, "Created object name does not match intended object (" + loader.item.objectName + " != " + data.objectName + ")");
116118 }
117119
120+ function test_create_checkable() {
121+ var tmpData = menuData;
122+ tmpData.isCheck = true;
123+
124+ loader.data = tmpData;
125+ loader.sourceComponent = factory.load(tmpData);
126+ tryCompareFunction(function() { return loader.item != undefined; }, true);
127+ compare(loader.item.objectName, "checkableMenu", "Should have created a checkable menu");
128+ }
129+
118130 function test_create_radio() {
119131 skip("No radio component");
120132 menuData.isRadio = true;
@@ -131,7 +143,7 @@ Item {
131143 loader.data = menuData;
132144 loader.sourceComponent = factory.load(menuData);
133145 tryCompareFunction(function() { return loader.item != undefined; }, true);
134− compare(loader.item.objectName, "divMenu", "Should have created a separator menu");
146+ compare(loader.item.objectName, "separatorMenu", "Should have created a separator menu");
135147 }
136148
137149 function test_create_sliderMenu_data() {
@@ -145,13 +157,13 @@ Item {
145157 menuData.type = "com.canonical.indicator.slider"
146158 menuData.label = data.label;
147159 menuData.sensitive = data.enabled;
148− menuData.actionState = data.value;
149160 menuData.ext = {
150161 'minIcon': "file:///testMinIcon",
151162 'maxIcon': "file:///testMaxIcon",
152163 'minValue': data.minValue,
153164 'maxValue': data.maxValue
154165 };
166+ menuData.actionState = data.value;
155167
156168 loader.data = menuData;
157169 loader.sourceComponent = factory.load(menuData);
@@ -163,7 +175,7 @@ Item {
163175 compare(loader.item.maxIcon, "file:///testMaxIcon", "MaxIcon does not match data");
164176 compare(loader.item.minimumValue, data.minValue, "MinValue does not match data");
165177 compare(loader.item.maximumValue, data.maxValue, "MaxValue does not match data");
166− compare(loader.item.value, data.value, "Calue does not match data");
178+ compare(loader.item.value, data.value, "Value does not match data");
167179 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
168180 }
169181
@@ -232,7 +244,7 @@ Item {
232244
233245 function test_create_standardMenu_data() {
234246 return [
235− {label: "testLabel1", enabled: true, icon: "file:///testIcon" },
247+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
236248 {label: "testLabel2", enabled: false, icon: "file:///testIcon2"},
237249 ];
238250 }
@@ -253,31 +265,101 @@ Item {
253265 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
254266 }
255267
256− function test_create_switchMenu_data() {
268+ function test_create_checkableMenu_data() {
257269 return [
258270 {label: "testLabel1", enabled: true, checked: false },
259271 {label: "testLabel2", enabled: false, checked: true },
260272 ];
261273 }
262274
275+ function test_create_checkableMenu(data) {
276+ menuData.type = "";
277+ menuData.label = data.label;
278+ menuData.sensitive = data.enabled;
279+ menuData.isCheck = true;
280+ menuData.isToggled = data.checked;
281+
282+ loader.data = menuData;
283+ loader.sourceComponent = factory.load(menuData);
284+ tryCompareFunction(function() { return loader.item != undefined; }, true);
285+ compare(loader.item.objectName, "checkableMenu", "Should have created a checkable menu");
286+
287+ compare(loader.item.text, data.label, "Label does not match data");
288+ compare(loader.item.checked, data.checked, "Checked does not match data");
289+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
290+ }
291+
292+ function test_create_switchMenu_data() {
293+ return [
294+ {label: "testLabel1", enabled: true, checked: false, icon: "file:///testIcon1" },
295+ {label: "testLabel2", enabled: false, checked: true, icon: "file:///testIcon2" },
296+ ];
297+ }
298+
263299 function test_create_switchMenu(data) {
264300 menuData.type = "com.canonical.indicator.switch";
265301 menuData.label = data.label;
266302 menuData.sensitive = data.enabled;
267− menuData.icon = "file:///testIcon";
303+ menuData.icon = data.icon;
268304 menuData.isToggled = data.checked;
269305
270306 loader.data = menuData;
271307 loader.sourceComponent = factory.load(menuData);
272308 tryCompareFunction(function() { return loader.item != undefined; }, true);
273− compare(loader.item.objectName, "switchMenu", "Should have created a standard menu");
309+ compare(loader.item.objectName, "switchMenu", "Should have created a switch menu");
274310
275311 compare(loader.item.text, data.label, "Label does not match data");
276− compare(loader.item.icon, "file:///testIcon", "MaxIcon does not match data");
312+ compare(loader.item.iconSource, data.icon, "Icon does not match data");
277313 compare(loader.item.checked, data.checked, "Checked does not match data");
278314 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
279315 }
280316
317+ function test_create_alarmMenu_data() {
318+ return [
319+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
320+ {label: "testLabel2", enabled: false, icon: "file:///testIcon2" },
321+ ];
322+ }
323+
324+ function test_create_alarmMenu(data) {
325+ menuData.type = "com.canonical.indicator.alarm";
326+ menuData.label = data.label;
327+ menuData.sensitive = data.enabled;
328+ menuData.icon = data.icon;
329+
330+ loader.data = menuData;
331+ loader.sourceComponent = factory.load(menuData);
332+ tryCompareFunction(function() { return loader.item != undefined; }, true);
333+ compare(loader.item.objectName, "alarmMenu", "Should have created a alarm menu");
334+
335+ compare(loader.item.text, data.label, "Label does not match data");
336+ compare(loader.item.iconSource, data.icon, "Icon does not match data");
337+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
338+ }
339+
340+ function test_create_appointmentMenu_data() {
341+ return [
342+ {label: "testLabel1", enabled: true, icon: "file:///testIcon1" },
343+ {label: "testLabel2", enabled: false, icon: "file:///testIcon2" },
344+ ];
345+ }
346+
347+ function test_create_appointmentMenu(data) {
348+ menuData.type = "com.canonical.indicator.appointment";
349+ menuData.label = data.label;
350+ menuData.sensitive = data.enabled;
351+ menuData.icon = data.icon;
352+
353+ loader.data = menuData;
354+ loader.sourceComponent = factory.load(menuData);
355+ tryCompareFunction(function() { return loader.item != undefined; }, true);
356+ compare(loader.item.objectName, "appointmentMenu", "Should have created a appointment menu");
357+
358+ compare(loader.item.text, data.label, "Label does not match data");
359+ compare(loader.item.iconSource, data.icon, "Icon does not match data");
360+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
361+ }
362+
281363 function test_create_wifiSection_data() {
282364 return [
283365 {label: "testLabel1", busy: false },
@@ -322,7 +404,7 @@ Item {
322404 tryCompareFunction(function() { return loader.item != undefined; }, true);
323405 compare(loader.item.objectName, "accessPoint", "Should have created a access point menu");
324406
325− compare(loader.item.label, data.label, "Label does not match data");
407+ compare(loader.item.text, data.label, "Label does not match data");
326408 compare(loader.item.strengthAction.name, "action::strength", "Strength action incorrect");
327409 compare(loader.item.secure, data.secure, "Secure does not match data");
328410 compare(loader.item.adHoc, data.adHoc, "AdHoc does not match data");
@@ -341,8 +423,8 @@ Item {
341423
342424 function test_create_groupedMessage_data() {
343425 return [
344− {label: "testLabel1", enabled: true, count: "5", appIcon: "file:///testIcon" },
345− {label: "testLabel2", enabled: false, count: "10", appIcon: "file:///testIcon2" },
426+ {label: "testLabel1", enabled: true, count: "5", icon: "file:///testIcon" },
427+ {label: "testLabel2", enabled: false, count: "10", icon: "file:///testIcon2" },
346428 ];
347429 }
348430
@@ -350,8 +432,8 @@ Item {
350432 menuData.type = "com.canonical.indicator.messages.sourceitem";
351433 menuData.label = data.label;
352434 menuData.sensitive = data.enabled;
353− menuData.icon = data.appIcon;
354− menuData.ext = { 'icon': data.appIcon };
435+ menuData.icon = data.icon;
436+ menuData.ext = { 'icon': data.icon };
355437 menuData.actionState = [data.count];
356438 menuData.isToggled = true;
357439
@@ -360,9 +442,103 @@ Item {
360442 tryCompareFunction(function() { return loader.item != undefined; }, true);
361443 compare(loader.item.objectName, "groupedMessage", "Should have created a group message menu");
362444
363− compare(loader.item.title, data.label, "Label does not match data");
445+ compare(loader.item.text, data.label, "Label does not match data");
364446 compare(loader.item.count, data.count, "Count does not match data");
365− compare(loader.item.appIcon, data.appIcon, "App Icon does not match data");
447+ compare(loader.item.iconSource, data.icon, "Icon does not match data");
448+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
449+ }
450+
451+ function test_create_mediaPayerMenu_data() {
452+ return [{
453+ label: "player1",
454+ icon: "file:://icon1",
455+ albumArt: "file:://art1",
456+ song: "song1",
457+ artist: "artist1",
458+ album: "album1",
459+ running: true,
460+ state: "Playing",
461+ enabled: true
462+ },{
463+ label: "player2",
464+ icon: "file:://icon2",
465+ albumArt: "file:://art2",
466+ song: "song2",
467+ artist: "artist2",
468+ album: "album2",
469+ running: false,
470+ state: "Paused",
471+ enabled: false
472+ }
473+ ];
474+ }
475+
476+ function test_create_mediaPayerMenu(data) {
477+ menuData.type = "com.canonical.unity.media-player";
478+ menuData.label = data.label;
479+ menuData.sensitive = data.enabled;
480+ menuData.icon = data.icon;
481+ menuData.actionState = {
482+ 'art-url': data.albumArt,
483+ 'title': data.song,
484+ 'artist': data.artist,
485+ 'album': data.album,
486+ 'running': data.running,
487+ 'state': data.state,
488+ };
489+
490+ loader.data = menuData;
491+ loader.sourceComponent = factory.load(menuData);
492+ tryCompareFunction(function() { return loader.item != undefined; }, true);
493+ compare(loader.item.objectName, "mediaPayerMenu", "Should have created a media player menu");
494+
495+ compare(loader.item.playerIcon, data.icon, "Album art does not match data");
496+ compare(loader.item.playerName, data.label, "Album art does not match data");
497+ compare(loader.item.albumArt, data.albumArt, "Album art does not match data");
498+ compare(loader.item.song, data.song, "Song does not match data");
499+ compare(loader.item.artist, data.artist, "Artist does not match data");
500+ compare(loader.item.album, data.album, "Album does not match data");
501+ compare(loader.item.running, data.running, "Running does not match data");
502+ compare(loader.item.state, data.state, "State does not match data");
503+ compare(loader.item.enabled, data.enabled, "Enabled does not match data");
504+ }
505+
506+ function test_create_playbackItemMenu_data() {
507+ return [{
508+ playAction: "action::play",
509+ nextAction: "action::next",
510+ previousAction: "action::previous",
511+ enabled: true
512+ },{
513+ playAction: "action::play2",
514+ nextAction: "action::next2",
515+ previousAction: "action::previous2",
516+ enabled: false
517+ }
518+ ];
519+ }
520+
521+ function test_create_playbackItemMenu(data) {
522+ menuData.type = "com.canonical.unity.playback-item";
523+ menuData.sensitive = data.enabled;
524+ menuData.ext = {
525+ 'xCanonicalPlayAction': data.playAction,
526+ 'xCanonicalNextAction': data.nextAction,
527+ 'xCanonicalPreviousAction': data.previousAction
528+ };
529+
530+ loader.data = menuData;
531+ loader.sourceComponent = factory.load(menuData);
532+ tryCompareFunction(function() { return loader.item != undefined; }, true);
533+ compare(loader.item.objectName, "playbackItemMenu", "Should have created a playback menu");
534+
535+ compare(loader.item.playing, false, "Playing does not match data");
536+ compare(loader.item.playAction.name, data.playAction, "Play action incorrect");
537+ compare(loader.item.nextAction.name, data.nextAction, "Next action incorrect");
538+ compare(loader.item.previousAction.name, data.previousAction, "Previous action incorrect");
539+ compare(loader.item.canPlay, false, "CanPlay should be false");
540+ compare(loader.item.canGoNext, false, "CanGoNext should be false");
541+ compare(loader.item.canGoPrevious, false, "CanGoPrevious should be false");
366542 compare(loader.item.enabled, data.enabled, "Enabled does not match data");
367543 }
368544 }
tests/qmltests/Panel/Indicators/tst_MessageMenuItemFactory.qml+13−4
@@ -18,7 +18,8 @@ import QtQuick 2.0
1818import QtTest 1.0
1919import Unity.Test 0.1 as UT
2020import QMenuModel 0.1
21−import Unity.Indicators.Messaging 0.1 as Indicators
21+import Unity.Indicators 0.1 as Indicators
22+import Utils 0.1 as Utils
2223
2324Item {
2425 id: testView
@@ -31,6 +32,11 @@ Item {
3132 menuIndex: 0
3233 }
3334
35+ Utils.TimeFormatter {
36+ id: timeFormatter
37+ format: "hh:mm - MMM dd"
38+ }
39+
3440 UT.UnityTestCase {
3541 name: "MessageMenuItemFactory"
3642
@@ -82,13 +88,14 @@ Item {
8288 'xCanonicalAppIcon': data.appIcon,
8389 };
8490 factory.menuData = menuData;
91+ timeFormatter.time = data.time;
8592
8693 var loader = findChild(factory, "loader");
8794 verify(loader !== undefined);
8895
8996 tryCompare(loader.item, "objectName", "simpleTextMessage");
9097 compare(loader.item.title, data.title, "Title does not match data");
91− compare(loader.item.time, data.time, "Time does not match data");
98+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
9299 compare(loader.item.message, data.message, "Message does not match data");
93100 compare(loader.item.avatar, data.avatar, "Avatar does not match data");
94101 compare(loader.item.appIcon, data.appIcon, "App icon does not match data");
@@ -119,13 +126,14 @@ Item {
119126 ]
120127 };
121128 factory.menuData = menuData;
129+ timeFormatter.time = data.time;
122130
123131 var loader = findChild(factory, "loader");
124132 verify(loader !== undefined);
125133
126134 tryCompare(loader.item, "objectName", "textMessage");
127135 compare(loader.item.title, data.title, "Title does not match data");
128− compare(loader.item.time, data.time, "Time does not match data");
136+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
129137 compare(loader.item.message, data.message, "Message does not match data");
130138 compare(loader.item.avatar, data.avatar, "Avatar does not match data");
131139 compare(loader.item.appIcon, data.appIcon, "App icon does not match data");
@@ -160,13 +168,14 @@ Item {
160168 ]
161169 };
162170 factory.menuData = menuData;
171+ timeFormatter.time = data.time;
163172
164173 var loader = findChild(factory, "loader");
165174 verify(loader !== undefined);
166175
167176 tryCompare(loader.item, "objectName", "snapDecision");
168177 compare(loader.item.title, data.title, "Title does not match data");
169− compare(loader.item.time, data.time, "Time does not match data");
178+ compare(loader.item.time, timeFormatter.timeString, "Time does not match data");
170179 compare(loader.item.message, data.message, "Message does not match data");
171180 compare(loader.item.avatar, data.avatar, "Avatar does not match data");
172181 compare(loader.item.appIcon, data.appIcon, "App icon does not match data");