Hi,

I've made this patch with some directions from aseigo.

I wanted some kind of autorun settings for specific devices dependant on the 
media of optical drives; so i made a patch to recognize X-KDE-Autorun in 
.desktop file action entries.

this patch was for 4.5.90 and it builds. couldn't test it's functionality.

it can be tested by adding X-KDE-Autorun=true in a solid/actions/*.desktop file 
(in the "open" action eg)
Index: SOURCES/kdebase-workspace-4.5.90-add-autorun-ability.patch
===================================================================
--- SOURCES/kdebase-workspace-4.5.90-add-autorun-ability.patch	(revision 0)
+++ SOURCES/kdebase-workspace-4.5.90-add-autorun-ability.patch	(revision 0)
@@ -0,0 +1,57 @@
+diff -ru kdebase-workspace-4.5.90_old//plasma/generic/applets/devicenotifier/devicenotifier.cpp kdebase-workspace-4.5.90_new//plasma/generic/applets/devicenotifier/devicenotifier.cpp
+--- kdebase-workspace-4.5.90_old//plasma/generic/applets/devicenotifier/devicenotifier.cpp	2010-12-22 10:55:28.000000000 +0100
++++ kdebase-workspace-4.5.90_new//plasma/generic/applets/devicenotifier/devicenotifier.cpp	2011-01-05 01:55:16.275644602 +0100
+@@ -22,6 +22,8 @@
+ #include "devicenotifier.h"
+ 
+ //Qt
++#include <QDBusInterface>
++#include <QDBusReply>
+ #include <QGraphicsSceneContextMenuEvent>
+ 
+ //KDE
+@@ -32,6 +34,8 @@
+ #include <KCModuleProxy>
+ #include <KCModuleInfo>
+ #include <kdesktopfileactions.h>
++#include <KDesktopFile>
++#include <KConfigGroup>
+ 
+ //Plasma
+ #include <Plasma/ToolTipManager>
+@@ -74,11 +78,20 @@
+     QString lastActionLabel;
+     QStringList currentActions = m_dialog->deviceActions(udi);
+     QStringList newActions = data["predicateFiles"].toStringList();
++    QStringList autorunActions;
+ 
+     foreach (const QString &desktop, newActions) {
+         QString filePath = KStandardDirs::locate("data", "solid/actions/" + desktop);
++        const KDesktopFile cfg( filePath );
+         QList<KServiceAction> services = KDesktopFileActions::userDefinedServices(filePath, true);
+         numActions += services.size();
++        foreach (const KServiceAction &action, services) {
++            // check which option has autorun
++            const KConfigGroup cg = cfg.actionGroup(action.name());
++            if (cg.readEntry("X-KDE-Autorun", false) && !autorunActions.contains(desktop)) {
++                autorunActions.append(desktop);
++            }
++        }
+ 
+         if (!currentActions.contains(desktop)) {
+             m_dialog->insertAction(udi, desktop);
+@@ -89,6 +102,14 @@
+         }
+     }
+ 
++    if (!autorunActions.isEmpty()) {
++        //KDesktopFileActions::executeService(KUrl::List(), autorunActions.first());
++        kDebug() << "DeviceNotifier:: call Solid Ui Server with params :" << udi << "," << autorunActions;
++        QDBusInterface soliduiserver("org.kde.kded", "/modules/soliduiserver", "org.kde.SolidUiServer");
++        QDBusReply<void> reply = soliduiserver.call("showActionsDialog", udi, autorunActions);
++        return;
++    }
++
+     foreach (const QString &action, currentActions) {
+         if (!newActions.contains(action)) {
+             m_dialog->removeAction(udi, action);
Index: SPECS/kdebase4-workspace.spec
===================================================================
--- SPECS/kdebase4-workspace.spec	(revision 628654)
+++ SPECS/kdebase4-workspace.spec	(working copy)
@@ -17,7 +17,7 @@
 %if %branch
 Release: %mkrel -c %kde_snapshot 1
 %else
-Release: %mkrel 5
+Release: %mkrel 6
 %endif
 Epoch: 2
 Group: Graphical desktop/KDE
@@ -42,6 +42,7 @@
 Patch25: kdebase-workspace-4.4.0-kdm-fix-defaults.patch
 Patch26: kdebase-workspace-4.4.0-simpleapplet-mandriva-defaults.patch
 Patch31: kdebase-workspace-4.3.98-plasma-konsole.patch
+Patch32: kdebase-workspace-4.5.90-add-autorun-ability.patch
 # Backports
 # Trunk
 # Testing
@@ -1527,6 +1528,7 @@
 %patch13 -p0 -b .startup-sound
 %patch19 -p0
 %patch26 -p0
+%patch32 -p1
 
 %build
 %cmake_kde4 -DKDE4_XDMCP:BOOL=ON
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to