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

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