File 0001-Replace-KIconLoader-pixmaps-with-standard-icon-names.patch of Package plasma5-pk-updates
From 250d521b64091040803871b55c53c82bc8406898 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 20 Jun 2019 03:08:46 +0200
Subject: [PATCH 1/7] Replace KIconLoader + pixmaps with standard icon names
Summary: Let the notification host handle the theming and the like.
Reviewers: lukas, jgrulich
Subscribers: zzag
Differential Revision: https://phabricator.kde.org/D21972
---
CMakeLists.txt | 1 -
src/declarative/CMakeLists.txt | 2 --
src/declarative/pkupdates.cpp | 14 +++++++++-----
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18ce831..d2dd2cb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,6 @@ find_package(KF5 REQUIRED
I18n
CoreAddons # KFormat
Notifications
- IconThemes # KIconLoader
KDELibs4Support #Solid::Power
)
diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt
index 606cf12..558c293 100644
--- a/src/declarative/CMakeLists.txt
+++ b/src/declarative/CMakeLists.txt
@@ -15,7 +15,6 @@ target_link_libraries(plasmapk_qmlplugins
KF5::I18n
KF5::CoreAddons
KF5::Notifications
- KF5::IconThemes
KF5::ConfigCore
KF5::KDELibs4Support
PK::packagekitqt5
@@ -40,6 +39,5 @@ target_link_libraries(plasmapk-console
KF5::ConfigCore
KF5::KDELibs4Support
KF5::Notifications
- KF5::IconThemes
PK::packagekitqt5
)
diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp
index 94b712e..9fdb538 100644
--- a/src/declarative/pkupdates.cpp
+++ b/src/declarative/pkupdates.cpp
@@ -28,7 +28,6 @@
#include <KFormat>
#include <KNotification>
#include <Solid/PowerManagement>
-#include <KIconLoader>
#include <KConfigGroup>
#include <KSharedConfig>
@@ -37,6 +36,11 @@
Q_LOGGING_CATEGORY(PLASMA_PK_UPDATES, "plasma-pk-updates")
+namespace
+{
+ const auto s_pkUpdatesIconName = QStringLiteral("system-software-update");
+} // namespace {
+
PkUpdates::PkUpdates(QObject *parent) :
QObject(parent),
m_updatesTrans(Q_NULLPTR),
@@ -391,7 +395,7 @@ void PkUpdates::onFinished(PackageKit::Transaction::Exit status, uint runtime)
if (upCount > 0) {
KNotification::event(KNotification::Notification, i18n("Software Updates Available"),
i18np("You have 1 new update", "You have %1 new updates", upCount),
- KIconLoader::global()->loadIcon("system-software-update", KIconLoader::Desktop), 0, KNotification::Persistent);
+ s_pkUpdatesIconName, 0, KNotification::Persistent);
}
} else {
qCDebug(PLASMA_PK_UPDATES) << "Check updates transaction didn't finish successfully";
@@ -414,7 +418,7 @@ void PkUpdates::onFinished(PackageKit::Transaction::Exit status, uint runtime)
qCDebug(PLASMA_PK_UPDATES) << "Update packages transaction finished successfully";
KNotification::event(KNotification::Notification, i18n("Updates Installed"),
i18np("Successfully updated %1 package", "Successfully updated %1 packages", packages.count()),
- KIconLoader::global()->loadIcon("system-software-update", KIconLoader::Desktop), 0, KNotification::Persistent);
+ s_pkUpdatesIconName, 0, KNotification::Persistent);
emit updatesInstalled();
} else {
qCDebug(PLASMA_PK_UPDATES) << "Update packages transaction didn't finish successfully";
@@ -441,14 +445,14 @@ void PkUpdates::onErrorCode(PackageKit::Transaction::Error error, const QString
return;
KNotification::event(KNotification::Error, i18n("Update Error"), details,
- KIconLoader::global()->loadIcon("system-software-update", KIconLoader::Desktop), 0, KNotification::Persistent);
+ s_pkUpdatesIconName, 0, KNotification::Persistent);
}
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);
- notification->setPixmap(KIconLoader::global()->loadIcon("system-software-update", KIconLoader::Desktop));
+ notification->setIconName(s_pkUpdatesIconName);
if (type == PackageKit::Transaction::RestartSystem) {
notification->setActions(QStringList{QLatin1String("Restart")});
notification->setTitle(i18n("Restart is required"));
--
2.21.0