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

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