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

List:       kde-commits
Subject:    KDE/kdebase/runtime/plasma/tools/plasmapkg
From:       Petri Damstén <petri.damsten () kdemail ! net>
Date:       2009-11-03 18:37:31
Message-ID: 1257273451.016523.13464.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1044426 by pdamsten:

* install wallpaper plasma packages
* auto detect (plasmoids,) dataengines, runners and wallpapers (install them without \
--type)

Review: http://reviewboard.kde.org/r/2006/#review2908

 M  +42 -16    main.cpp  


--- trunk/KDE/kdebase/runtime/plasma/tools/plasmapkg/main.cpp #1044425:1044426
@@ -109,12 +109,49 @@
     KApplication app;
 
     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
-    const QString type = args->getOption("type").toLower();
+    QString type = args->getOption("type").toLower();
     QString packageRoot = type;
     QString servicePrefix;
     QStringList pluginTypes;
     Plasma::PackageStructure *installer = 0;
+    QString package;
+    QString packageFile;
 
+    if (args->isSet("remove")) {
+        package = args->getOption("remove");
+    } else if (args->isSet("upgrade")) {
+        package = args->getOption("upgrade");
+    } else if (args->isSet("install")) {
+        package = args->getOption("install");
+    }
+    if (!QDir::isAbsolutePath(package)) {
+        packageFile = QDir(QDir::currentPath() + '/' + package).absolutePath();
+    } else {
+        packageFile = package;
+    }
+
+    if (!packageFile.isEmpty() && (!args->isSet("type") ||
+        type == i18nc("package type", "wallpaper") || type == "wallpaper")) {
+        // Check type for common plasma packages
+        Plasma::PackageStructure package;
+        package.setPath(packageFile);
+        QString serviceType = package.metadata().serviceType();
+        if (!serviceType.isEmpty()) {
+            if (serviceType == "Plasma/Applet" || serviceType == \
"Plasma/PopupApplet") { +                type = "plasmoid";
+            } else if (serviceType == "Plasma/DataEngine") {
+                type = "dataengine";
+            } else if (serviceType == "Plasma/Runner") {
+                type = "runner";
+            } else if (serviceType == "Plasma/Wallpaper") {
+                // This also changes type to wallpaperplugin when --type wallpaper
+                // was specified and we have wallpaper plugin package (instead of
+                // wallpaper image package)
+                type = "wallpaperplugin";
+            }
+        }
+    }
+
     if (type == i18nc("package type", "plasmoid") || type == "plasmoid") {
         packageRoot = "plasma/plasmoids/";
         servicePrefix = "plasma-applet-";
@@ -132,6 +169,10 @@
         packageRoot = "plasma/runners/";
         servicePrefix = "plasma-runner-";
         pluginTypes << "Runner";
+    } else if (type == i18nc("package type", "wallpaperplugin") || type == \
"wallpaperplugin") { +        packageRoot = "plasma/wallpapers/";
+        servicePrefix = "plasma-wallpaper-";
+        pluginTypes << "Wallpaper";
     } else {
         QString constraint = QString("'%1' == \
                [X-KDE-PluginInfo-Name]").arg(packageRoot);
         KService::List offers = \
KServiceTypeTrader::self()->query("Plasma/PackageStructure", constraint); @@ -172,21 \
                +213,6 @@
             packageRoot = KStandardDirs::locateLocal("data", packageRoot);
         }
 
-        QString package;
-        QString packageFile;
-        if (args->isSet("remove")) {
-            package = args->getOption("remove");
-        } else if (args->isSet("upgrade")) {
-            package = args->getOption("upgrade");
-        } else if (args->isSet("install")) {
-            package = args->getOption("install");
-        }
-        if (!QDir::isAbsolutePath(package)) {
-            packageFile = QDir(QDir::currentPath() + '/' + package).absolutePath();
-        } else {
-            packageFile = package;
-        }
-
         if (args->isSet("remove") || args->isSet("upgrade")) {
             installer->setPath(packageFile);
             Plasma::PackageMetadata metadata = installer->metadata();


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

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