Blame SOURCES/kdebase-workspace-4.4.90-rootprivs.patch

b5cc75
diff -ur kdebase-workspace-4.4.90/systemsettings/core/ModuleView.cpp kdebase-workspace-4.4.90-rootprivs/systemsettings/core/ModuleView.cpp
b5cc75
--- kdebase-workspace-4.4.90/systemsettings/core/ModuleView.cpp	2010-06-24 18:28:10.000000000 +0200
b5cc75
+++ kdebase-workspace-4.4.90-rootprivs/systemsettings/core/ModuleView.cpp	2010-06-26 00:47:30.000000000 +0200
b5cc75
@@ -41,6 +41,7 @@
b5cc75
 #include <KCModuleProxy>
b5cc75
 #include <KStandardGuiItem>
b5cc75
 #include <KDialogButtonBox>
b5cc75
+#include <KStandardDirs>
b5cc75
 #include <kauthaction.h>
b5cc75
 
b5cc75
 #include "MenuItem.h"
b5cc75
@@ -131,6 +132,35 @@
b5cc75
         return;
b5cc75
     }
b5cc75
 
b5cc75
+    {
b5cc75
+        MenuItem *menuItemPtr = menuItem.data( Qt::UserRole ).value<MenuItem*>();
b5cc75
+        if ( menuItemPtr->service()->property( "X-KDE-RootOnly", QVariant::Bool ).toBool() ) {
b5cc75
+            QString kdesu = KStandardDirs::findExe( "kdesu" );
b5cc75
+            QString cmd = menuItemPtr->service()->exec().trimmed();
b5cc75
+
b5cc75
+            /* Prepare the process to run the kcmshell */
b5cc75
+            if ( cmd.left(5) == "kdesu" )
b5cc75
+            {
b5cc75
+                cmd = cmd.remove(0,5).trimmed();
b5cc75
+
b5cc75
+                /* Remove all kdesu switches */
b5cc75
+                while ( cmd.length() > 1 && cmd[ 0 ] == '-' )
b5cc75
+                    cmd = cmd.remove( 0, cmd.indexOf( ' ' ) ).trimmed();
b5cc75
+            }
b5cc75
+
b5cc75
+            if ( cmd.left(9) == "kcmshell4" )
b5cc75
+                cmd = cmd.remove(0,9).trimmed();
b5cc75
+
b5cc75
+            QStringList args;
b5cc75
+            args << "-i" << QString( menuItemPtr->service()->icon() ) << "-c" << QString( "%1 %2 --lang %3" ).arg( KStandardDirs::locate("exe", "kcmshell4") ).arg( cmd ).arg( KGlobal::locale()->language() );
b5cc75
+
b5cc75
+            kDebug() << "Starting root module: " << args;
b5cc75
+            QProcess::startDetached( kdesu, args );
b5cc75
+
b5cc75
+            return;
b5cc75
+        }
b5cc75
+    }
b5cc75
+
b5cc75
     QList<QModelIndex> indexes;
b5cc75
     for ( int done = 0; menuItem.model()->rowCount( menuItem ) > done; done = 1 + done ) {
b5cc75
         indexes << menuItem.model()->index( done, 0, menuItem );