Changeset View
Changeset View
Standalone View
Standalone View
applets/notifications/package/contents/ui/Notifications.qml
Show First 20 Lines • Show All 170 Lines • ▼ Show 20 Line(s) | 169 | if (notificationsModel.get(i).source == source) { | |||
---|---|---|---|---|---|
171 | break | 171 | break | ||
172 | } | 172 | } | ||
173 | } | 173 | } | ||
174 | } | 174 | } | ||
175 | 175 | | |||
176 | onNewData: { | 176 | onNewData: { | ||
177 | var _data = data; // Temp copy to avoid lots of context switching | 177 | var _data = data; // Temp copy to avoid lots of context switching | ||
178 | var actions = [] | 178 | var actions = [] | ||
179 | _data["hasDefaultAction"] = false | ||||
179 | if (data["actions"] && data["actions"].length % 2 == 0) { | 180 | if (data["actions"] && data["actions"].length % 2 == 0) { | ||
180 | for (var i = 0; i < data["actions"].length; i += 2) { | 181 | for (var i = 0; i < data["actions"].length; i += 2) { | ||
182 | if (data["actions"][i] == "default") { // The default action is not shown, but we want to know it's there | ||||
183 | _data["hasDefaultAction"] = true | ||||
184 | } else { | ||||
181 | actions.push({ | 185 | actions.push({ | ||
182 | id: data["actions"][i], | 186 | id: data["actions"][i], | ||
183 | text: data["actions"][i+1] | 187 | text: data["actions"][i+1] | ||
184 | }) | 188 | }) | ||
185 | } | 189 | } | ||
186 | } | 190 | } | ||
191 | } | ||||
187 | _data["source"] = sourceName | 192 | _data["source"] = sourceName | ||
188 | _data["actions"] = actions | 193 | _data["actions"] = actions | ||
189 | notificationsRoot.addNotification(_data) | 194 | notificationsRoot.addNotification(_data) | ||
190 | } | 195 | } | ||
191 | 196 | | |||
192 | } | 197 | } | ||
193 | 198 | | |||
194 | Connections { | 199 | Connections { | ||
Show All 23 Lines |