@@ -31,123 +31,7 @@ Item {
3131
3232 width: notificationsRect.width + interactiveControls.width
3333 height: notificationsRect.height
34−
35− property list<Notification> mockList: [
36− Notification {
37− id: n0
38− nid: 0
39− type: Notification.PlaceHolder
40− summary: ""
41− body: ""
42− icon: ""
43− secondaryIcon: ""
44− rawActions: ["reply_id", "Dummy"]
45− Component.onCompleted: {
46− n0.completed.connect(mockModel.onCompleted)
47− }
48− },
49− Notification {
50− id: n1
51− nid: 1
52− type: Notification.SnapDecision
53− hints: {"x-canonical-private-affirmative-tint": "true"}
54− summary: "Theatre at Ferria Stadium"
55− body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
56− icon: ""
57− secondaryIcon: ""
58− rawActions: ["ok_id", "Ok",
59− "snooze_id", "Snooze",
60− "view_id", "View"]
61− Component.onCompleted: {
62− n1.completed.connect(mockModel.onCompleted)
63− }
64− },
65− Notification {
66− id: n2
67− nid: 2
68− type: Notification.Ephemeral
69− summary: "Cole Raby"
70− body: "I did not expect it to be that late."
71− icon: "../graphics/avatars/amanda.png"
72− secondaryIcon: "../graphics/applicationIcons/facebook.png"
73− rawActions: ["reply_id", "Dummy"]
74− Component.onCompleted: {
75− n2.completed.connect(mockModel.onCompleted)
76− }
77− },
78− Notification {
79− id: n3
80− nid: 3
81− type: Notification.Ephemeral
82− hints: {"x-canonical-non-shaped-icon": "true"}
83− summary: "Contacts"
84− body: "Synchronised contacts-database with cloud-storage."
85− icon: "../graphics/applicationIcons/contacts-app.png"
86− secondaryIcon: ""
87− rawActions: ["reply_id", "Dummy"]
88− Component.onCompleted: {
89− n3.completed.connect(mockModel.onCompleted)
90− }
91− },
92− Notification {
93− id: n4
94− nid: 4
95− type: Notification.Ephemeral
96− hints: {"x-canonical-non-shaped-icon": "false"}
97− summary: "Photo upload completed"
98− body: ""
99− icon: "../graphics/applicationIcons/facebook.png"
100− secondaryIcon: ""
101− rawActions: ["reply_id", "Dummy"]
102− Component.onCompleted: {
103− n4.completed.connect(mockModel.onCompleted)
104− }
105− },
106− Notification {
107− id: n5
108− nid: 5
109− type: Notification.Interactive
110− summary: "Interactive notification"
111− body: "This is a notification that can be clicked"
112− icon: "../graphics/avatars/anna_olsson.png"
113− secondaryIcon: ""
114− rawActions: ["reply_id", "Dummy"]
115− Component.onCompleted: {
116− n5.completed.connect(mockModel.onCompleted)
117− }
118− },
119− Notification {
120− id: n6
121− nid: 6
122− type: Notification.Confirmation
123− hints: {"x-canonical-non-shaped-icon": "true"}
124− summary: "Confirmation notification"
125− body: ""
126− icon: "image://theme/audio-volume-medium"
127− secondaryIcon: ""
128− value: 50
129− rawActions: ["reply_id", "Dummy"]
130− Component.onCompleted: {
131− n6.completed.connect(mockModel.onCompleted)
132− }
133− },
134− Notification {
135− id: n7
136− nid: 7
137− type: Notification.Confirmation
138− hints: {"x-canonical-non-shaped-icon": "true",
139− "x-canonical-value-bar-tint": "true"}
140− summary: "Confirmation notification"
141− body: "High Volume"
142− icon: "image://theme/audio-volume-high"
143− secondaryIcon: ""
144− value: 85
145− rawActions: ["reply_id", "Dummy"]
146− Component.onCompleted: {
147− n7.completed.connect(mockModel.onCompleted)
148− }
149− }
150− ]
34+ property int index: 0
15135
15236 Row {
15337 id: rootRow
@@ -159,47 +43,132 @@ Item {
15943
16044 // add the default/PlaceHolder notification to the model
16145 Component.onCompleted: {
162− append(mockList[0])
46+ var component = Qt.createComponent("Notification.qml")
47+ var n = component.createObject("notification", {"nid": index++,
48+ "type": Notification.PlaceHolder,
49+ "hints": {},
50+ "summary": "",
51+ "body": "",
52+ "icon": "",
53+ "secondaryIcon": "",
54+ "rawActions": []})
55+ n.completed.connect(mockModel.onCompleted)
56+ append(n)
16357 }
16458 }
16559
16660 function add2over1SnapDecisionNotification() {
167− mockModel.append(mockList[1])
61+ var component = Qt.createComponent("Notification.qml")
62+ var n = component.createObject("notification", {"nid": index++,
63+ "type": Notification.SnapDecision,
64+ "hints": {"x-canonical-private-affirmative-tint": "true"},
65+ "summary": "Theatre at Ferria Stadium",
66+ "body": "at Ferria Stadium in Bilbao, Spain\n07578545317",
67+ "icon": "",
68+ "secondaryIcon": "",
69+ "rawActions": ["ok_id", "Ok",
70+ "snooze_id", "Snooze",
71+ "view_id", "View"]})
72+ n.completed.connect(mockModel.onCompleted)
73+ mockModel.append(n)
16874 }
16975
17076 function addEphemeralNotification() {
171− mockModel.append(mockList[2])
77+ var component = Qt.createComponent("Notification.qml")
78+ var n = component.createObject("notification", {"nid": index++,
79+ "type": Notification.Ephemeral,
80+ "hints": {},
81+ "summary": "Cole Raby",
82+ "body": "I did not expect it to be that late.",
83+ "icon": "../graphics/avatars/amanda.png",
84+ "secondaryIcon": "../graphics/applicationIcons/facebook.png",
85+ "rawActions": ["reply_id", "Dummy"]})
86+ n.completed.connect(mockModel.onCompleted)
87+ mockModel.append(n)
17288 }
17389
17490 function addEphemeralNonShapedIconNotification() {
175− mockModel.append(mockList[3])
91+ var component = Qt.createComponent("Notification.qml")
92+ var n = component.createObject("notification", {"nid": index++,
93+ "type": Notification.Ephemeral,
94+ "hints": {"x-canonical-non-shaped-icon": "true"},
95+ "summary": "Contacts",
96+ "body": "Synchronised contacts-database with cloud-storage.",
97+ "icon": "../graphics/applicationIcons/contacts-app.png",
98+ "secondaryIcon": "",
99+ "rawActions": ["reply_id", "Dummy"]})
100+ n.completed.connect(mockModel.onCompleted)
101+ mockModel.append(n)
176102 }
177103
178104 function addEphemeralIconSummaryNotification() {
179− mockModel.append(mockList[4])
105+ var component = Qt.createComponent("Notification.qml")
106+ var n = component.createObject("notification", {"nid": index++,
107+ "type": Notification.Ephemeral,
108+ "hints": {"x-canonical-non-shaped-icon": "false"},
109+ "summary": "Photo upload completed",
110+ "body": "",
111+ "icon": "../graphics/applicationIcons/facebook.png",
112+ "secondaryIcon": "",
113+ "rawActions": ["reply_id", "Dummy"]})
114+ n.completed.connect(mockModel.onCompleted)
115+ mockModel.append(n)
180116 }
181117
182118 function addInteractiveNotification() {
183− mockModel.append(mockList[5])
119+ var component = Qt.createComponent("Notification.qml")
120+ var n = component.createObject("notification", {"nid": index++,
121+ "type": Notification.Interactive,
122+ "hints": {},
123+ "summary": "Interactive notification",
124+ "body": "This is a notification that can be clicked",
125+ "icon": "../graphics/avatars/anna_olsson.png",
126+ "secondaryIcon": "",
127+ "rawActions": ["reply_id", "Dummy"]})
128+ n.completed.connect(mockModel.onCompleted)
129+ mockModel.append(n)
184130 }
185131
186132 function addConfirmationNotification() {
187− mockModel.append(mockList[6])
133+ var component = Qt.createComponent("Notification.qml")
134+ var n = component.createObject("notification", {"nid": index++,
135+ "type": Notification.Confirmation,
136+ "hints": {"x-canonical-non-shaped-icon": "true"},
137+ "summary": "Confirmation notification",
138+ "body": "",
139+ "icon": "image://theme/audio-volume-medium",
140+ "secondaryIcon": "",
141+ "value": 50,
142+ "rawActions": ["reply_id", "Dummy"]})
143+ n.completed.connect(mockModel.onCompleted)
144+ mockModel.append(n)
188145 }
189146
190147 function add2ndConfirmationNotification() {
191− mockModel.append(mockList[7])
148+ var component = Qt.createComponent("Notification.qml")
149+ var n = component.createObject("notification", {"nid": index++,
150+ "type": Notification.Confirmation,
151+ "hints": {"x-canonical-non-shaped-icon": "true",
152+ "x-canonical-value-bar-tint": "true"},
153+ "summary": "Confirmation notification",
154+ "body": "High Volume",
155+ "icon": "image://theme/audio-volume-high",
156+ "secondaryIcon": "",
157+ "value": 85,
158+ "rawActions": ["reply_id", "Dummy"]})
159+ n.completed.connect(mockModel.onCompleted)
160+ mockModel.append(n)
192161 }
193162
194163 function clearNotifications() {
195164 while(mockModel.count > 1) {
196− //remove1stNotification()
165+ remove1stNotification()
197166 }
198167 }
199168
200169 function remove1stNotification() {
201170 if (mockModel.count > 1) {
202− //mockModel.remove(1)
171+ mockModel.removeSecond()
203172 }
204173 }
205174