[Notifications] When application responds to cancel request, stop kill timer

This ensures that an error message the app might have sent in response to the
cancel request is still shown.

Also, while at it deduplicate code by calling into `terminate` from the
service watcher.
wilder-5.22
Kai Uwe Broulik 5 years ago
parent 3dc2b734f0
commit b9593a06bc
  1. 4
      libnotificationmanager/job_p.cpp
  2. 13
      libnotificationmanager/jobsmodel_p.cpp

@ -265,6 +265,10 @@ void JobPrivate::finish()
return;
}
if (m_killTimer) {
m_killTimer->stop();
}
Job *job = static_cast<Job *>(parent());
// update timestamp
job->resetUpdated();

@ -482,15 +482,10 @@ void JobsModelPrivate::onServiceUnregistered(const QString &serviceName)
if (job->state() == Notifications::JobStateStopped) {
continue;
}
job->setError(KIO::ERR_OWNER_DIED);
job->setErrorText(i18n("Application closed unexpectedly."));
job->setState(Notifications::JobStateStopped);
// basically JobPrivate::finish()
// update timestamp
job->resetUpdated();
// when it was hidden in history, bring it up again
job->setDismissed(false);
job->d->terminate(KIO::ERR_OWNER_DIED,
i18n("Application closed unexpectedly."),
{} /*hints*/);
}
Q_ASSERT(!m_serviceWatcher->watchedServices().contains(serviceName));

Loading…
Cancel
Save