Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/notifications.cpp
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Line(s) | 263 | for (int i = 0; i < filterModel->rowCount(); ++i) { | |||
---|---|---|---|---|---|
264 | const QModelIndex idx = filterModel->index(i, 0); | 264 | const QModelIndex idx = filterModel->index(i, 0); | ||
265 | 265 | | |||
266 | if (idx.data(Notifications::ExpiredRole).toBool()) { | 266 | if (idx.data(Notifications::ExpiredRole).toBool()) { | ||
267 | ++expired; | 267 | ++expired; | ||
268 | } else { | 268 | } else { | ||
269 | ++active; | 269 | ++active; | ||
270 | } | 270 | } | ||
271 | 271 | | |||
272 | const bool read = idx.data(Notifications::ReadRole).toBool(); | ||||
273 | if (!active && !read) { | ||||
272 | QDateTime date = idx.data(Notifications::UpdatedRole).toDateTime(); | 274 | QDateTime date = idx.data(Notifications::UpdatedRole).toDateTime(); | ||
273 | if (!date.isValid()) { | 275 | if (!date.isValid()) { | ||
274 | date = idx.data(Notifications::CreatedRole).toDateTime(); | 276 | date = idx.data(Notifications::CreatedRole).toDateTime(); | ||
275 | } | 277 | } | ||
276 | 278 | | |||
277 | // TODO Jobs could also be unread? | 279 | if (notificationsModel && date > notificationsModel->lastRead()) { | ||
278 | if (notificationsModel) { | | |||
279 | if (!active && date > notificationsModel->lastRead()) { | | |||
280 | ++unread; | 280 | ++unread; | ||
281 | } | 281 | } | ||
282 | } | 282 | } | ||
283 | 283 | | |||
284 | if (idx.data(Notifications::TypeRole).toInt() == Notifications::JobType) { | 284 | if (idx.data(Notifications::TypeRole).toInt() == Notifications::JobType) { | ||
285 | if (idx.data(Notifications::JobStateRole).toInt() != Notifications::JobStateStopped) { | 285 | if (idx.data(Notifications::JobStateRole).toInt() != Notifications::JobStateStopped) { | ||
286 | ++jobs; | 286 | ++jobs; | ||
287 | 287 | | |||
▲ Show 20 Lines • Show All 563 Lines • Show Last 20 Lines |