diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp index 01759ba32..21e097a0e 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.cpp +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -34,11 +34,11 @@ static PlasmaLnfList plasma_themes() for ( const KPluginMetaData& data : pkgs ) { - packages << PlasmaLnfDescriptor{ data.pluginId(), data.name() }; - cDebug() << "LNF Package" << data.pluginId(); - cDebug() << " .." << data.name(); - cDebug() << " .." << data.description(); - cDebug() << " .." << 'V' << data.isValid() << 'H' << data.isHidden() << 'D' << data.isEnabledByDefault(); + if ( data.isValid() && !data.isHidden() && !data.name().isEmpty() ) + { + packages << PlasmaLnfDescriptor{ data.pluginId(), data.name() }; + cDebug() << "LNF Package" << data.pluginId(); + } } return packages; @@ -55,9 +55,7 @@ PlasmaLnfPage::PlasmaLnfPage( QWidget* parent ) ui->retranslateUi( this ); ui->generalExplanation->setText( tr( "Please choose a look-and-feel for the KDE Plasma Desktop, below." ) ); m_availableLnf = plasma_themes(); - ui->lnfCombo->clear(); - for ( const auto& p : m_availableLnf ) - ui->lnfCombo->addItem( p.name ); + winnowThemes(); } ) @@ -83,3 +81,18 @@ PlasmaLnfPage::setLnfPath( const QString& path ) { m_lnfPath = path; } + +void +PlasmaLnfPage::setEnabledThemes(const QStringList& themes) +{ + m_enabledThemes = themes; + winnowThemes(); +} + +void PlasmaLnfPage::winnowThemes() +{ + ui->lnfCombo->clear(); + for ( const auto& p : m_availableLnf ) + if ( m_enabledThemes.isEmpty() || m_enabledThemes.contains( p.id ) ) + ui->lnfCombo->addItem( p.name ); +} diff --git a/src/modules/plasmalnf/PlasmaLnfPage.h b/src/modules/plasmalnf/PlasmaLnfPage.h index 31731eb0d..89867cabf 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.h +++ b/src/modules/plasmalnf/PlasmaLnfPage.h @@ -21,6 +21,7 @@ #include #include +#include #include namespace Ui @@ -43,6 +44,7 @@ public: explicit PlasmaLnfPage( QWidget* parent = nullptr ); void setLnfPath( const QString& path ); + void setEnabledThemes( const QStringList& themes ); public slots: void activated( int index ); @@ -51,8 +53,11 @@ signals: void plasmaThemeSelected( const QString& id ); private: + void winnowThemes(); + Ui::PlasmaLnfPage* ui; QString m_lnfPath; + QStringList m_enabledThemes; PlasmaLnfList m_availableLnf; }; diff --git a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp index f4e01b711..550e42a17 100644 --- a/src/modules/plasmalnf/PlasmaLnfViewStep.cpp +++ b/src/modules/plasmalnf/PlasmaLnfViewStep.cpp @@ -135,6 +135,15 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap ) if ( configurationMap.contains( "liveuser" ) && configurationMap.value( "liveuser" ).type() == QVariant::String ) liveUser = configurationMap.value( "liveuser" ).toString(); m_liveUser = liveUser; + + if ( configurationMap.contains( "themes" ) && + configurationMap.value( "themes" ).type() == QVariant::List ) + { + QStringList enabledThemes( configurationMap.value( "themes" ).toStringList() ); + if ( enabledThemes.length() == 1 ) + cDebug() << "WARNING: only one theme enabled in plasmalnf"; + m_widget->setEnabledThemes( enabledThemes ); + } } void diff --git a/src/modules/plasmalnf/plasmalnf.conf b/src/modules/plasmalnf/plasmalnf.conf index 059ed9e36..a35b50da6 100644 --- a/src/modules/plasmalnf/plasmalnf.conf +++ b/src/modules/plasmalnf/plasmalnf.conf @@ -1,10 +1,22 @@ --- # Full path to the Plasma look-and-feel tool (CLI program -# for querying and applying Plasma themes). +# for querying and applying Plasma themes). If this is not +# set, no LNF setting will happen. lnftool: "/usr/bin/lookandfeeltool" # For systems where the user Calamares runs as (usually root, # via either sudo or pkexec) has a clean environment, set this # to the originating username; the lnftool will be run through # "sudo -H -u " instead of directly. -liveuser: "live" +# +# liveuser: "live" + +# You can limit the list of Plasma look-and-feel themes by listing ids +# here. If this key is not present, or the list is empty, all of the +# installed themes are listed. If only one theme is listed, why are +# you using this module at all? +# +themes: + - org.kde.breeze.desktop + # - org.kde.breezedark.desktop +