diff --git a/src/modules/plasmalnf/PlasmaLnfInfo.cpp b/src/modules/plasmalnf/PlasmaLnfInfo.cpp index 27655b841..6e9249825 100644 --- a/src/modules/plasmalnf/PlasmaLnfInfo.cpp +++ b/src/modules/plasmalnf/PlasmaLnfInfo.cpp @@ -120,9 +120,21 @@ QStringList plasma_themes() return l; } +static QString *p_lnfPath = nullptr; + QString lnftool() { - return "/home/adridg/bin/lookandfeeltool"; + if ( !p_lnfPath ) + p_lnfPath = new QString("/usr/bin/lookandfeeltool"); + + return *p_lnfPath; +} + +void set_lnftool( const QString& lnfPath ) +{ + if (p_lnfPath) + delete p_lnfPath; + p_lnfPath = new QString( lnfPath ); } } // namespace Calamares diff --git a/src/modules/plasmalnf/PlasmaLnfInfo.h b/src/modules/plasmalnf/PlasmaLnfInfo.h index a35f8d1e6..27adc224c 100644 --- a/src/modules/plasmalnf/PlasmaLnfInfo.h +++ b/src/modules/plasmalnf/PlasmaLnfInfo.h @@ -19,11 +19,13 @@ #ifndef PLASMALNFINFO_H #define PLASMALNFINFO_H +#include #include namespace Calamares { QString lnftool(); +void set_lnftool( const QString& ); /* Internal */ QStringList themes_by_package(); diff --git a/src/modules/plasmalnf/PlasmaLnfJob.cpp b/src/modules/plasmalnf/PlasmaLnfJob.cpp index 696995abe..c98dc7587 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.cpp +++ b/src/modules/plasmalnf/PlasmaLnfJob.cpp @@ -36,8 +36,9 @@ #include "utils/Logger.h" -PlasmaLnfJob::PlasmaLnfJob( const QString& id ) - : m_id(id) +PlasmaLnfJob::PlasmaLnfJob( const QString& lnfPath, const QString& id ) + : m_lnfPath( lnfPath ) + , m_id(id) { } diff --git a/src/modules/plasmalnf/PlasmaLnfJob.h b/src/modules/plasmalnf/PlasmaLnfJob.h index a9fa29282..c7a7726ed 100644 --- a/src/modules/plasmalnf/PlasmaLnfJob.h +++ b/src/modules/plasmalnf/PlasmaLnfJob.h @@ -29,7 +29,7 @@ class PlasmaLnfJob : public Calamares::Job Q_OBJECT public: - explicit PlasmaLnfJob( const QString& id ); + explicit PlasmaLnfJob( const QString& lnfPath, const QString& id ); virtual ~PlasmaLnfJob() override; QString prettyName() const override; @@ -39,6 +39,7 @@ public: Calamares::JobResult exec() override; private: + QString m_lnfPath; QString m_id; }; diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp index 0b824fc46..73f89091b 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp @@ -22,6 +22,7 @@ #include "utils/CalamaresUtils.h" #include "utils/CalamaresUtilsSystem.h" +#include "PlasmaLnfInfo.h" #include "PlasmaLnfJob.h" #include "PlasmaLnfPage.h" #include "PlasmaLnfViewStep.h" @@ -112,9 +113,9 @@ PlasmaLnfViewStep::jobs() const Calamares::JobList l; cDebug() << "Creating Plasma LNF jobs .."; - if ( !m_themeId.isEmpty() ) + if ( !m_themeId.isEmpty() && !m_lnfPath.isEmpty() ) { - l.append( Calamares::job_ptr( new PlasmaLnfJob( m_themeId ) ) ); + l.append( Calamares::job_ptr( new PlasmaLnfJob( m_lnfPath, m_themeId ) ) ); } return l; } @@ -123,6 +124,11 @@ PlasmaLnfViewStep::jobs() const void PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { + m_lnfPath = CalamaresUtils::getString( configurationMap, "lnftool" ); + Calamares::set_lnftool( m_lnfPath ); + + if (m_lnfPath.isEmpty()) + cDebug() << "WARNING: no lnftool given for plasmalnf module."; } void diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.h b/src/modules/plasmalnf/PlasmaLnfViewStep.h index cdc447b7e..c2bcce2c0 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.h +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.h @@ -61,6 +61,7 @@ public slots: private: PlasmaLnfPage* m_widget; + QString m_lnfPath; QString m_themeId; }; diff --git a/src/modules/plasmalnf/plasmalnf.conf b/src/modules/plasmalnf/plasmalnf.conf index 54fff14c1..d9817ecbc 100644 --- a/src/modules/plasmalnf/plasmalnf.conf +++ b/src/modules/plasmalnf/plasmalnf.conf @@ -1,2 +1,4 @@ --- -# PlasmaLnf module has no configuration +--- +# Full path to the Plasma look-and-feel tool (CLI program +# for querying and applying Plasma themes). +lnftool: "/usr/bin/lookandfeeltool"