diff --git a/libnotificationmanager/job.cpp b/libnotificationmanager/job.cpp index 88018d7fe..194538913 100644 --- a/libnotificationmanager/job.cpp +++ b/libnotificationmanager/job.cpp @@ -159,6 +159,16 @@ void Job::setKillable(bool killable) d->m_killable = killable; } +bool Job::transient() const +{ + return d->m_transient; +} + +void Job::setTransient(bool transient) +{ + d->m_transient = transient; +} + QUrl Job::destUrl() const { return d->m_destUrl; diff --git a/libnotificationmanager/job.h b/libnotificationmanager/job.h index 8e44c5e84..7e5437c17 100644 --- a/libnotificationmanager/job.h +++ b/libnotificationmanager/job.h @@ -167,6 +167,9 @@ public: // TODO remove and let only constructor do it? void setKillable(bool killable); + bool transient() const; + void setTransient(bool transient); + QUrl destUrl() const; qulonglong speed() const; diff --git a/libnotificationmanager/job_p.cpp b/libnotificationmanager/job_p.cpp index 9dbb86c0f..fd4b3bbe4 100644 --- a/libnotificationmanager/job_p.cpp +++ b/libnotificationmanager/job_p.cpp @@ -264,8 +264,8 @@ void JobPrivate::finish() // Unregister the dbus service since the client is done with it QDBusConnection::sessionBus().unregisterObject(m_objectPath.path()); - // When user canceled transfer, remove it without notice - if (m_error == KIO::ERR_USER_CANCELED) { + // When user canceled job or a transient job finished successfully, remove it without notice + if (m_error == KIO::ERR_USER_CANCELED || (!m_error && m_transient)) { emit closed(); return; } diff --git a/libnotificationmanager/job_p.h b/libnotificationmanager/job_p.h index d549d1b91..f8e8c685e 100644 --- a/libnotificationmanager/job_p.h +++ b/libnotificationmanager/job_p.h @@ -141,6 +141,7 @@ private: QString m_errorText; bool m_suspendable = false; bool m_killable = false; + bool m_transient = false; QUrl m_destUrl; diff --git a/libnotificationmanager/jobsmodel_p.cpp b/libnotificationmanager/jobsmodel_p.cpp index e27db3d70..34688bafd 100644 --- a/libnotificationmanager/jobsmodel_p.cpp +++ b/libnotificationmanager/jobsmodel_p.cpp @@ -312,6 +312,10 @@ QDBusObjectPath JobsModelPrivate::requestView(const QString &desktopEntry, int c job->d->delayedShow(500ms, JobPrivate::ShowCondition::OnTimeout); } + if (hints.value(QStringLiteral("transient")).toBool()) { + job->setTransient(true); + } + m_jobServices.insert(job, serviceName); m_serviceWatcher->addWatchedService(serviceName);