@@ -1,17 +1,20 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright 2015 Canonical Ltd.
33 *
44 * 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
66 * the Free Software Foundation; version 3.
77 *
88 * This program is distributed in the hope that it will be useful,
99 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1010 * 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.
1212 *
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
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ *
16+ * Authors:
17+ * Mirco Mueller <mirco.mueller@canonical.com>
1518 */
1619
1720import QtQuick 2.0
@@ -27,44 +30,19 @@ Item {
2730 width: notificationsRect.width + interactiveControls.width
2831 height: notificationsRect.height
2932
30− Row {
31− id: rootRow
32−
33+ property list<Notification> dataList: [
3334 Notification {
34− id: mockNotificationDefault
35+ nid: 0
3536 type: Notification.PlaceHolder
36− nid: 1
3737 summary: ""
3838 body: ""
3939 icon: ""
4040 secondaryIcon: ""
4141 rawActions: ["reply_id", "Dummy"]
42− }
43−
44− ListModel {
45− id: mockModel
46− dynamicRoles: true
47−
48− signal actionInvoked(string actionId)
49−
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)
54− }
55− }
56− }
57−
58− // add the default/PlaceHolder notification to the model
59− Component.onCompleted: {
60− append(mockNotificationDefault)
61− }
62− }
63−
42+ },
6443 Notification {
65− id: mock2over1SnapDecisionNotification
44+ nid: 1
6645 type: Notification.SnapDecision
67− nid: 2
6846 hints: {"x-canonical-private-affirmative-tint": "true"}
6947 summary: "Theatre at Ferria Stadium"
7048 body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
@@ -73,86 +51,48 @@ Item {
7351 rawActions: ["ok_id", "Ok",
7452 "snooze_id", "Snooze",
7553 "view_id", "View"]
76− }
77−
78− function add2over1SnapDecisionNotification() {
79− mockModel.append(mock2over1SnapDecisionNotification)
80−
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")
88− }
89−
54+ },
9055 Notification {
91− id: mockEphemeralNotification
56+ nid: 2
9257 type: Notification.Ephemeral
93− nid: 3
9458 summary: "Cole Raby"
9559 body: "I did not expect it to be that late."
9660 icon: "../graphics/avatars/amanda.png"
9761 secondaryIcon: "../graphics/applicationIcons/facebook.png"
9862 rawActions: ["reply_id", "Dummy"]
99− }
100−
101− function addEphemeralNotification() {
102− mockModel.append(mockEphemeralNotification)
103− }
104−
63+ },
10564 Notification {
106− id: mockEphemeralNonShapedIconNotification
65+ nid: 3
10766 type: Notification.Ephemeral
108− nid: 4
10967 hints: {"x-canonical-non-shaped-icon": "true"}
11068 summary: "Contacts"
11169 body: "Synchronised contacts-database with cloud-storage."
11270 icon: "../graphics/applicationIcons/contacts-app.png"
11371 secondaryIcon: ""
11472 rawActions: ["reply_id", "Dummy"]
115− }
116−
117− function addEphemeralNonShapedIconNotification() {
118− mockModel.append(mockEphemeralNonShapedIconNotification)
119− }
120−
73+ },
12174 Notification {
122− id: mockEphemeralIconSummaryNotification
75+ nid: 4
12376 type: Notification.Ephemeral
124− nid: 5
12577 hints: {"x-canonical-non-shaped-icon": "false"}
12678 summary: "Photo upload completed"
12779 body: ""
12880 icon: "../graphics/applicationIcons/facebook.png"
12981 secondaryIcon: ""
13082 rawActions: ["reply_id", "Dummy"]
131− }
132−
133− function addEphemeralIconSummaryNotification() {
134− mockModel.append(mockEphemeralIconSummaryNotification)
135− }
136−
83+ },
13784 Notification {
138− id: mockInteractiveNotification
85+ nid: 5
13986 type: Notification.Interactive
140− nid: 6
14187 summary: "Interactive notification"
14288 body: "This is a notification that can be clicked"
14389 icon: "../graphics/avatars/anna_olsson.png"
14490 secondaryIcon: ""
14591 rawActions: ["reply_id", "Dummy"]
146− }
147−
148− function addInteractiveNotification() {
149− mockModel.append(mockInteractiveNotification)
150− }
151−
92+ },
15293 Notification {
153− id: mockConfirmationNotification
94+ nid: 6
15495 type: Notification.Confirmation
155− nid: 7
15696 hints: {"x-canonical-non-shaped-icon": "true"}
15797 summary: "Confirmation notification"
15898 body: ""
@@ -160,16 +100,10 @@ Item {
160100 secondaryIcon: ""
161101 value: 50
162102 rawActions: ["reply_id", "Dummy"]
163− }
164−
165− function addConfirmationNotification() {
166− mockModel.append(mockConfirmationNotification)
167− }
168−
103+ },
169104 Notification {
170− id: mock2ndConfirmationNotification
105+ nid: 7
171106 type: Notification.Confirmation
172− nid: 8
173107 hints: {"x-canonical-non-shaped-icon": "true",
174108 "x-canonical-value-bar-tint": "true"}
175109 summary: "Confirmation notification"
@@ -179,9 +113,69 @@ Item {
179113 value: 85
180114 rawActions: ["reply_id", "Dummy"]
181115 }
116+ ]
117+
118+ Row {
119+ id: rootRow
120+
121+ ListModel {
122+ id: mockModel
123+ dynamicRoles: true
124+
125+ signal actionInvoked(string actionId)
126+
127+ function getRaw(id) {
128+ return dataList[id]
129+ }
130+
131+ // add the default/PlaceHolder notification to the model
132+ Component.onCompleted: {
133+ append(dataList[0])
134+ }
135+ }
136+
137+ function add2over1SnapDecisionNotification() {
138+ var n = {
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."}]
150+ }
151+
152+ mockModel.append(n)
153+
154+ //mockModel.append(dataList[1])
155+ }
156+
157+ function addEphemeralNotification() {
158+ mockModel.append(dataList[2])
159+ }
160+
161+ function addEphemeralNonShapedIconNotification() {
162+ mockModel.append(dataList[3])
163+ }
164+
165+ function addEphemeralIconSummaryNotification() {
166+ mockModel.append(dataList[4])
167+ }
168+
169+ function addInteractiveNotification() {
170+ mockModel.append(dataList[5])
171+ }
172+
173+ function addConfirmationNotification() {
174+ mockModel.append(dataList[6])
175+ }
182176
183177 function add2ndConfirmationNotification() {
184− mockModel.append(mock2ndConfirmationNotification)
178+ mockModel.append(dataList[7])
185179 }
186180
187181 function clearNotifications() {