on xenial help sign in
Moved Messaging to current indicators.
f932c2cNick Dedekind
Panel/IndicatorsDataModel.qml+2−2
@@ -36,8 +36,8 @@ Indicators.IndicatorsModel {
36 'indicator-messages' : {
36 'indicator-messages' : {
37 'title': 'Messaging',
37 'title': 'Messaging',
38 'description' : '',
38 'description' : '',
39− 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/MessagingIndicatorWidget.qml',
39+ 'widgetSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorWidget2.qml',
40− 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/MessagingIndicatorPage.qml'
40+ 'pageSource' : ApplicationPaths.shellAppDirectory()+'/Panel/Indicators/DefaultIndicatorPage2.qml'
41 },
41 },
42 'indicator-sound' : {
42 'indicator-sound' : {
43 'title': 'Sound',
43 'title': 'Sound',
plugins/Unity/Indicators/CMakeLists.txt+1
@@ -12,6 +12,7 @@ find_package(Qt5Core REQUIRED)
12find_package(Qt5Quick REQUIRED)
12find_package(Qt5Quick REQUIRED)
13
13
14add_subdirectory(qml)
14add_subdirectory(qml)
15+add_subdirectory(Messaging)
15add_subdirectory(Network)
16add_subdirectory(Network)
16
17
17include_directories(
18include_directories(
plugins/Unity/IndicatorsLegacy/Messaging/CMakeLists.txt → plugins/Unity/Indicators/Messaging/CMakeLists.txtrenamed

The content is the same.

plugins/Unity/IndicatorsLegacy/Messaging/qml/ActionButton.qml → plugins/Unity/Indicators/Messaging/qml/ActionButton.qmlrenamed

The content is the same.

plugins/Unity/IndicatorsLegacy/Messaging/qml/ActionTextField.qml → plugins/Unity/Indicators/Messaging/qml/ActionTextField.qmlrenamed+8−6
@@ -22,12 +22,12 @@ import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23
23
24Item {
24Item {
25− property alias actionGroup: sendButton.actionGroup
25+ id: textField
26− property alias action: sendButton.action
27−
28 property alias text: replyField.text
26 property alias text: replyField.text
29 property alias buttonText: sendButton.text
27 property alias buttonText: sendButton.text
30
28
29+ signal activate(var value)
30+
31 TextField {
31 TextField {
32 id: replyField
32 id: replyField
33
33
@@ -50,10 +50,8 @@ Item {
50 }
50 }
51 }
51 }
52
52
53− ActionButton {
53+ Button {
54 id: sendButton
54 id: sendButton
55−
56− actionParameter: replyField.text
57 anchors {
55 anchors {
58 top: parent.top
56 top: parent.top
59 bottom: parent.bottom
57 bottom: parent.bottom
@@ -62,5 +60,9 @@ Item {
62 width: units.gu(9)
60 width: units.gu(9)
63 enabled: replyField.text !== ""
61 enabled: replyField.text !== ""
64 color: enabled ? "#c94212" : "#bababa"
62 color: enabled ? "#c94212" : "#bababa"
63+
64+ onClicked: {
65+ textField.activate(replyField.text);
66+ }
65 }
67 }
66}
68}
plugins/Unity/Indicators/Messaging/qml/CMakeLists.txtnew file+5
@@ -0,0 +1,5 @@
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/IndicatorsLegacy/Messaging/qml/GroupedMessage.qml → plugins/Unity/Indicators/Messaging/qml/GroupedMessage.qmlrenamed+13−18
@@ -20,20 +20,19 @@
20
20
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23−import Unity.IndicatorsLegacy 0.1 as Indicators
23+import Unity.Indicators 0.1 as Indicators
24
24
25−Indicators.BasicMenuItem {
25+Indicators.BaseMenuItem {
26 id: groupedMessage
26 id: groupedMessage
27+
28+ property alias title: __title.text
27 property alias count: label.text
29 property alias count: label.text
30+ property string appIcon: "qrc:/indicators/artwork/messaging/default_app.svg"
28
31
29− color: "#221e1b"
32+ signal activateApp()
30− implicitHeight: units.gu(10)
33+ signal dismiss()
31
34
32− Indicators.MenuAction {
35+ implicitHeight: units.gu(10)
33− id: menuAction
34− actionGroup: groupedMessage.actionGroup
35− action: menu ? menu.action : ""
36− }
37
36
38 Row {
37 Row {
39 anchors.fill: parent
38 anchors.fill: parent
@@ -44,17 +43,17 @@ Indicators.BasicMenuItem {
44 height: units.gu(6)
43 height: units.gu(6)
45 width: units.gu(6)
44 width: units.gu(6)
46 image: Image {
45 image: Image {
47− source: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicators/artwork/messaging/default_app.svg"
46+ source: groupedMessage.appIcon
48 fillMode: Image.PreserveAspectFit
47 fillMode: Image.PreserveAspectFit
49 }
48 }
50 }
49 }
51
50
52 Label {
51 Label {
52+ id: __title
53 anchors.verticalCenter: parent.verticalCenter
53 anchors.verticalCenter: parent.verticalCenter
54 color: "#e8e1d0"
54 color: "#e8e1d0"
55 font.weight: Font.DemiBold
55 font.weight: Font.DemiBold
56 fontSize: "medium"
56 fontSize: "medium"
57− text: menu && menu.label ? menu.label : ""
58 }
57 }
59
58
60 Label {
59 Label {
@@ -65,7 +64,7 @@ Indicators.BasicMenuItem {
65 color: "#e8e1d0"
64 color: "#e8e1d0"
66 font.weight: Font.DemiBold
65 font.weight: Font.DemiBold
67 fontSize: "medium"
66 fontSize: "medium"
68− text: menuAction.valid ? menuAction.state[0] : "0"
67+ text: "0"
69 }
68 }
70 }
69 }
71
70
@@ -82,15 +81,11 @@ Indicators.BasicMenuItem {
82 MouseArea {
81 MouseArea {
83 anchors.fill: parent
82 anchors.fill: parent
84 onClicked: {
83 onClicked: {
85− if (menuAction.valid) {
84+ groupedMessage.activateApp();
86− menuAction.activate(true);
87− }
88 }
85 }
89 }
86 }
90
87
91 onItemRemoved: {
88 onItemRemoved: {
92− if (menuAction.valid) {
89+ groupedMessage.dismiss();
93− menuAction.activate(false);
94− }
95 }
90 }
96}
91}
plugins/Unity/IndicatorsLegacy/Messaging/qml/HeroMessage.qml → plugins/Unity/Indicators/Messaging/qml/HeroMessage.qmlrenamed+16−23
@@ -20,27 +20,25 @@
20
20
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23−import Unity.IndicatorsLegacy 0.1 as Indicators
23+import Unity.Indicators 0.1 as Indicators
24
24
25−Indicators.BasicMenuItem {
25+Indicators.BaseMenuItem {
26 id: heroMessage
26 id: heroMessage
27
27
28− property variant actionsDescription: null
28+ property var actionsDescription: menu ? menu.ext.xCanonicalMessageActions : undefined
29 property alias heroMessageHeader: __heroMessageHeader
29 property alias heroMessageHeader: __heroMessageHeader
30 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
30 property real collapsedHeight: heroMessageHeader.y + heroMessageHeader.bodyBottom + units.gu(2)
31 property real expandedHeight: collapsedHeight
31 property real expandedHeight: collapsedHeight
32
32
33− color: "#221e1c"
33+ property alias avatar: __heroMessageHeader.avatar
34+ property alias appIcon: __heroMessageHeader.icon
35+
36+ signal activateApp
37+ signal dismiss
34
38
35 removable: state !== "expanded"
39 removable: state !== "expanded"
36 implicitHeight: collapsedHeight
40 implicitHeight: collapsedHeight
37
41
38− Indicators.MenuAction {
39− id: menuAction
40− actionGroup: heroMessage.actionGroup
41− action: menu ? menu.action : ""
42− }
43−
44 HeroMessageHeader {
42 HeroMessageHeader {
45 id: __heroMessageHeader
43 id: __heroMessageHeader
46
44
@@ -48,25 +46,22 @@ Indicators.BasicMenuItem {
48 anchors.left: parent.left
46 anchors.left: parent.left
49 anchors.right: parent.right
47 anchors.right: parent.right
50
48
51− avatar: menu && (menu.extra.canonical_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_icon) : "qrc:/indicators/artwork/messaging/default_contact.png"
49+ avatar: "qrc:/indicators/artwork/messaging/default_contact.png"
52− icon: menu && (menu.extra.canonical_app_icon.length > 0) ? "image://gicon/" + encodeURI(menu.extra.canonical_app_icon) : ""
53 appIcon: icon
50 appIcon: icon
54
51
55 state: heroMessage.state
52 state: heroMessage.state
56
53
57 onAppIconClicked: {
54 onAppIconClicked: {
58− if (menuAction.valid) {
55+ deselectMenu();
59− deactivateMenu();
56+ heroMessage.activateApp();
60− action.activate(true);
61− }
62 }
57 }
63 }
58 }
64
59
65 onClicked: {
60 onClicked: {
66− if (menuActivated) {
61+ if (menuSelected) {
67− deactivateMenu();
62+ deselectMenu();
68 } else {
63 } else {
69− activateMenu();
64+ selectMenu();
70 }
65 }
71 }
66 }
72
67
@@ -84,7 +79,7 @@ Indicators.BasicMenuItem {
84
79
85 states: State {
80 states: State {
86 name: "expanded"
81 name: "expanded"
87− when: menuActivated
82+ when: menuSelected
88
83
89 PropertyChanges {
84 PropertyChanges {
90 target: heroMessage
85 target: heroMessage
@@ -113,8 +108,6 @@ Indicators.BasicMenuItem {
113 }
108 }
114
109
115 onItemRemoved: {
110 onItemRemoved: {
116− if (menuAction.valid) {
111+ heroMessage.dismiss();
117− menuAction.activate(false);
118− }
119 }
112 }
120}
113}
plugins/Unity/IndicatorsLegacy/Messaging/qml/HeroMessageHeader.qml → plugins/Unity/Indicators/Messaging/qml/HeroMessageHeader.qmlrenamed

The content is the same.

plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qmlnew file+173
@@ -0,0 +1,173 @@
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+import QMenuModel 0.1 as QMenuModel
25+import "utils.js" as Utils
26+
27+Indicators.BaseMenuItem {
28+ id: menuItem
29+ property var actionsDescription: menu ? menu.ext.xCanonicalMessageActions : undefined
30+
31+ implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
32+
33+ property var model: null
34+
35+ Loader {
36+ id: contents
37+ anchors.fill: parent
38+
39+ sourceComponent: loadMessage(actionsDescription);
40+
41+ // Binding all properties for the item, to make sure that any change in the
42+ // property will be propagated to the contents.item at any time
43+ Binding {
44+ target: contents.item
45+ property: "menuSelected"
46+ value: menuSelected
47+ when: (contents.status == Loader.Ready)
48+ }
49+
50+ Binding {
51+ target: contents.item
52+ property: "menu"
53+ value: menu
54+ when: (contents.status == Loader.Ready)
55+ }
56+
57+ Connections {
58+ target: contents.item ? contents.item : null
59+ onSelectMenu: selectMenu()
60+ onDeselectMenu: deselectMenu()
61+ }
62+
63+ Component {
64+ id: simpleTextMessage
65+ SimpleTextMessage {
66+ // text
67+ title: menu && menu.label ? menu.label : ""
68+ time: menu ? Utils.formatDate(menu.ext.xCanonicalTime) : ""
69+ message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
70+ // icons
71+ avatar: menu && menu.ext.xCanonicalIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalIcon) : "qrc:/indicators/artwork/messaging/default_contact.png"
72+ appIcon: menu && menu.ext.xCanonicalAppIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalAppIcon) : ""
73+
74+ onActivateApp: {
75+ menuItem.model.activate(modelIndex, true);
76+ }
77+ onDismiss: {
78+ menuItem.model.activate(modelIndex, false);
79+ }
80+ }
81+ }
82+ Component {
83+ id: textMessage
84+ TextMessage {
85+ property var replyAction: QMenuModel.UnityMenuAction {
86+ model: menuItem.model
87+ name: menu && actionsDescription[0].name ? actionsDescription[0].name : ""
88+ }
89+
90+ // text
91+ title: menu && menu.label ? menu.label : ""
92+ time: menu ? Utils.formatDate(menu.ext.xCanonicalTime) : ""
93+ message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
94+ // icons
95+ avatar: menu && menu.ext.xCanonicalIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalIcon) : "qrc:/indicators/artwork/messaging/default_contact.png"
96+ appIcon: menu && menu.ext.xCanonicalAppIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalAppIcon) : ""
97+ // actions
98+ replyButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Send"
99+
100+ onActivateApp: {
101+ menuItem.model.activate(modelIndex, true);
102+ }
103+ onDismiss: {
104+ menuItem.model.activate(modelIndex, false);
105+ }
106+ onReply: {
107+ replyAction.activate(value);
108+ }
109+ }
110+ }
111+ Component {
112+ id: snapDecision
113+ SnapDecision {
114+ property var activateAction: QMenuModel.UnityMenuAction {
115+ model: menuItem.model
116+ name: menu && actionsDescription[0].name ? actionsDescription[0].name : ""
117+ }
118+ property var replyAction: QMenuModel.UnityMenuAction {
119+ model: menuItem.model
120+ name: menu && actionsDescription[1].name ? actionsDescription[1].name : ""
121+ }
122+
123+ // text
124+ title: menu && menu.label ? menu.label : ""
125+ time: menu ? Utils.formatDate(menu.ext.xCanonicalTime) : ""
126+ message: menu && menu.ext.xCanonicalText ? menu.ext.xCanonicalText : ""
127+ actionButtonText: actionsDescription && actionsDescription[0].label ? actionsDescription[0].label : "Call back"
128+ replyButtonText: actionsDescription && actionsDescription[1].label ? actionsDescription[1].label : "Send"
129+ replyMessages: actionsDescription && actionsDescription[1]["parameter-hint"] ? actionsDescription[1]["parameter-hint"] : ""
130+ // icons
131+ avatar: menu && menu.ext.xCanonicalIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalIcon) : "qrc:/indicators/artwork/messaging/default_contact.png"
132+ appIcon: menu && menu.ext.xCanonicalAppIcon ? "image://gicon/" + encodeURI(menu.ext.xCanonicalAppIcon) : ""
133+
134+ onActivateApp: {
135+ menuItem.model.activate(modelIndex, true);
136+ }
137+ onDismiss: {
138+ menuItem.model.activate(modelIndex, false);
139+ }
140+ onActivate: {
141+ callbackAction.activate();
142+ }
143+ onReply: {
144+ replyAction.activate(value);
145+ }
146+ }
147+ }
148+ }
149+
150+ function loadMessage(actions)
151+ {
152+ var parameterType = ""
153+ for (var actIndex in actions) {
154+ var desc = actions[actIndex];
155+ if (desc["parameter-type"] !== undefined) {
156+ parameterType += desc["parameter-type"];
157+ } else {
158+ parameterType += "_";
159+ }
160+ }
161+
162+ if (parameterType === "") {
163+ return simpleTextMessage;
164+ } else if (parameterType === "s") {
165+ return textMessage;
166+ } else if (parameterType === "_s") {
167+ return snapDecision;
168+ } else {
169+ console.debug("Unknown paramater type: " + parameterType);
170+ }
171+ return undefined;
172+ }
173+}
plugins/Unity/IndicatorsLegacy/Messaging/qml/QuickReply.qml → plugins/Unity/Indicators/Messaging/qml/QuickReply.qmlrenamed+7−3
@@ -23,13 +23,13 @@ import Ubuntu.Components 0.1
23import Unity.IndicatorsLegacy 0.1 as Indicators
23import Unity.IndicatorsLegacy 0.1 as Indicators
24
24
25Item {
25Item {
26− property alias actionGroup: actionTextField.actionGroup
26+ id: quickReply
27− property alias action: actionTextField.action
28−
29 property alias buttonText: actionTextField.buttonText
27 property alias buttonText: actionTextField.buttonText
30 property real expandedHeight: childrenRect.height
28 property real expandedHeight: childrenRect.height
31 property alias messages : messagelistRepeater.model
29 property alias messages : messagelistRepeater.model
32
30
31+ signal reply(var value)
32+
33 Item {
33 Item {
34 id: header
34 id: header
35 anchors.top: parent.top
35 anchors.top: parent.top
@@ -150,6 +150,10 @@ Item {
150
150
151 anchors.fill: parent
151 anchors.fill: parent
152 anchors.margins: units.gu(1)
152 anchors.margins: units.gu(1)
153+
154+ onActivate: {
155+ quickReply.reply(value)
156+ }
153 }
157 }
154
158
155 Indicators.HLine {
159 Indicators.HLine {
plugins/Unity/IndicatorsLegacy/Messaging/qml/SimpleTextMessage.qml → plugins/Unity/Indicators/Messaging/qml/SimpleTextMessage.qmlrenamed+7−4
@@ -20,17 +20,20 @@
20
20
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23−import "utils.js" as Utils
24
23
25HeroMessage {
24HeroMessage {
26 id: __heroMessage
25 id: __heroMessage
27
26
27+ property string title: ""
28+ property string time: ""
29+ property string message: ""
30+
28 property alias footer: footerLoader.sourceComponent
31 property alias footer: footerLoader.sourceComponent
29
32
30 expandedHeight: fullMessage.y + fullMessage.height + units.gu(2)
33 expandedHeight: fullMessage.y + fullMessage.height + units.gu(2)
31− heroMessageHeader.titleText.text: menu ? menu.label : ""
34+ heroMessageHeader.titleText.text: title
32− heroMessageHeader.subtitleText.text: menu ? Utils.formatDate(menu.extra.canonical_time) : ""
35+ heroMessageHeader.subtitleText.text: time
33− heroMessageHeader.bodyText.text: menu ? menu.extra.canonical_text : ""
36+ heroMessageHeader.bodyText.text: message
34
37
35 Item {
38 Item {
36 id: fullMessage
39 id: fullMessage
plugins/Unity/IndicatorsLegacy/Messaging/qml/SnapDecision.qml → plugins/Unity/Indicators/Messaging/qml/SnapDecision.qmlrenamed+27−13
@@ -20,19 +20,30 @@
20
20
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23−import Unity.IndicatorsLegacy 0.1 as Indicators
23+import Unity.Indicators 0.1 as Indicators
24import "utils.js" as Utils
24import "utils.js" as Utils
25
25
26HeroMessage {
26HeroMessage {
27 id: snapDecision
27 id: snapDecision
28
28
29+ property string title: ""
30+ property string time: ""
31+ property string message: ""
32+
33+ property alias actionButtonText: actionButton.text
34+ property alias replyMessages: quickreply.messages
35+ property alias replyButtonText: quickreply.buttonText
36+
29 expandedHeight: buttons.y + buttons.height + quickreply.height + units.gu(2)
37 expandedHeight: buttons.y + buttons.height + quickreply.height + units.gu(2)
30− heroMessageHeader.titleText.text: menu ? menu.label : ""
38+ heroMessageHeader.titleText.text: title
31− heroMessageHeader.subtitleText.text: menu ? menu.extra.canonical_text : ""
39+ heroMessageHeader.subtitleText.text: message
32 heroMessageHeader.subtitleText.color: "#e8e1d0"
40 heroMessageHeader.subtitleText.color: "#e8e1d0"
33− heroMessageHeader.bodyText.text: menu ? Utils.formatDate(menu.extra.canonical_time) : ""
41+ heroMessageHeader.bodyText.text: time
34 heroMessageHeader.bodyText.color: "#8f8f88"
42 heroMessageHeader.bodyText.color: "#8f8f88"
35
43
44+ signal activate
45+ signal reply(string value)
46+
36 Item {
47 Item {
37 id: buttons
48 id: buttons
38
49
@@ -62,16 +73,18 @@ HeroMessage {
62 }
73 }
63 }
74 }
64
75
65− ActionButton {
76+ Button {
66− actionGroup: snapDecision.actionGroup
77+ id: actionButton
67− action: actionsDescription[0].name
78+ text: "Call back"
68−
69− text: actionsDescription ? actionsDescription[0].label : "Call back"
70 color: "#c94212"
79 color: "#c94212"
71 anchors.right: parent.right
80 anchors.right: parent.right
72 anchors.top: parent.top
81 anchors.top: parent.top
73 anchors.bottom: parent.bottom
82 anchors.bottom: parent.bottom
74 width: (parent.width - units.gu(1)) / 2
83 width: (parent.width - units.gu(1)) / 2
84+
85+ onClicked: {
86+ snapDecision.activate();
87+ }
75 }
88 }
76
89
77 states: State {
90 states: State {
@@ -95,11 +108,12 @@ HeroMessage {
95 QuickReply {
108 QuickReply {
96 id: quickreply
109 id: quickreply
97
110
111+ onReply: {
98− actionGroup: snapDecision.actionGroup
112+ snapDecision.reply(value);
99− action: actionsDescription[1].name
113+ }
100
114
101− messages: actionsDescription ? actionsDescription[1]["parameter-hint"] : ""
115+ messages: ""
102− buttonText: actionsDescription ? actionsDescription[1].label : "send"
116+ buttonText: "Send"
103 anchors {
117 anchors {
104 top: buttons.bottom
118 top: buttons.bottom
105 topMargin: units.gu(2)
119 topMargin: units.gu(2)
plugins/Unity/IndicatorsLegacy/Messaging/qml/TextMessage.qml → plugins/Unity/Indicators/Messaging/qml/TextMessage.qmlrenamed+10−4
@@ -20,16 +20,22 @@
20
20
21import QtQuick 2.0
21import QtQuick 2.0
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23−import Unity.IndicatorsLegacy 0.1 as Indicators
23+import Unity.Indicators 0.1 as Indicators
24
24
25SimpleTextMessage {
25SimpleTextMessage {
26 id: simpleMessage
26 id: simpleMessage
27
27
28+ property string replyButtonText: "Send"
29+
30+ signal reply(string value)
31+
28 footer: ActionTextField {
32 footer: ActionTextField {
29 anchors.fill: parent
33 anchors.fill: parent
30− actionGroup: simpleMessage.actionGroup
31− action: actionsDescription[0].name
32
34
33− buttonText: actionsDescription ? actionsDescription[0].label : "Send"
35+ buttonText: simpleMessage.replyButtonText
36+
37+ onActivate: {
38+ simpleMessage.reply(value);
39+ }
34 }
40 }
35}
41}
plugins/Unity/IndicatorsLegacy/Messaging/qml/qmldir → plugins/Unity/Indicators/Messaging/qml/qmldirrenamed+2−2
@@ -1,11 +1,11 @@
1−module Unity.IndicatorsLegacy.Messaging
1+module Unity.Indicators.Messaging
2
2
3ActionButton 0.1 ActionButton.qml
3ActionButton 0.1 ActionButton.qml
4ActionTextField 0.1 ActionTextField.qml
4ActionTextField 0.1 ActionTextField.qml
5GroupedMessage 0.1 GroupedMessage.qml
5GroupedMessage 0.1 GroupedMessage.qml
6HeroMessage 0.1 HeroMessage.qml
6HeroMessage 0.1 HeroMessage.qml
7HeroMessageHeader 0.1 HeroMessageHeader.qml
7HeroMessageHeader 0.1 HeroMessageHeader.qml
8−MessageMenuItem 0.1 MessageMenuItem.qml
8+MessageMenuItemFactory 0.1 MessageMenuItemFactory.qml
9QuickReply 0.1 QuickReply.qml
9QuickReply 0.1 QuickReply.qml
10SimpleTextMessage 0.1 SimpleTextMessage.qml
10SimpleTextMessage 0.1 SimpleTextMessage.qml
11SnapDecision 0.1 SnapDecision.qml
11SnapDecision 0.1 SnapDecision.qml
plugins/Unity/IndicatorsLegacy/Messaging/qml/utils.js → plugins/Unity/Indicators/Messaging/qml/utils.jsrenamed

The content is the same.

plugins/Unity/Indicators/qml/BaseMenuItem.qml+1−1
@@ -24,7 +24,7 @@ import Ubuntu.Components.ListItems 0.1 as ListItem
24ListItem.Standard {
24ListItem.Standard {
25 id: baseMenu
25 id: baseMenu
26
26
27− property bool menuActivated: false
27+ property bool menuSelected: false
28
28
29 signal selectMenu()
29 signal selectMenu()
30 signal deselectMenu()
30 signal deselectMenu()
plugins/Unity/Indicators/qml/IndicatorPage.qml+4−4
@@ -89,10 +89,10 @@ IndicatorBase {
89 menuStack.push(mainMenu.model.submenu(index));
89 menuStack.push(mainMenu.model.submenu(index));
90 }
90 }
91
91
92− if (item.hasOwnProperty("menuActivated")) {
92+ if (item.hasOwnProperty("menuSelected")) {
93− item.menuActivated = Qt.binding(function() { return ListView.isCurrentItem; });
93+ item.menuSelected = Qt.binding(function() { return mainMenu.currentIndex == index; });
94− item.selectMenu.connect(function() { ListView.view.currentIndex = index });
94+ item.selectMenu.connect(function() { mainMenu.currentIndex = index; });
95− item.deselectMenu.connect(function() { ListView.view.currentIndex = -1 });
95+ item.deselectMenu.connect(function() { mainMenu.currentIndex = -1; });
96 }
96 }
97 if (item.hasOwnProperty("menu")) {
97 if (item.hasOwnProperty("menu")) {
98 item.menu = Qt.binding(function() { return model; });
98 item.menu = Qt.binding(function() { return model; });
plugins/Unity/Indicators/qml/MenuItemFactory.qml+67−17
@@ -20,6 +20,7 @@
20import QtQuick 2.0
20import QtQuick 2.0
21import Unity.Indicators 0.1 as Indicators
21import Unity.Indicators 0.1 as Indicators
22import Unity.Indicators.Network 0.1 as ICNetwork
22import Unity.Indicators.Network 0.1 as ICNetwork
23+import Unity.Indicators.Messaging 0.1 as ICMessaging
23import QMenuModel 0.1 as QMenuModel
24import QMenuModel 0.1 as QMenuModel
24
25
25Item {
26Item {
@@ -38,6 +39,9 @@ Item {
38 "com.canonical.indicator.slider" : sliderMenu,
39 "com.canonical.indicator.slider" : sliderMenu,
39 "com.canonical.indicator.switch" : switchMenu,
40 "com.canonical.indicator.switch" : switchMenu,
40
41
42+ "com.canonical.indicator.messages.messageitem" : messageItem,
43+ "com.canonical.indicator.messages.sourceitem" : groupedMessage,
44+
41 "com.canonical.unity.slider" : sliderMenu,
45 "com.canonical.unity.slider" : sliderMenu,
42 "com.canonical.unity.switch" : switchMenu,
46 "com.canonical.unity.switch" : switchMenu,
43
47
@@ -45,15 +49,17 @@ Item {
45 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
49 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
46 }
50 }
47
51
52+ Component { id: divMenu; Indicators.DivMenuItem {} }
53+
48 Component {
54 Component {
49 id: sliderMenu;
55 id: sliderMenu;
50 Indicators.SliderMenuItem {
56 Indicators.SliderMenuItem {
51 property QtObject menu: null
57 property QtObject menu: null
52
58
53 text: menu && menu.label ? menu.label : ""
59 text: menu && menu.label ? menu.label : ""
54− icon: menu ? menu.icon : ""
60+ icon: menu && menu.icon ? menu.icon : ""
55− minIcon: menu.ext.minIcon
61+ minIcon: menu && menu.ext.minIcon ? menu.ext.minIcon : ""
56− maxIcon: menu.ext.maxIcon
62+ maxIcon: menu && menu.ext.maxIcon ? menu.ext.maxIcon : ""
57
63
58 minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
64 minimumValue: menu.ext.minValue ? menu.ext.minValue : 0.0
59 maximumValue: {
65 maximumValue: {
@@ -94,8 +100,6 @@ Item {
94 }
100 }
95 }
101 }
96
102
97− Component { id: divMenu; Indicators.DivMenuItem {} }
98−
99 Component {
103 Component {
100 id: buttonMenu;
104 id: buttonMenu;
101 Indicators.ButtonMenuItem {
105 Indicators.ButtonMenuItem {
@@ -104,7 +108,9 @@ Item {
104 text: menu && menu.label ? menu.label : ""
108 text: menu && menu.label ? menu.label : ""
105 enabled: menu ? menu.sensitive : false
109 enabled: menu ? menu.sensitive : false
106
110
111+ onActivate: {
107− onActivate: model.activate(modelIndex);
112+ model.activate(modelIndex);
113+ }
108 }
114 }
109 }
115 }
110 Component {
116 Component {
@@ -133,12 +139,14 @@ Item {
133 property QtObject menu: null
139 property QtObject menu: null
134
140
135 text: menu && menu.label ? menu.label : ""
141 text: menu && menu.label ? menu.label : ""
136− icon: menu ? menu.icon : ""
142+ icon: menu && menu.icon ? menu.icon : ""
137 checkable: menu ? (menu.isCheck || menu.isRadio) : false
143 checkable: menu ? (menu.isCheck || menu.isRadio) : false
138 checked: checkable ? menu.isToggled : false
144 checked: checkable ? menu.isToggled : false
139 enabled: menu ? menu.sensitive : false
145 enabled: menu ? menu.sensitive : false
140
146
147+ onActivate: {
141− onActivate: model.activate(modelIndex);
148+ model.activate(modelIndex);
149+ }
142 }
150 }
143 }
151 }
144
152
@@ -148,11 +156,13 @@ Item {
148 property QtObject menu: null
156 property QtObject menu: null
149
157
150 text: menu && menu.label ? menu.label : ""
158 text: menu && menu.label ? menu.label : ""
151− icon: menu ? menu.icon : ""
159+ icon: menu && menu.icon ? menu.icon : ""
152 checked: menu ? menu.isToggled : false
160 checked: menu ? menu.isToggled : false
153 enabled: menu ? menu.sensitive : false
161 enabled: menu ? menu.sensitive : false
154
162
163+ onActivate: {
155− onActivate: model.activate(modelIndex);
164+ model.activate(modelIndex);
165+ }
156 }
166 }
157 }
167 }
158
168
@@ -174,17 +184,16 @@ Item {
174 id: accessPoint;
184 id: accessPoint;
175 ICNetwork.AccessPoint {
185 ICNetwork.AccessPoint {
176 property QtObject menu: null
186 property QtObject menu: null
177−// property var strenthAction: QMenuModel.UnityMenuAction {
187+ property var strenthAction: QMenuModel.UnityMenuAction {
178−// model: menuFactory.model ? menuFactory.model : null
188+ model: menuFactory.model ? menuFactory.model : null
179−// name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
189+ name: menu ? menu.ext.xCanonicalWifiApStrengthAction : ""
180−// }
190+ }
181
191
182 text: menu && menu.label ? menu.label : ""
192 text: menu && menu.label ? menu.label : ""
183− icon: menu ? menu.icon : ""
184 secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
193 secure: menu ? menu.ext.xCanonicalWifiApIsSecure : false
185 adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
194 adHoc: menu ? menu.ext.xCanonicalWifiApIsAdhoc : false
186 checked: menu ? menu.isToggled : false
195 checked: menu ? menu.isToggled : false
187−// signalStrength: strenthAction.valid ? strenthAction.state : 0
196+ signalStrength: strenthAction.valid ? strenthAction.state : 0
188 enabled: menu ? menu.sensitive : false
197 enabled: menu ? menu.sensitive : false
189
198
190 Component.onCompleted: {
199 Component.onCompleted: {
@@ -192,7 +201,48 @@ Item {
192 'x-canonical-wifi-ap-is-secure': 'bool',
201 'x-canonical-wifi-ap-is-secure': 'bool',
193 'x-canonical-wifi-ap-strength-action': 'string'});
202 'x-canonical-wifi-ap-strength-action': 'string'});
194 }
203 }
204+ onActivate: {
205+ model.activate(modelIndex);
206+ }
207+ }
208+ }
209+
210+ Component {
211+ id: messageItem
212+ ICMessaging.MessageMenuItemFactory {
213+
214+ property QtObject menu: null
215+ model: menuFactory.model ? menuFactory.model : null
216+
217+ Component.onCompleted: {
218+ model.loadExtendedAttributes(modelIndex, {'x-canonical-time': 'int64',
219+ 'x-canonical-text': 'string',
220+ 'x-canonical-message-actions': 'variant',
221+ 'x-canonical-icon': 'string',
222+ 'x-canonical-app-icon': 'string'});
223+ }
224+ }
225+ }
226+
227+ Component {
228+ id: groupedMessage
229+ ICMessaging.GroupedMessage {
230+ property QtObject menu: null
231+
232+ title: menu && menu.label ? menu.label : ""
233+ count: menu && menu.actionState[0] ? menu.actionState[0] : "0"
234+ appIcon: menu && (menu.ext.xCanonicalIcon.length > 0) ? "image://gicon/" + encodeURI(menu.ext.xCanonicalIcon) :
235+ "qrc:/indicators/artwork/messaging/default_app.svg"
236+
237+ Component.onCompleted: {
238+ model.loadExtendedAttributes(modelIndex, {'x-canonical-icon': 'string'});
239+ }
240+ onActivateApp: {
241+ model.activate(modelIndex, true);
242+ }
243+ onDismiss: {
195− onActivate: model.activate(modelIndex);
244+ model.activate(modelIndex, false);
245+ }
196 }
246 }
197 }
247 }
198
248
plugins/Unity/IndicatorsLegacy/CMakeLists.txt−1
@@ -8,7 +8,6 @@ find_package(Qt5Core REQUIRED)
8find_package(Qt5Quick REQUIRED)
8find_package(Qt5Quick REQUIRED)
9
9
10add_subdirectory(qml)
10add_subdirectory(qml)
11−add_subdirectory(Messaging)
12add_subdirectory(Network)
11add_subdirectory(Network)
13
12
14include_directories(
13include_directories(
plugins/Unity/IndicatorsLegacy/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.IndicatorsLegacy.Messaging Unity/IndicatorsLegacy/Messaging)
plugins/Unity/IndicatorsLegacy/Messaging/qml/MessageMenuItem.qmldeleted−96
@@ -1,96 +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.IndicatorsLegacy 0.1 as Indicators
24−
25−Indicators.BasicMenuItem {
26− property variant actionsDescription: menu ? menu.extra.canonical_message_actions : undefined
27−
28− onActionGroupChanged: loadItem()
29− onActionsDescriptionChanged: loadItem()
30− implicitHeight: contents.status == Loader.Ready ? contents.item.implicitHeight : 0
31−
32− Loader {
33− id: contents
34−
35− anchors.fill: parent
36− // Binding all properties for the item, to make sure that any change in the
37− // property will be propagated to the contents.item at any time
38− Binding {
39− target: contents.item
40− property: "menuActivated"
41− value: menuActivated
42− when: (contents.status == Loader.Ready)
43− }
44−
45− Binding {
46− target: contents.item
47− property: "actionGroup"
48− value: actionGroup
49− when: (contents.status == Loader.Ready)
50− }
51−
52− Binding {
53− target: contents.item
54− property: "menu"
55− value: menu
56− when: (contents.status == Loader.Ready)
57− }
58−
59− Binding {
60− target: contents.item
61− property: "actionsDescription"
62− value: actionsDescription
63− when: (contents.status == Loader.Ready)
64− }
65−
66− Connections {
67− target: contents.item ? contents.item : null
68− onActivateMenu: activateMenu()
69− onDeactivateMenu: deactivateMenu()
70− }
71− }
72−
73−
74− function loadItem()
75− {
76− var parameterType = ""
77− for (var actIndex in actionsDescription) {
78− var desc = actionsDescription[actIndex];
79− if (desc["parameter-type"] !== undefined) {
80− parameterType += desc["parameter-type"];
81− } else {
82− parameterType += "_";
83− }
84− }
85−
86− if (parameterType === "") {
87− contents.source = "SimpleTextMessage.qml";
88− } else if (parameterType === "s") {
89− contents.source = "TextMessage.qml";
90− } else if (parameterType === "_s") {
91− contents.source = "SnapDecision.qml";
92− } else {
93− console.debug("Unknown paramater type: " + parameterType);
94− }
95− }
96−}
plugins/Unity/IndicatorsLegacy/qml/MenuItemFactory.qml−8
@@ -19,7 +19,6 @@
19
19
20import QtQuick 2.0
20import QtQuick 2.0
21import Unity.IndicatorsLegacy 0.1 as Indicators
21import Unity.IndicatorsLegacy 0.1 as Indicators
22−import Unity.IndicatorsLegacy.Messaging 0.1 as ICMessaging
23import Unity.IndicatorsLegacy.Network 0.1 as ICNetwork
22import Unity.IndicatorsLegacy.Network 0.1 as ICNetwork
24
23
25Item {
24Item {
@@ -47,10 +46,6 @@ Item {
47 "com.canonical.indicator.slider" : sliderMenu,
46 "com.canonical.indicator.slider" : sliderMenu,
48 "com.canonical.indicator.switch" : switchMenu,
47 "com.canonical.indicator.switch" : switchMenu,
49
48
50− "com.canonical.indicator.messages.messageitem" : messageItem,
51− "com.canonical.indicator.messages.snapdecision" : snapDecision,
52− "com.canonical.indicator.messages.sourceitem" : groupedMessage,
53−
54 "unity.widget.systemsettings.tablet.sectiontitle" : wifiSection,
49 "unity.widget.systemsettings.tablet.sectiontitle" : wifiSection,
55 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
50 "unity.widgets.systemsettings.tablet.wifisection" : wifiSection,
56 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
51 "unity.widgets.systemsettings.tablet.accesspoint" : accessPoint,
@@ -62,9 +57,6 @@ Item {
62 Component { id: divMenu; Indicators.DivMenuItem {} }
57 Component { id: divMenu; Indicators.DivMenuItem {} }
63 Component { id: sectionMenu; Indicators.SectionMenuItem {} }
58 Component { id: sectionMenu; Indicators.SectionMenuItem {} }
64 Component { id: progressMenu; Indicators.ProgressMenuItem {} }
59 Component { id: progressMenu; Indicators.ProgressMenuItem {} }
65− Component { id: messageItem; ICMessaging.MessageMenuItem {} }
66− Component { id: snapDecision; ICMessaging.SnapDecision {} }
67− Component { id: groupedMessage; ICMessaging.GroupedMessage {} }
68 Component { id: wifiSection; ICNetwork.WifiSection {} }
60 Component { id: wifiSection; ICNetwork.WifiSection {} }
69 Component { id: accessPoint; ICNetwork.AccessPoint {} }
61 Component { id: accessPoint; ICNetwork.AccessPoint {} }
70 Component { id: indicatorMenu; Indicators.MenuItem {} }
62 Component { id: indicatorMenu; Indicators.MenuItem {} }
src/Panel/Indicators/CMakeLists.txt−1
@@ -1,2 +1 @@
1add_subdirectory(client)
1add_subdirectory(client)
2−add_subdirectory(servicefiles)
src/Panel/Indicators/servicefiles/CMakeLists.txtdeleted−14
@@ -1,14 +0,0 @@
1−file(GLOB INDICATOR_SERVICE_FILES
2− ${CMAKE_CURRENT_SOURCE_DIR}/com.canonical.indicator.messages
3−)
4−
5−# copy indicators files into build directory for shadow builds
6−add_custom_target(IndicatorsServiceFiles ALL
7− COMMAND mkdir -p ${CMAKE_BINARY_DIR}/share/unity/indicators
8− COMMAND cp ${INDICATOR_SERVICE_FILES} ${CMAKE_BINARY_DIR}/share/unity/indicators
9− DEPENDS ${INDICATOR_SERVICE_FILES}
10−)
11−
12−install(FILES ${INDICATOR_SERVICE_FILES}
13− DESTINATION ${SHELL_APP_DIR}/unity/indicators
14−)
src/Panel/Indicators/servicefiles/com.canonical.indicator.messagesdeleted−10
@@ -1,10 +0,0 @@
1−[Indicator Service]
2−Name=indicator-messages
3−ObjectPath=/com/canonical/indicator/messages
4−Position=50
5−
6−[phone]
7−ObjectPath=/com/canonical/indicator/messages/phone
8−
9−[desktop]
10−ObjectPath=/com/canonical/indicator/messages/menu