[plasmalnf] Improve theme-listing handling

- if key is missing or badly typed, enable all (explicitly)
 - document settings and code
This commit is contained in:
Adriaan de Groot 2017-12-19 12:51:56 +01:00
parent f2aeecf546
commit d5b46dfb86
4 changed files with 26 additions and 9 deletions

View File

@ -77,16 +77,20 @@ PlasmaLnfPage::setLnfPath( const QString& path )
void
PlasmaLnfPage::setEnabledThemes(const ThemeInfoList& themes)
{
if ( themes.isEmpty() )
m_enabledThemes = plasma_themes();
else
m_enabledThemes = themes;
m_enabledThemes = themes;
updateThemeNames();
winnowThemes();
fillUi();
}
void
PlasmaLnfPage::setEnabledThemesAll()
{
setEnabledThemes( plasma_themes() );
}
void PlasmaLnfPage::updateThemeNames()
{
auto plasmaThemes = plasma_themes();

View File

@ -33,6 +33,12 @@ namespace Ui
class PlasmaLnfPage;
}
/** @brief Page for selecting a Plasma Look-and-Feel theme.
*
* You must call setEnabledThemes -- either overload -- once
* to get the selection widgets. Note that calling that with
* an empty list will result in zero (0) selectable themes.
*/
class PlasmaLnfPage : public QWidget
{
Q_OBJECT
@ -40,7 +46,10 @@ public:
explicit PlasmaLnfPage( QWidget* parent = nullptr );
void setLnfPath( const QString& path );
/** @brief enable only the listed themes. */
void setEnabledThemes( const ThemeInfoList& themes );
/** @brief enable all installed plasma themes. */
void setEnabledThemesAll();
signals:
void plasmaThemeSelected( const QString& id );

View File

@ -158,6 +158,8 @@ PlasmaLnfViewStep::setConfigurationMap( const QVariantMap& configurationMap )
cDebug() << "WARNING: only one theme enabled in plasmalnf";
m_widget->setEnabledThemes( allThemes );
}
else
m_widget->setEnabledThemesAll(); // All of them
}
void

View File

@ -12,12 +12,14 @@ lnftool: "/usr/bin/lookandfeeltool"
# 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 may be listed by id,
# (e.g. fluffy-bunny, below) or as a theme and an image (e.g. breeze)
# which will be used to show a screenshot.
# here. If this key is not present, all of the installed themes are listed.
# If the key is present, only installed themes that are *also* included
# in the list are shown (could be none!).
#
# Themes may be listed by id, (e.g. fluffy-bunny, below) or as a theme
# and an image (e.g. breeze) which will be used to show a screenshot.
# Themes with no image get a "missing screenshot" image; if the
# image file is not found, they get a color swatch based on the image name.
themes:
- org.kde.fuzzy-pig.desktop
- theme: org.kde.breeze.desktop