[Notifications] Apply initial properties passed from `hints` map

This allows the job to show up atomically. Otherwise the popup will briefly
show up empty until the first `update` call arrives.
wilder-5.22
Kai Uwe Broulik 5 years ago
parent 94b71c8056
commit 1cc60d23db
  1. 5
      libnotificationmanager/jobsmodel_p.cpp

@ -270,7 +270,7 @@ QDBusObjectPath JobsModelPrivate::requestView(const QString &appName, const QStr
QDBusObjectPath JobsModelPrivate::requestView(const QString &desktopEntry, int capabilities, const QVariantMap &hints) QDBusObjectPath JobsModelPrivate::requestView(const QString &desktopEntry, int capabilities, const QVariantMap &hints)
{ {
qCDebug(NOTIFICATIONMANAGER) << "JobView requested by" << desktopEntry << "with hints" << hints; qCDebug(NOTIFICATIONMANAGER) << "JobView requested by" << desktopEntry;
if (!m_highestJobId) { if (!m_highestJobId) {
++m_highestJobId; ++m_highestJobId;
@ -317,6 +317,9 @@ QDBusObjectPath JobsModelPrivate::requestView(const QString &desktopEntry, int c
job->setSuspendable(capabilities & KJob::Suspendable); job->setSuspendable(capabilities & KJob::Suspendable);
job->setKillable(capabilities & KJob::Killable); job->setKillable(capabilities & KJob::Killable);
// Apply initial properties
job->d->update(hints);
connect(job, &Job::updatedChanged, this, [this, job] { connect(job, &Job::updatedChanged, this, [this, job] {
scheduleUpdate(job, Notifications::UpdatedRole); scheduleUpdate(job, Notifications::UpdatedRole);
}); });

Loading…
Cancel
Save