[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasmate/terietor/tools] plasmoidviewer: make plasmoidviewer fatal on non-existent/unknown containm
From:       Shaun Reich <shaun.reich () kdemail ! net>
Date:       2012-08-16 18:41:51
Message-ID: 20120816184151.B4D57A6104 () git ! kde ! org
[Download RAW message or body]

Git commit 7551a3a874a7deacf65afbe2078e3ce5ebb06c90 by Shaun Reich.
Committed on 01/02/2012 at 05:48.
Pushed by tsiapaliwkas into branch 'terietor/tools'.

make plasmoidviewer fatal on non-existent/unknown containment

M  +23   -2    plasmoidviewer/main.cpp

http://commits.kde.org/plasmate/7551a3a874a7deacf65afbe2078e3ce5ebb06c90

diff --git a/plasmoidviewer/main.cpp b/plasmoidviewer/main.cpp
index 0fe334b..7a87ace 100644
--- a/plasmoidviewer/main.cpp
+++ b/plasmoidviewer/main.cpp
@@ -193,11 +193,33 @@ int main(int argc, char **argv)
     kDebug() << "setting Location to" << args->getOption("location");
 
     QString containment = args->getOption("containment");
-    kDebug() << "setting containment to" << containment;
+    if (args->isSet("containment")) {
+
+        kDebug() << "setting theme to" << containment;
+
+        KPluginInfo::List containmentList = Plasma::Containment::listContainments();
+
+        foreach (const KPluginInfo& info, containmentList) {
+
+            if (info.pluginName() == containment) {
+                goto containmentFound;
+            }
+        }
+
+        kError() << "Fatal error. Containment: " + containment +
+            " is invalid. Did you run kbuildsycoca4? List known containments through \
--list-containments"; +        kError() << "Note: only accepts them Plugin Name \
(visible through --list-containments), not user-visible name"; +        return 1;
+
+        kDebug() << "setting containment to" << containment;
+    }
+
+containmentFound:
 
     if (args->isSet("theme")) {
         QString themeName = args->getOption("theme");
 
+        kDebug() << "setting theme to" << themeName;
 
         KPluginInfo::List themeList = Plasma::Theme::listThemeInfo();
 
@@ -209,7 +231,6 @@ int main(int argc, char **argv)
                 defaultTheme->setUseGlobalSettings(false);
                 defaultTheme->setThemeName(themeName);
 
-                kDebug() << "setting theme to" << themeName;
 
                 goto themeFound;
             }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic