Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions panels/notification/common/expiretimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void ExpireTimer::push(const NotifyEntity &entity)
m_pendingEntities.erase(iter);
if (m_blockId == oldId)
m_blockId = id;
onTimeout();
reschedule();
break;
}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ void ExpireTimer::remove(qint64 id)
if (iter.value().id() != id)
continue;
m_pendingEntities.erase(iter);
onTimeout();
reschedule();
return;
}
}
Expand All @@ -124,7 +124,7 @@ void ExpireTimer::setBlockId(qint64 id)
}

m_blockId = id;
onTimeout();
reschedule();
}

void ExpireTimer::onTimeout()
Expand Down Expand Up @@ -159,7 +159,11 @@ void ExpireTimer::onTimeout()
Q_EMIT expired(item.id(), item.bubbleId());
}

// Reschedule for the nearest remaining deadline.
reschedule();
}

void ExpireTimer::reschedule()
{
if (m_pendingEntities.isEmpty()) {
m_timer->stop();
m_lastPoint = std::numeric_limits<qint64>::max();
Expand Down
1 change: 1 addition & 0 deletions panels/notification/common/expiretimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class ExpireTimer : public QObject
explicit ExpireTimer(QObject *parent = nullptr);

void onTimeout();
void reschedule();

QTimer *m_timer = nullptr;
// Pending entities keyed by absolute expire deadline (ms since the epoch);
Expand Down
Loading