Changeset View
Changeset View
Standalone View
Standalone View
libnotificationmanager/notificationsortproxymodel.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Line(s) | 83 | { | |||
---|---|---|---|---|---|
94 | if (m_sortMode == Notifications::SortByTypeAndUrgency) { | 94 | if (m_sortMode == Notifications::SortByTypeAndUrgency) { | ||
95 | scoreLeft = sortScore(source_left); | 95 | scoreLeft = sortScore(source_left); | ||
96 | Q_ASSERT(scoreLeft >= 0); | 96 | Q_ASSERT(scoreLeft >= 0); | ||
97 | scoreRight = sortScore(source_right); | 97 | scoreRight = sortScore(source_right); | ||
98 | Q_ASSERT(scoreRight >= 0); | 98 | Q_ASSERT(scoreRight >= 0); | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | if (scoreLeft == scoreRight) { | 101 | if (scoreLeft == scoreRight) { | ||
102 | QDateTime timeLeft = source_left.data(Notifications::UpdatedRole).toDateTime(); | 102 | const QDateTime timeLeft = source_left.data(Notifications::CreatedRole).toDateTime(); | ||
103 | if (!timeLeft.isValid()) { | 103 | const QDateTime timeRight = source_right.data(Notifications::CreatedRole).toDateTime(); | ||
104 | timeLeft = source_left.data(Notifications::CreatedRole).toDateTime(); | | |||
105 | } | | |||
106 | | ||||
107 | QDateTime timeRight = source_right.data(Notifications::UpdatedRole).toDateTime(); | | |||
108 | if (!timeRight.isValid()) { | | |||
109 | timeRight = source_right.data(Notifications::CreatedRole).toDateTime(); | | |||
110 | } | | |||
111 | 104 | | |||
112 | // sorts descending by time (newest first) | 105 | // sorts descending by time (newest first) | ||
113 | return timeLeft > timeRight; | 106 | return timeLeft > timeRight; | ||
114 | } | 107 | } | ||
115 | 108 | | |||
116 | return scoreLeft > scoreRight; | 109 | return scoreLeft > scoreRight; | ||
117 | } | 110 | } |