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

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

Git commit 36c96e6f2dc5f8a3e0e927892946455c21a09678 by Shaun Reich.
Committed on 01/02/2012 at 06:06.
Pushed by tsiapaliwkas into branch 'terietor/tools'.

make plasmoidviewer fatal on unknown applet loading

now all 3 (applets, containments, themes), error on being non-existent.
even a friendly neighborhood warning is issued. otherwise it's a bit
annoying/difficult to see if the applet was actually loaded.

should help a lot of people who i've met who haven't run kbuildsycoca4
as well.

M  +22   -4    plasmoidviewer/main.cpp

http://commits.kde.org/plasmate/36c96e6f2dc5f8a3e0e927892946455c21a09678

diff --git a/plasmoidviewer/main.cpp b/plasmoidviewer/main.cpp
index 7a87ace..8998b1a 100644
--- a/plasmoidviewer/main.cpp
+++ b/plasmoidviewer/main.cpp
@@ -184,8 +184,27 @@ int main(int argc, char **argv)
     QString pluginName;
     if (args->count() > 0) {
         pluginName = args->arg(0);
+
+        kDebug() << "setting applet to" << pluginName;
+
+        KPluginInfo::List appletList = Plasma::Applet::listAppletInfo();
+
+        foreach (const KPluginInfo& info, appletList) {
+
+            if (info.pluginName() == pluginName) {
+                goto appletFound;
+            }
+        }
+
+        kError() << "Fatal error. Applet: " + pluginName +
+            " is invalid. Did you run kbuildsycoca4? List known containments through \
--list"; +        kError() << "Note: only accepts applet Plugin Name (visible through \
--list), not user-visible name"; +        return 1;
+
     }
 
+appletFound:
+
     QString formfactor = args->getOption("formfactor");
     kDebug() << "setting FormFactor to" << args->getOption("formfactor");
 
@@ -195,7 +214,7 @@ int main(int argc, char **argv)
     QString containment = args->getOption("containment");
     if (args->isSet("containment")) {
 
-        kDebug() << "setting theme to" << containment;
+        kDebug() << "setting containment to" << containment;
 
         KPluginInfo::List containmentList = Plasma::Containment::listContainments();
 
@@ -208,10 +227,9 @@ int main(int argc, char **argv)
 
         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"; +        kError() << "Note: only \
accepts containment Plugin Name (visible through --list-containments), not \
user-visible name";  return 1;
 
-        kDebug() << "setting containment to" << containment;
     }
 
 containmentFound:
@@ -238,7 +256,7 @@ containmentFound:
 
         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"; +        kError() << "Note: only accepts \
theme Plugin Name (visible through --list-themes), not user-visible name";  return 1;
 
     }


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

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