]> git.pld-linux.org Git - packages/kde4-kdebase-workspace.git/blobdiff - kde4-kdebase-workspace-rootprivs.patch
- rebuild with polkit-qt-1
[packages/kde4-kdebase-workspace.git] / kde4-kdebase-workspace-rootprivs.patch
index 8d5f160da2aaeb62eb08159f119d5dda73ad653f..f330491886acf20c22df39b78a00a3812fcdd2a2 100644 (file)
@@ -1,69 +1,47 @@
-diff -ur kdebase-workspace-4.0.72/systemsettings/mainwindow.cpp kdebase-workspace-4.0.72-rootprivs/systemsettings/mainwindow.cpp
---- kdebase-workspace-4.0.72/systemsettings/mainwindow.cpp     2008-04-30 15:58:34.000000000 +0200
-+++ kdebase-workspace-4.0.72-rootprivs/systemsettings/mainwindow.cpp   2008-05-07 01:05:14.000000000 +0200
-@@ -27,6 +27,7 @@
- #include <QLayout>
- #include <QStackedWidget>
-+#include <QProcess>
- #include <KAction>
- #include <KActionCollection>
-@@ -42,6 +43,7 @@
- #include <KStandardAction>
- #include <KTabWidget>
- #include <kcategorizedsortfilterproxymodel.h>
+diff -ur kdebase-workspace-4.4.90/systemsettings/core/ModuleView.cpp kdebase-workspace-4.4.90-rootprivs/systemsettings/core/ModuleView.cpp
+--- kdebase-workspace-4.4.90/systemsettings/core/ModuleView.cpp        2010-06-24 18:28:10.000000000 +0200
++++ kdebase-workspace-4.4.90-rootprivs/systemsettings/core/ModuleView.cpp      2010-06-26 00:47:30.000000000 +0200
+@@ -41,6 +41,7 @@
+ #include <KCModuleProxy>
+ #include <KStandardGuiItem>
+ #include <KDialogButtonBox>
 +#include <KStandardDirs>
- #include <kcategorizedview.h>
- #include <kcategorydrawer.h>
- #include <kiconloader.h>
-@@ -297,9 +299,13 @@
-         return;
+ #include <kauthaction.h>
  
-     MenuItem * mItem = selected.data( Qt::UserRole ).value<MenuItem*>();
-+    bool needsRootPrivs = false;
-     if ( mItem ) {
-         kDebug() << "Selected item: " << mItem->service->name();
-         kDebug() << "Comment:       " << mItem->service->comment();
-+
-+        needsRootPrivs = mItem->service->property( "X-KDE-RootOnly", QVariant::Bool ).toBool();
-+        kDebug() << "Needs root privs:" << needsRootPrivs;
-     } else {
-         kDebug() << ":'( Got dud pointer from " << selected.data( Qt::DisplayRole ).toString();
-         Q_ASSERT(mItem); // Would core dump below. Do it now
-@@ -311,6 +317,35 @@
-     if ( groupWidget )
+ #include "MenuItem.h"
+@@ -131,6 +132,35 @@
          return;
+     }
  
-+    if ( needsRootPrivs )
 +    {
-+        QString kdesu = KStandardDirs::findExe( "kdesu" );
-+        //kDebug() << "kdesu path:" << kdesu;
++        MenuItem *menuItemPtr = menuItem.data( Qt::UserRole ).value<MenuItem*>();
++        if ( menuItemPtr->service()->property( "X-KDE-RootOnly", QVariant::Bool ).toBool() ) {
++            QString kdesu = KStandardDirs::findExe( "kdesu" );
++            QString cmd = menuItemPtr->service()->exec().trimmed();
 +
-+        QString cmd = mItem->service->exec().trimmed();
++            /* Prepare the process to run the kcmshell */
++            if ( cmd.left(5) == "kdesu" )
++            {
++                cmd = cmd.remove(0,5).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();
++            }
 +
-+            /* 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();
++            if ( cmd.left(9) == "kcmshell4" )
++                cmd = cmd.remove(0,9).trimmed();
 +
-+        QStringList args;
-+        args << "-c" << QString( "%1 %2 --lang %3" ).arg( KStandardDirs::locate("exe", "kcmshell4") ).arg( cmd ).arg( KGlobal::locale()->language() );
++            QStringList args;
++            args << "-i" << QString( menuItemPtr->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::execute( kdesu, args );
++            kDebug() << "Starting root module: " << args;
++            QProcess::startDetached( kdesu, args );
 +
-+        return;
++            return;
++        }
 +    }
 +
-     groupWidget = moduleItemToWidgetDict[mItem->service];
-     if( !groupWidget ) {
+     QList<QModelIndex> indexes;
+     for ( int done = 0; menuItem.model()->rowCount( menuItem ) > done; done = 1 + done ) {
+         indexes << menuItem.model()->index( done, 0, menuItem );
This page took 0.24816 seconds and 4 git commands to generate.