@@ -1,17 +1,20 @@
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright 2015 Canonical Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5− * it under the terms of the GNU General Public License as published by
5+ * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11− * GNU General Public License for more details.
11+ * GNU Lesser General Public License for more details.
13− * You should have received a copy of the GNU General Public License
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/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ * Mirco Mueller <mirco.mueller@canonical.com>
17import QtQuick 2.0
20import QtQuick 2.0
@@ -27,44 +30,19 @@ Item {
27 width: notificationsRect.width + interactiveControls.width
30 width: notificationsRect.width + interactiveControls.width
28 height: notificationsRect.height
31 height: notificationsRect.height
30− Row {
33+ property list<Notification> dataList: [
33 Notification {
34 Notification {
34− id: mockNotificationDefault
35+ nid: 0
35 type: Notification.PlaceHolder
36 type: Notification.PlaceHolder
37 summary: ""
37 summary: ""
40 secondaryIcon: ""
40 secondaryIcon: ""
41 rawActions: ["reply_id", "Dummy"]
41 rawActions: ["reply_id", "Dummy"]
48− signal actionInvoked(string actionId)
50− function getRaw(id) {
51− for (var i = 0; i < mockModel.count; i++) {
52− if (id === mockModel.get(i).nid) {
53− return mockModel.get(i)
58− // add the default/PlaceHolder notification to the model
59− Component.onCompleted: {
60− append(mockNotificationDefault)
64 Notification {
43 Notification {
65− id: mock2over1SnapDecisionNotification
44+ nid: 1
66 type: Notification.SnapDecision
45 type: Notification.SnapDecision
68 hints: {"x-canonical-private-affirmative-tint": "true"}
46 hints: {"x-canonical-private-affirmative-tint": "true"}
69 summary: "Theatre at Ferria Stadium"
47 summary: "Theatre at Ferria Stadium"
70 body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
48 body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
@@ -73,86 +51,48 @@ Item {
73 rawActions: ["ok_id", "Ok",
51 rawActions: ["ok_id", "Ok",
74 "snooze_id", "Snooze",
52 "snooze_id", "Snooze",
75 "view_id", "View"]
53 "view_id", "View"]
78− function add2over1SnapDecisionNotification() {
79− mockModel.append(mock2over1SnapDecisionNotification)
81− // trying out/debugging stuff
82− mockModel.getRaw(2).close()
83− print("summary:", mock2over1SnapDecisionNotification.summary)
84− print("summary:", mockModel.getRaw(2).summary)
85− print("summary:", mockModel.get(1).summary)
86− mock2over1SnapDecisionNotification.close()
87− mock2over1SnapDecisionNotification.invokeAction("ok_id")
90 Notification {
55 Notification {
91− id: mockEphemeralNotification
56+ nid: 2
92 type: Notification.Ephemeral
57 type: Notification.Ephemeral
94 summary: "Cole Raby"
58 summary: "Cole Raby"
95 body: "I did not expect it to be that late."
59 body: "I did not expect it to be that late."
96 icon: "../graphics/avatars/amanda.png"
60 icon: "../graphics/avatars/amanda.png"
97 secondaryIcon: "../graphics/applicationIcons/facebook.png"
61 secondaryIcon: "../graphics/applicationIcons/facebook.png"
98 rawActions: ["reply_id", "Dummy"]
62 rawActions: ["reply_id", "Dummy"]
101− function addEphemeralNotification() {
102− mockModel.append(mockEphemeralNotification)
105 Notification {
64 Notification {
106− id: mockEphemeralNonShapedIconNotification
65+ nid: 3
107 type: Notification.Ephemeral
66 type: Notification.Ephemeral
109 hints: {"x-canonical-non-shaped-icon": "true"}
67 hints: {"x-canonical-non-shaped-icon": "true"}
110 summary: "Contacts"
68 summary: "Contacts"
111 body: "Synchronised contacts-database with cloud-storage."
69 body: "Synchronised contacts-database with cloud-storage."
112 icon: "../graphics/applicationIcons/contacts-app.png"
70 icon: "../graphics/applicationIcons/contacts-app.png"
113 secondaryIcon: ""
71 secondaryIcon: ""
114 rawActions: ["reply_id", "Dummy"]
72 rawActions: ["reply_id", "Dummy"]
117− function addEphemeralNonShapedIconNotification() {
118− mockModel.append(mockEphemeralNonShapedIconNotification)
121 Notification {
74 Notification {
122− id: mockEphemeralIconSummaryNotification
75+ nid: 4
123 type: Notification.Ephemeral
76 type: Notification.Ephemeral
125 hints: {"x-canonical-non-shaped-icon": "false"}
77 hints: {"x-canonical-non-shaped-icon": "false"}
126 summary: "Photo upload completed"
78 summary: "Photo upload completed"
128 icon: "../graphics/applicationIcons/facebook.png"
80 icon: "../graphics/applicationIcons/facebook.png"
129 secondaryIcon: ""
81 secondaryIcon: ""
130 rawActions: ["reply_id", "Dummy"]
82 rawActions: ["reply_id", "Dummy"]
133− function addEphemeralIconSummaryNotification() {
134− mockModel.append(mockEphemeralIconSummaryNotification)
137 Notification {
84 Notification {
138− id: mockInteractiveNotification
85+ nid: 5
139 type: Notification.Interactive
86 type: Notification.Interactive
141 summary: "Interactive notification"
87 summary: "Interactive notification"
142 body: "This is a notification that can be clicked"
88 body: "This is a notification that can be clicked"
143 icon: "../graphics/avatars/anna_olsson.png"
89 icon: "../graphics/avatars/anna_olsson.png"
144 secondaryIcon: ""
90 secondaryIcon: ""
145 rawActions: ["reply_id", "Dummy"]
91 rawActions: ["reply_id", "Dummy"]
148− function addInteractiveNotification() {
149− mockModel.append(mockInteractiveNotification)
152 Notification {
93 Notification {
153− id: mockConfirmationNotification
94+ nid: 6
154 type: Notification.Confirmation
95 type: Notification.Confirmation
156 hints: {"x-canonical-non-shaped-icon": "true"}
96 hints: {"x-canonical-non-shaped-icon": "true"}
157 summary: "Confirmation notification"
97 summary: "Confirmation notification"
@@ -160,16 +100,10 @@ Item {
160 secondaryIcon: ""
100 secondaryIcon: ""
161 value: 50
101 value: 50
162 rawActions: ["reply_id", "Dummy"]
102 rawActions: ["reply_id", "Dummy"]
165− function addConfirmationNotification() {
166− mockModel.append(mockConfirmationNotification)
169 Notification {
104 Notification {
170− id: mock2ndConfirmationNotification
105+ nid: 7
171 type: Notification.Confirmation
106 type: Notification.Confirmation
173 hints: {"x-canonical-non-shaped-icon": "true",
107 hints: {"x-canonical-non-shaped-icon": "true",
174 "x-canonical-value-bar-tint": "true"}
108 "x-canonical-value-bar-tint": "true"}
175 summary: "Confirmation notification"
109 summary: "Confirmation notification"
@@ -179,9 +113,69 @@ Item {
179 value: 85
113 value: 85
180 rawActions: ["reply_id", "Dummy"]
114 rawActions: ["reply_id", "Dummy"]
125+ signal actionInvoked(string actionId)
127+ function getRaw(id) {
131+ // add the default/PlaceHolder notification to the model
132+ Component.onCompleted: {
137+ function add2over1SnapDecisionNotification() {
139+ type: Notification.SnapDecision,
140+ hints: {"x-canonical-private-affirmative-tint": "true"},
141+ summary: "Incoming call",
142+ body: "Frank Zappa\n+44 (0)7736 027340",
143+ icon: "../graphics/avatars/funky.png",
144+ secondaryIcon: "image://theme/incoming-call",
145+ actions: [{ id: "ok_id", label: "Ok"},
146+ { id: "cancel_id", label: "Cancel"},
147+ { id: "dummy_id", label: "Quick reply"},
148+ { id: "late_id", label: "messages:I'm running late. I'm on my way."},
149+ { id: "later_id", label: "messages:I'm busy at the moment. I'll call later."}]
154+ //mockModel.append(dataList[1])
157+ function addEphemeralNotification() {
158+ mockModel.append(dataList[2])
161+ function addEphemeralNonShapedIconNotification() {
162+ mockModel.append(dataList[3])
165+ function addEphemeralIconSummaryNotification() {
166+ mockModel.append(dataList[4])
169+ function addInteractiveNotification() {
170+ mockModel.append(dataList[5])
173+ function addConfirmationNotification() {
174+ mockModel.append(dataList[6])
183 function add2ndConfirmationNotification() {
177 function add2ndConfirmationNotification() {
184− mockModel.append(mock2ndConfirmationNotification)
178+ mockModel.append(dataList[7])
187 function clearNotifications() {
181 function clearNotifications() {