Hello community, here is the log from the commit of package plasma5-pk-updates for openSUSE:Factory checked in at 2019-06-30 10:16:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/plasma5-pk-updates (Old) and /work/SRC/openSUSE:Factory/.plasma5-pk-updates.new.4615 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "plasma5-pk-updates" Sun Jun 30 10:16:20 2019 rev:19 rq:711719 version:0.3.2 Changes: -------- --- /work/SRC/openSUSE:Factory/plasma5-pk-updates/plasma5-pk-updates.changes 2019-05-03 22:22:29.544716613 +0200 +++ /work/SRC/openSUSE:Factory/.plasma5-pk-updates.new.4615/plasma5-pk-updates.changes 2019-06-30 10:16:22.639142574 +0200 @@ -1,0 +2,21 @@ +Mon Jun 24 07:06:16 UTC 2019 - Fabian Vogt <fab...@ritter-vogt.de> + +- More spec file cleanup + +------------------------------------------------------------------- +Sun Jun 23 17:24:08 UTC 2019 - Stefan BrĂ¼ns <stefan.bru...@rwth-aachen.de> + +- Add some upstream patches to make the notifications less obtrusive + + 0001-Replace-KIconLoader-pixmaps-with-standard-icon-names.patch + + 0002-Fix-usage-of-0-for-null-pointer-constants.patch + + 0003-Use-own-eventIds-and-ComponentName-instead-of-generi.patch + + 0004-Make-the-notifications-less-obtrusive.patch +- Rebase 0001-Hide-option-to-install-updates-on-Tumbleweed.patch +- Remove kdelibs4-support dependency + + 0006-Remove-explicit-initialization-of-default-constructe.patch + + 0007-Port-away-from-KDELibs4Support-use-Solid-Power-inter.patch +- spec file cleanup + + remove defattr + + remove some conditional code for 13.2 + +------------------------------------------------------------------- New: ---- 0001-Replace-KIconLoader-pixmaps-with-standard-icon-names.patch 0002-Fix-usage-of-0-for-null-pointer-constants.patch 0003-Use-own-eventIds-and-ComponentName-instead-of-generi.patch 0004-Make-the-notifications-less-obtrusive.patch 0006-Remove-explicit-initialization-of-default-constructe.patch 0007-Port-away-from-KDELibs4Support-use-Solid-Power-inter.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ plasma5-pk-updates.spec ++++++ --- /var/tmp/diff_new_pack.riVrg0/_old 2019-06-30 10:16:23.299143600 +0200 +++ /var/tmp/diff_new_pack.riVrg0/_new 2019-06-30 10:16:23.299143600 +0200 @@ -32,18 +32,23 @@ Patch1: 0001-Hide-updates-and-checkbox-when-system-is-offline.patch Patch2: 0002-Add-its-own-messageChanged-NOTIFY-signal-to-message.patch Patch3: 0003-Delay-PkUpdates-checkUpdates-calls-if-the-network-is-offline.patch - +# PATCH-FIX-UPSTREAM +Patch4: 0001-Replace-KIconLoader-pixmaps-with-standard-icon-names.patch +Patch5: 0002-Fix-usage-of-0-for-null-pointer-constants.patch +Patch6: 0003-Use-own-eventIds-and-ComponentName-instead-of-generi.patch +Patch7: 0004-Make-the-notifications-less-obtrusive.patch +Patch8: 0006-Remove-explicit-initialization-of-default-constructe.patch +Patch9: 0007-Port-away-from-KDELibs4Support-use-Solid-Power-inter.patch # PATCH-FEATURE-OPENSUSE Patch100: 0001-Hide-option-to-install-updates-on-Tumbleweed.patch BuildRequires: PackageKit-Qt5-devel BuildRequires: cmake >= 3.0 BuildRequires: extra-cmake-modules >= 1.3.0 BuildRequires: kcoreaddons-devel >= 5.25.0 -BuildRequires: kdelibs4support-devel >= 5.25.0 BuildRequires: ki18n-devel >= 5.25.0 -BuildRequires: kiconthemes-devel >= 5.25.0 BuildRequires: knotifications-devel >= 5.25.0 BuildRequires: plasma-framework-devel >= 5.25.0 +BuildRequires: solid-devel BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5DBus) BuildRequires: pkgconfig(Qt5Gui) @@ -51,21 +56,18 @@ BuildRequires: pkgconfig(Qt5Widgets) Requires: PackageKit Recommends: %{name}-lang = %{version} -%if 0%{?suse_version} > 1314 && "%{suse_version}" != "1320" -# Use a fake version number as that the apper version is higher than 0.2 +# Use a fake version number higher than the last provided apper version (0.9.2) Provides: apper = 1.0 Obsoletes: apper < 1.0 Obsoletes: apper-lang < 1.0 -%endif -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Plasma applet for software updates using PackageKit. %lang_package + %prep -%setup -q -n plasma-pk-updates-%{version} -a 1 -%autopatch -p1 +%autosetup -p1 -n plasma-pk-updates-%{version} -a 1 %build %cmake_kf5 -d build @@ -77,14 +79,13 @@ %find_lang plasma_applet_org.kde.plasma.pkupdates plasma-pk-updates.lang %files lang -f plasma-pk-updates.lang -%defattr(-,root,root) %files -%defattr(-,root,root) %license LICENSE %{_kf5_qmldir}/ %{_kf5_plasmadir}/ %{_kf5_servicesdir}/ %{_kf5_appstreamdir}/ +%{_kf5_notifydir}/ %changelog ++++++ 0001-Hide-option-to-install-updates-on-Tumbleweed.patch ++++++ --- /var/tmp/diff_new_pack.riVrg0/_old 2019-06-30 10:16:23.319143631 +0200 +++ /var/tmp/diff_new_pack.riVrg0/_new 2019-06-30 10:16:23.323143637 +0200 @@ -23,7 +23,7 @@ #include <QDBusReply> #include <QDBusInterface> @@ -179,6 +180,21 @@ bool PkUpdates::isOnBattery() const - return Solid::PowerManagement::appShouldConserveResources(); + return m_isOnBattery; } +bool PkUpdates::isTumbleweed() const ++++++ 0001-Replace-KIconLoader-pixmaps-with-standard-icon-names.patch ++++++ >From 250d521b64091040803871b55c53c82bc8406898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bru...@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 ++++++ 0002-Fix-usage-of-0-for-null-pointer-constants.patch ++++++ >From 43001fe8b62fe14a728f9d38a2d313b119058ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bru...@rwth-aachen.de> Date: Thu, 20 Jun 2019 03:31:23 +0200 Subject: [PATCH 2/7] Fix usage of 0 for null pointer constants Summary: Depends on D21972 Reviewers: lukas, jgrulich Differential Revision: https://phabricator.kde.org/D21973 --- src/declarative/pkupdates.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp index 9fdb538..0832551 100644 --- a/src/declarative/pkupdates.cpp +++ b/src/declarative/pkupdates.cpp @@ -395,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), - s_pkUpdatesIconName, 0, KNotification::Persistent); + s_pkUpdatesIconName, nullptr, KNotification::Persistent); } } else { qCDebug(PLASMA_PK_UPDATES) << "Check updates transaction didn't finish successfully"; @@ -418,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()), - s_pkUpdatesIconName, 0, KNotification::Persistent); + s_pkUpdatesIconName, nullptr, KNotification::Persistent); emit updatesInstalled(); } else { qCDebug(PLASMA_PK_UPDATES) << "Update packages transaction didn't finish successfully"; @@ -445,7 +445,7 @@ void PkUpdates::onErrorCode(PackageKit::Transaction::Error error, const QString return; KNotification::event(KNotification::Error, i18n("Update Error"), details, - s_pkUpdatesIconName, 0, KNotification::Persistent); + s_pkUpdatesIconName, nullptr, KNotification::Persistent); } void PkUpdates::onRequireRestart(PackageKit::Transaction::Restart type, const QString &packageID) -- 2.21.0 ++++++ 0003-Use-own-eventIds-and-ComponentName-instead-of-generi.patch ++++++ >From f5a2f222fe002b8d27635636707edbee0f333812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bru...@rwth-aachen.de> Date: Sat, 22 Jun 2019 00:51:36 +0200 Subject: [PATCH 3/7] 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 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.21.0 ++++++ 0004-Make-the-notifications-less-obtrusive.patch ++++++ >From b40e573a54b001859b149cbea1acdf3bc44927d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bru...@rwth-aachen.de> Date: Sat, 22 Jun 2019 23:04:42 +0200 Subject: [PATCH 4/7] Make the notifications less obtrusive Summary: Currently, whenever the PK package cache is refreshed, a new notification is show, even when the update count does not change. The notification also persists after the update has installed. To make the notifications less obtrusive: 1. Skip the "You have N new updates" message generation completely when the update count is unchanged. 2. In case the update count changes, close the old one generate a new one. Using "CloseOnTimeout" has the 3. Change the "Updates Installed" notification from "Persistent" to "CloseOnTimeout". The notification is still in the history. 4. After update installation, also remove the "You have N new updates" Popup. Depends on D22026 Test Plan: call `pkcon refresh` multiple times Reviewers: jgrulich, lukas, ngraham, fvogt Differential Revision: https://phabricator.kde.org/D22027 --- src/declarative/pkupdates.cpp | 19 ++++++++++++++++--- src/declarative/pkupdates.h | 3 +++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp index 4de20dd..937e318 100644 --- a/src/declarative/pkupdates.cpp +++ b/src/declarative/pkupdates.cpp @@ -397,12 +397,22 @@ void PkUpdates::onFinished(PackageKit::Transaction::Exit status, uint runtime) if (m_lastCheckSuccessful) { qCDebug(PLASMA_PK_UPDATES) << "Check updates transaction finished successfully"; const int upCount = count(); - if (upCount > 0) { - KNotification::event(s_eventIdUpdatesAvailable, + if (upCount != m_lastUpdateCount && m_lastNotification) { + qCDebug(PLASMA_PK_UPDATES) << "Disposing old update count notification"; + m_lastNotification->close(); + } + if (upCount > 0 && upCount != m_lastUpdateCount) { + m_lastUpdateCount = upCount; + m_lastNotification = KNotification::event(s_eventIdUpdatesAvailable, QString(), i18np("You have 1 new update", "You have %1 new updates", upCount), s_pkUpdatesIconName, nullptr, KNotification::Persistent, s_componentName); + connect(m_lastNotification, &KNotification::closed, this, [this] { + qCDebug(PLASMA_PK_UPDATES) << "Old notification closed"; + m_lastNotification = nullptr; + m_lastUpdateCount = 0; + }); } } else { qCDebug(PLASMA_PK_UPDATES) << "Check updates transaction didn't finish successfully"; @@ -423,11 +433,14 @@ 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"; + if (m_lastNotification) { + m_lastNotification->close(); + } KNotification::event(s_eventIdUpdatesInstalled, i18n("Updates Installed"), i18np("Successfully updated %1 package", "Successfully updated %1 packages", packages.count()), s_pkUpdatesIconName, nullptr, - KNotification::Persistent, + KNotification::CloseOnTimeout, s_componentName); emit updatesInstalled(); } else { diff --git a/src/declarative/pkupdates.h b/src/declarative/pkupdates.h index d9cb063..ef02cc9 100644 --- a/src/declarative/pkupdates.h +++ b/src/declarative/pkupdates.h @@ -29,6 +29,7 @@ #include <PackageKit/Transaction> class QTimer; +class KNotification; Q_DECLARE_LOGGING_CATEGORY(PLASMA_PK_UPDATES) @@ -229,6 +230,8 @@ private: QPointer<PackageKit::Transaction> m_cacheTrans; QPointer<PackageKit::Transaction> m_installTrans; QPointer<PackageKit::Transaction> m_detailTrans; + QPointer<KNotification> m_lastNotification; + int m_lastUpdateCount = 0; QVariantMap m_updateList; QStringList m_importantList; QStringList m_securityList; -- 2.21.0 ++++++ 0006-Remove-explicit-initialization-of-default-constructe.patch ++++++ >From ded3b23309169f4370252d5c2572c6a584b21bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bru...@rwth-aachen.de> Date: Fri, 21 Jun 2019 00:03:35 +0200 Subject: [PATCH 6/7] Remove explicit initialization of default constructed members Summary: All four are of type QPointer<PackageKit::Transaction> and are thus default initialized, no need to do it explicitly. Reviewers: lukas, jgrulich Differential Revision: https://phabricator.kde.org/D21975 --- src/declarative/pkupdates.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp index 2b4583d..e2aa79a 100644 --- a/src/declarative/pkupdates.cpp +++ b/src/declarative/pkupdates.cpp @@ -47,11 +47,7 @@ namespace } // namespace { PkUpdates::PkUpdates(QObject *parent) : - QObject(parent), - m_updatesTrans(Q_NULLPTR), - m_cacheTrans(Q_NULLPTR), - m_installTrans(Q_NULLPTR), - m_detailTrans(Q_NULLPTR) + QObject(parent) { setStatusMessage(i18n("Idle")); -- 2.21.0 ++++++ 0007-Port-away-from-KDELibs4Support-use-Solid-Power-inter.patch ++++++ >From 6759661e86fd31f963a9225de728e36ad5a159be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bru...@rwth-aachen.de> Date: Fri, 21 Jun 2019 01:08:28 +0200 Subject: [PATCH 7/7] Port away from KDELibs4Support, use Solid::Power interface Summary: The Solid::Power implementation does not track the state itself (to avoid querying the initial state even when it is not used), so track the state inside PkUpdates and query the initial state from the interface asynchronously. Test Plan: The initial state is printed correctly in the debug output, same for change notifications. Depends on D21975 Reviewers: lukas, jgrulich Differential Revision: https://phabricator.kde.org/D21976 --- CMakeLists.txt | 2 +- src/declarative/CMakeLists.txt | 4 ++-- src/declarative/pkupdates.cpp | 29 ++++++++++++++++++++++------- src/declarative/pkupdates.h | 1 + 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2dd2cb..48c4013 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ find_package(KF5 REQUIRED I18n CoreAddons # KFormat Notifications - KDELibs4Support #Solid::Power + Solid # Solid::Power ) find_package(packagekitqt5 REQUIRED) diff --git a/src/declarative/CMakeLists.txt b/src/declarative/CMakeLists.txt index bdeb5b1..183a8d0 100644 --- a/src/declarative/CMakeLists.txt +++ b/src/declarative/CMakeLists.txt @@ -16,7 +16,7 @@ target_link_libraries(plasmapk_qmlplugins KF5::CoreAddons KF5::Notifications KF5::ConfigCore - KF5::KDELibs4Support + KF5::Solid PK::packagekitqt5 ) @@ -38,7 +38,7 @@ target_link_libraries(plasmapk-console KF5::I18n KF5::CoreAddons KF5::ConfigCore - KF5::KDELibs4Support + KF5::Solid KF5::Notifications PK::packagekitqt5 ) diff --git a/src/declarative/pkupdates.cpp b/src/declarative/pkupdates.cpp index e2aa79a..c60016f 100644 --- a/src/declarative/pkupdates.cpp +++ b/src/declarative/pkupdates.cpp @@ -27,7 +27,8 @@ #include <KLocalizedString> #include <KFormat> #include <KNotification> -#include <Solid/PowerManagement> +#include <Solid/Power> +#include <Solid/AcPluggedJob> #include <KConfigGroup> #include <KSharedConfig> @@ -47,18 +48,32 @@ namespace } // namespace { PkUpdates::PkUpdates(QObject *parent) : - QObject(parent) + QObject(parent), + m_isOnBattery(true) { setStatusMessage(i18n("Idle")); connect(PackageKit::Daemon::global(), &PackageKit::Daemon::changed, this, &PkUpdates::onChanged); connect(PackageKit::Daemon::global(), &PackageKit::Daemon::updatesChanged, this, &PkUpdates::onUpdatesChanged); connect(PackageKit::Daemon::global(), &PackageKit::Daemon::networkStateChanged, this, &PkUpdates::networkStateChanged); - connect(Solid::PowerManagement::notifier(), &Solid::PowerManagement::Notifier::resumingFromSuspend, this, + connect(Solid::Power::self(), &Solid::Power::resumeFromSuspend, this, [this] {PackageKit::Daemon::stateHasChanged(QStringLiteral("resume"));}); - connect(Solid::PowerManagement::notifier(), &Solid::PowerManagement::Notifier::appShouldConserveResourcesChanged, - this, &PkUpdates::isOnBatteryChanged); + connect(Solid::Power::self(), &Solid::Power::acPluggedChanged, this, [this] (bool acPlugged) { + qCDebug(PLASMA_PK_UPDATES) << "acPluggedChanged onBattery:" << m_isOnBattery << "->" << !acPlugged; + if (!acPlugged != m_isOnBattery) { + m_isOnBattery = !acPlugged; + emit PkUpdates::isOnBatteryChanged(); + } + }); + auto acPluggedJob = Solid::Power::self()->isAcPlugged(this); + connect(acPluggedJob , &Solid::Job::result, this, [this] (Solid::Job* job) { + bool acPlugged = static_cast<Solid::AcPluggedJob*>(job)->isPlugged(); + qCDebug(PLASMA_PK_UPDATES) << "acPlugged initial state" << acPlugged; + m_isOnBattery = !acPlugged; + emit PkUpdates::isOnBatteryChanged(); + }); + acPluggedJob->start(); connect(PackageKit::Daemon::global(), &PackageKit::Daemon::networkStateChanged, this, &PkUpdates::doDelayedCheckUpdates); connect(this, &PkUpdates::isActiveChanged, this, &PkUpdates::messageChanged); @@ -194,8 +209,8 @@ bool PkUpdates::isNetworkMobile() const bool PkUpdates::isOnBattery() const { - qCDebug(PLASMA_PK_UPDATES) << "Is on battery:" << Solid::PowerManagement::appShouldConserveResources(); - return Solid::PowerManagement::appShouldConserveResources(); + qCDebug(PLASMA_PK_UPDATES) << "Is on battery:" << m_isOnBattery; + return m_isOnBattery; } void PkUpdates::getUpdateDetails(const QString &pkgID) diff --git a/src/declarative/pkupdates.h b/src/declarative/pkupdates.h index ef02cc9..e9d083e 100644 --- a/src/declarative/pkupdates.h +++ b/src/declarative/pkupdates.h @@ -240,6 +240,7 @@ private: Activity m_activity = Idle; bool m_lastCheckSuccessful = false; bool m_checkUpdatesWhenNetworkOnline = false; + bool m_isOnBattery; }; #endif // PLASMA_PK_UPDATES_H -- 2.21.0