Changeset View
Changeset View
Standalone View
Standalone View
src/notifybyportal.cpp
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Line(s) | 171 | { | |||
---|---|---|---|---|---|
173 | Q_UNUSED(notification); | 173 | Q_UNUSED(notification); | ||
174 | Q_UNUSED(notifyConfig); | 174 | Q_UNUSED(notifyConfig); | ||
175 | } | 175 | } | ||
176 | 176 | | |||
177 | void NotifyByPortal::onServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) | 177 | void NotifyByPortal::onServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner) | ||
178 | { | 178 | { | ||
179 | Q_UNUSED(serviceName); | 179 | Q_UNUSED(serviceName); | ||
180 | // close all notifications we currently hold reference to | 180 | // close all notifications we currently hold reference to | ||
181 | Q_FOREACH (KNotification *n, d->portalNotifications) { | 181 | for (KNotification *n : qAsConst(d->portalNotifications)) { | ||
182 | if (n) { | 182 | if (n) { | ||
183 | emit finished(n); | 183 | emit finished(n); | ||
184 | } | 184 | } | ||
185 | } | 185 | } | ||
186 | 186 | | |||
187 | d->portalNotifications.clear(); | 187 | d->portalNotifications.clear(); | ||
188 | 188 | | |||
189 | if (newOwner.isEmpty()) { | 189 | if (newOwner.isEmpty()) { | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 239 | { | |||
263 | // (act_id1, action1, act_id2, action2, ...) | 263 | // (act_id1, action1, act_id2, action2, ...) | ||
264 | // | 264 | // | ||
265 | // assign id's to actions like it's done in fillPopup() method | 265 | // assign id's to actions like it's done in fillPopup() method | ||
266 | // (i.e. starting from 1) | 266 | // (i.e. starting from 1) | ||
267 | QList<QVariantMap> buttons; | 267 | QList<QVariantMap> buttons; | ||
268 | buttons.reserve(notification->actions().count()); | 268 | buttons.reserve(notification->actions().count()); | ||
269 | 269 | | |||
270 | int actId = 0; | 270 | int actId = 0; | ||
271 | Q_FOREACH (const QString &actionName, notification->actions()) { | 271 | const auto listActions = notification->actions(); | ||
272 | for (const QString &actionName : listActions) { | ||||
272 | actId++; | 273 | actId++; | ||
273 | QVariantMap button = { | 274 | QVariantMap button = { | ||
274 | {QStringLiteral("action"), QString::number(actId)}, | 275 | {QStringLiteral("action"), QString::number(actId)}, | ||
275 | {QStringLiteral("label"), actionName} | 276 | {QStringLiteral("label"), actionName} | ||
276 | }; | 277 | }; | ||
277 | buttons << button; | 278 | buttons << button; | ||
278 | } | 279 | } | ||
279 | 280 | | |||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |