Projects
Eulaceura:Factory
plasma-pk-updates
_service:obs_scm:0010-Use-own-eventIds-and-Comp...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0010-Use-own-eventIds-and-ComponentName-instead-of-generi.patch of Package plasma-pk-updates
From 7268a2da05f8f80de9b03752555d066d6dc01254 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Sat, 22 Jun 2019 00:51:36 +0200 Subject: [PATCH 10/51] Use own eventIds and ComponentName instead of generic plasma workspace ones Summary: Currently, the notifications from the update applet use the standard events from plasma workspace, which poses a number of problems: - the notifications can not be configured - the notifications are shown as originating from plasma workspace - grouping does not work properly (update notifications are mixed with others from PWS) - the notifications are filled with non-informative elements Depends on D21973 Reviewers: jgrulich, lukas, ngraham, fvogt Reviewed By: ngraham Differential Revision: https://phabricator.kde.org/D22026 --- src/declarative/CMakeLists.txt | 1 + src/declarative/pkupdates.cpp | 28 ++++++++++++++++------ src/declarative/plasma_pk_updates.notifyrc | 23 ++++++++++++++++++ 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 src/declarative/plasma_pk_updates.notifyrc diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt index 558c293..bdeb5b1 100644 --- a/src/declarative/CMakeLists.txt +++ b/src/declarative/CMakeLists.txt @@ -22,6 +22,7 @@ target_link_libraries(plasmapk_qmlplugins install(TARGETS plasmapk_qmlplugins DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/PackageKit) install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/PackageKit) +install(FILES plasma_pk_updates.notifyrc DESTINATION ${KNOTIFYRC_INSTALL_DIR} ) # test binary set(plasmapk_console_SRCS diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp index 0832551..4de20dd 100644 --- a/src/declarative/pkupdates.cpp +++ b/src/declarative/pkupdates.cpp @@ -39,6 +39,11 @@ Q_LOGGING_CATEGORY(PLASMA_PK_UPDATES, "plasma-pk-updates") namespace { const auto s_pkUpdatesIconName = QStringLiteral("system-software-update"); + const auto s_componentName = QStringLiteral("plasma_pk_updates"); + const auto s_eventIdUpdatesAvailable = QStringLiteral("updatesAvailable"); + const auto s_eventIdUpdatesInstalled = QStringLiteral("updatesInstalled"); + const auto s_eventIdRestartRequired = QStringLiteral("restartRequired"); + const auto s_eventIdError = QStringLiteral("updateError"); } // namespace { PkUpdates::PkUpdates(QObject *parent) : @@ -393,9 +398,11 @@ void PkUpdates::onFinished(PackageKit::Transaction::Exit status, uint runtime) qCDebug(PLASMA_PK_UPDATES) << "Check updates transaction finished successfully"; const int upCount = count(); if (upCount > 0) { - KNotification::event(KNotification::Notification, i18n("Software Updates Available"), + KNotification::event(s_eventIdUpdatesAvailable, + QString(), i18np("You have 1 new update", "You have %1 new updates", upCount), - s_pkUpdatesIconName, nullptr, KNotification::Persistent); + s_pkUpdatesIconName, nullptr, KNotification::Persistent, + s_componentName); } } else { qCDebug(PLASMA_PK_UPDATES) << "Check updates transaction didn't finish successfully"; @@ -416,9 +423,12 @@ void PkUpdates::onFinished(PackageKit::Transaction::Exit status, uint runtime) return; } else if (status == PackageKit::Transaction::ExitSuccess) { qCDebug(PLASMA_PK_UPDATES) << "Update packages transaction finished successfully"; - KNotification::event(KNotification::Notification, i18n("Updates Installed"), + KNotification::event(s_eventIdUpdatesInstalled, + i18n("Updates Installed"), i18np("Successfully updated %1 package", "Successfully updated %1 packages", packages.count()), - s_pkUpdatesIconName, nullptr, KNotification::Persistent); + s_pkUpdatesIconName, nullptr, + KNotification::Persistent, + s_componentName); emit updatesInstalled(); } else { qCDebug(PLASMA_PK_UPDATES) << "Update packages transaction didn't finish successfully"; @@ -444,14 +454,18 @@ void PkUpdates::onErrorCode(PackageKit::Transaction::Error error, const QString if (error == PackageKit::Transaction::ErrorBadGpgSignature) return; - KNotification::event(KNotification::Error, i18n("Update Error"), details, - s_pkUpdatesIconName, nullptr, KNotification::Persistent); + KNotification::event(s_eventIdError, i18n("Update Error"), + details, + s_pkUpdatesIconName, nullptr, + KNotification::Persistent, + s_componentName); } void PkUpdates::onRequireRestart(PackageKit::Transaction::Restart type, const QString &packageID) { if (type == PackageKit::Transaction::RestartSystem || type == PackageKit::Transaction::RestartSession) { - KNotification *notification = new KNotification(QLatin1String("notification"), KNotification::Persistent | KNotification::DefaultEvent); + KNotification *notification = new KNotification(s_eventIdRestartRequired, KNotification::Persistent); + notification->setComponentName(s_componentName); notification->setIconName(s_pkUpdatesIconName); if (type == PackageKit::Transaction::RestartSystem) { notification->setActions(QStringList{QLatin1String("Restart")}); diff --git a/src/declarative/plasma_pk_updates.notifyrc b/src/declarative/plasma_pk_updates.notifyrc new file mode 100644 index 0000000..0cec66b --- /dev/null +++ b/src/declarative/plasma_pk_updates.notifyrc @@ -0,0 +1,23 @@ +[Global] +IconName=system-software-update +Comment=Software Updates + +[Event/updatesAvailable] +Name=Updates Available +Comment=Software updates for the system are available +Action=Popup + +[Event/updatesInstalled] +Name=Updates Installed +Comment=The updates have been installed successfully +Action=Popup + +[Event/restartRequired] +Name=Restart Required +Comment=A session or computer restart is required +Action=Popup + +[Event/updateError] +Name=Update Error +Comment=An error occured +Action=Popup -- 2.28.0
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2