Commit eb862c9a authored by Volker Krause's avatar Volker Krause
Browse files

Update active alarms if we get an earlier one for the same event

This happens for example when editing an event that is currently suspended,
and that would now trigger an alarm before the suspension expires. Now the
earlier alarm always takes precedence.
parent a3385b70
Pipeline #111852 passed with stage
in 4 minutes and 56 seconds
......@@ -142,11 +142,21 @@ void KalendarAlarmClient::removeNotification(AlarmNotification *notification)
void KalendarAlarmClient::addNotification(const QString &uid, const QString &text, const QDateTime &remindTime)
if (m_notifications.contains(uid)) {
AlarmNotification *notification = nullptr;
const auto it = m_notifications.constFind(uid);
if (it != m_notifications.constEnd()) {
notification = it.value();
} else {
notification = new AlarmNotification(uid);
if (notification->remindAt().isValid() && notification->remindAt() < remindTime) {
// we have a notification for this event already, and it's scheduled earlier than the new one
// we either have no notification for this event yet, or one that is scheduled for later and that should be replaced
qDebug() << "Adding notification, uid:" << uid << "text:" << text << "remindTime:" << remindTime;
AlarmNotification *notification = new AlarmNotification(uid);
m_notifications[notification->uid()] = notification;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment