desktop/kdebase-workspace/fix_root-only-kcms.patch
2010-05-21 22:25:44 +00:00

55 lines
2.1 KiB
Diff

diff -U5 -r kdebase-workspace-4.3.75svn1048496/systemsettings/core/ModuleView.cpp kdebase-workspace-4.3.75svn1048496.rootprivs/systemsettings/core/ModuleView.cpp
--- kdebase-workspace-4.3.75svn1048496/systemsettings/core/ModuleView.cpp 2009-10-26 05:14:41.000000000 -0400
+++ kdebase-workspace-4.3.75svn1048496.rootprivs/systemsettings/core/ModuleView.cpp 2009-11-21 06:07:10.000000000 -0500
@@ -38,10 +38,11 @@
#include <KMessageBox>
#include <KCModuleInfo>
#include <KCModuleProxy>
#include <KStandardGuiItem>
#include <KDialogButtonBox>
+#include <KStandardDirs>
#include <kauthaction.h>
#include "MenuItem.h"
class ModuleView::Private {
@@ -122,10 +123,36 @@
{
if ( !menuItem ) {
return;
}
+ if ( menuItem->service()->property( "X-KDE-RootOnly", QVariant::Bool ).toBool() ) {
+ QString kdesu = KStandardDirs::findExe( "kdesu" );
+ QString cmd = menuItem->service()->exec().trimmed();
+
+ /* Prepare the process to run the kcmshell */
+ if ( cmd.left(5) == "kdesu" )
+ {
+ cmd = cmd.remove(0,5).trimmed();
+
+ /* Remove all kdesu switches */
+ while ( cmd.length() > 1 && cmd[ 0 ] == '-' )
+ cmd = cmd.remove( 0, cmd.indexOf( ' ' ) ).trimmed();
+ }
+
+ if ( cmd.left(9) == "kcmshell4" )
+ cmd = cmd.remove(0,9).trimmed();
+
+ QStringList args;
+ args << "-i" << QString( menuItem->service()->icon() ) << "-c" << QString( "%1 %2 --lang %3" ).arg( KStandardDirs::locate("exe", "kcmshell4") ).arg( cmd ).arg( KGlobal::locale()->language() );
+
+ kDebug() << "Starting root module: " << args;
+ QProcess::startDetached( kdesu, args );
+
+ return;
+ }
+
QList<KCModuleInfo*> modules;
if ( menuItem->children().empty() ) {
modules << &menuItem->item();
} else {
foreach ( MenuItem *child, menuItem->children() ) {
Only in kdebase-workspace-4.3.75svn1048496.rootprivs/systemsettings/core: ModuleView.cpp.orig
Only in kdebase-workspace-4.3.75svn1048496.rootprivs/systemsettings/core: ModuleView.cpp.rej