[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [plasmate/terietor/tools] plasmoidviewer: make plasmoidviewer theme fatal if theme was non-existent/
From: Shaun Reich <shaun.reich () kdemail ! net>
Date: 2012-08-16 18:41:51
Message-ID: 20120816184151.B14EBA6102 () git ! kde ! org
[Download RAW message or body]
Git commit 141b74e1998a40903159750d70d6c218f34591a5 by Shaun Reich.
Committed on 01/02/2012 at 05:40.
Pushed by tsiapaliwkas into branch 'terietor/tools'.
make plasmoidviewer theme fatal if theme was non-existent/not found
M +26 -4 plasmoidviewer/main.cpp
http://commits.kde.org/plasmate/141b74e1998a40903159750d70d6c218f34591a5
diff --git a/plasmoidviewer/main.cpp b/plasmoidviewer/main.cpp
index 13e6cfa..0fe334b 100644
--- a/plasmoidviewer/main.cpp
+++ b/plasmoidviewer/main.cpp
@@ -196,12 +196,34 @@ int main(int argc, char **argv)
kDebug() << "setting containment to" << containment;
if (args->isSet("theme")) {
- QString theme = args->getOption("theme");
- Plasma::Theme::defaultTheme()->setUseGlobalSettings(false);
- Plasma::Theme::defaultTheme()->setThemeName(theme);
- kDebug() << "setting theme to" << theme;
+ QString themeName = args->getOption("theme");
+
+
+ KPluginInfo::List themeList = Plasma::Theme::listThemeInfo();
+
+ foreach (const KPluginInfo& info, themeList) {
+
+ if (info.pluginName() == themeName) {
+
+ Plasma::Theme *defaultTheme = Plasma::Theme::defaultTheme();
+ defaultTheme->setUseGlobalSettings(false);
+ defaultTheme->setThemeName(themeName);
+
+ kDebug() << "setting theme to" << themeName;
+
+ goto themeFound;
+ }
+ }
+
+ kError() << "Fatal error. Theme: " + themeName +
+ " is invalid. Did you run kbuildsycoca4? List known themes through \
--list-themes"; + kError() << "Note: only accepts them Plugin Name (visible \
through --list-themes), not user-visible name"; + return 1;
+
}
+themeFound:
+
QString wallpaper;
if (args->isSet("wallpaper")) {
wallpaper = args->getOption("wallpaper");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic