From 8f590848bde053e0e2eaca492222b9537e5a4e56 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 11 Nov 2020 12:45:19 +0100 Subject: [PATCH 1/3] [plasmalnf] Simplify code - Look-and-Feel job has no status to speak of - Coding style --- src/modules/plasmalnf/PlasmaLnfJob.cpp | 17 ++++------------- src/modules/plasmalnf/PlasmaLnfJob.h | 1 - 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp index 0721bcd88..7ffe3aff7 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.cpp +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -20,30 +20,19 @@ PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) { } - PlasmaLnfJob::~PlasmaLnfJob() {} - QString PlasmaLnfJob::prettyName() const { return tr( "Plasma Look-and-Feel Job" ); } -QString -PlasmaLnfJob::prettyStatusMessage() const -{ - return prettyName(); -} - - Calamares::JobResult PlasmaLnfJob::exec() { - cDebug() << "Plasma Look-and-Feel Job"; - - auto system = CalamaresUtils::System::instance(); - Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + auto* system = CalamaresUtils::System::instance(); + auto* gs = Calamares::JobQueue::instance()->globalStorage(); QStringList command( { "sudo", "-E", @@ -59,8 +48,10 @@ PlasmaLnfJob::exec() int r = system->targetEnvCall( command ); if ( r ) + { return Calamares::JobResult::error( tr( "Could not select KDE Plasma Look-and-Feel package" ), tr( "Could not select KDE Plasma Look-and-Feel package" ) ); + } return Calamares::JobResult::ok(); } diff --git a/src/modules/plasmalnf/PlasmaLnfJob.h b/src/modules/plasmalnf/PlasmaLnfJob.h index 83360434e..4eaf81014 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.h +++ b/src/modules/plasmalnf/PlasmaLnfJob.h @@ -24,7 +24,6 @@ public: ~PlasmaLnfJob() override; QString prettyName() const override; - QString prettyStatusMessage() const override; Calamares::JobResult exec() override; From 76b09819184c2a1a2c31b9cec148b1400bb5dd43 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 11 Nov 2020 12:57:40 +0100 Subject: [PATCH 2/3] [plasmalnf] Apply workaround for lookandfeeltool The lookandfeeltool does not (always?) write the LookAndFeelPackage key that the KCM does -- and which this module reads on startup to find the default LnF. This seems to be a regression in recent lookandfeeltool versions (or in the KCM code that backs it). Workaround supplied by jghodd. Fixes #1573 --- src/modules/plasmalnf/PlasmaLnfJob.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp index 7ffe3aff7..3b550d50a 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.cpp +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -14,6 +14,11 @@ #include "utils/CalamaresUtilsSystem.h" #include "utils/Logger.h" +#ifdef WITH_KCONFIG +#include +#include +#endif + PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) : m_lnfPath( lnfPath ) , m_id( id ) @@ -53,5 +58,15 @@ PlasmaLnfJob::exec() tr( "Could not select KDE Plasma Look-and-Feel package" ) ); } +#ifdef WITH_KCONFIG + // This is a workaround for lookandfeeltool **not** writing + // the LookAndFeelPackage key in kdeglobals; this happens + // with the lnftool and Plasma 5.20 (possibly other combinations + // as well). + QString targetConfig = system->targetPath( "/home/" + gs->value( "username" ).toString() + "/.config/kdeglobals" ); + KConfigGroup cg( KSharedConfig::openConfig( targetConfig ), "KDE" ); + cg.writeEntry( "LookAndFeelPackage", m_id ); +#endif + return Calamares::JobResult::ok(); } From a8359696caf07b81b85db8acad2d3f44720d07fa Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 11 Nov 2020 13:06:09 +0100 Subject: [PATCH 3/3] [plasmalnf] Remove unnecessary includes --- src/modules/plasmalnf/PlasmaLnfViewStep.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.h b/src/modules/plasmalnf/PlasmaLnfViewStep.h index 46c24c970..74de803c9 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.h +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.h @@ -14,10 +14,6 @@ #include "utils/PluginFactory.h" #include "viewpages/ViewStep.h" -#include -#include -#include - class PlasmaLnfPage; class PLUGINDLLEXPORT PlasmaLnfViewStep : public Calamares::ViewStep