rpms/kdebase-workspace/devel kdebase-workspace-4.0.3-rootprivs.patch, NONE, 1.1 kdebase-workspace-4.0.3-timedate-kcm.patch, NONE, 1.1

Lukas Tinkl (ltinkl) fedora-extras-commits at redhat.com
Tue Apr 15 16:37:03 UTC 2008


Author: ltinkl

Update of /cvs/extras/rpms/kdebase-workspace/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv7504

Added Files:
	kdebase-workspace-4.0.3-rootprivs.patch 
	kdebase-workspace-4.0.3-timedate-kcm.patch 
Log Message:
workaround #434824: KDE4 System Settings - No Method To Enter Administrative Mode


kdebase-workspace-4.0.3-rootprivs.patch:

--- NEW FILE kdebase-workspace-4.0.3-rootprivs.patch ---
Index: workspace/systemsettings/mainwindow.cpp
===================================================================
--- systemsettings/mainwindow.cpp	(revision 780207)
+++ systemsettings/mainwindow.cpp	(working copy)
@@ -26,6 +26,7 @@
 #include <QLayout>
 #include <QScrollArea>
 #include <QStackedWidget>
+#include <QProcess>
 
 #include <KAboutApplicationDialog>
 #include <KActionCollection>
@@ -45,6 +46,7 @@
 #include <KToggleToolBarAction>
 #include <KToolBarSpacerAction>
 #include <kcategorizedsortfilterproxymodel.h>
+#include <KStandardDirs>
 
 #include "kcategorizedview.h"
 #include "kcategorydrawer.h"
@@ -83,7 +85,7 @@
 QSize MainWindow::sizeHint() const
 {
     return QSize(780, 580);
-}	
+}
 
 void MainWindow::readMenu( MenuItem * parent )
 {
@@ -346,9 +348,13 @@
         return;
 
     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();
     }
@@ -358,6 +364,35 @@
     if ( groupWidget )
         return;
 
+    if ( needsRootPrivs )
+    {
+        QString kdesu = KStandardDirs::findExe( "kdesu" );
+        //kDebug() << "kdesu path:" << kdesu;
+
+        QString cmd = mItem->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 << "-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 );
+
+        return;
+    }
+
     groupWidget = moduleItemToWidgetDict[mItem->service];
 
     if( !groupWidget ) {

kdebase-workspace-4.0.3-timedate-kcm.patch:

--- NEW FILE kdebase-workspace-4.0.3-timedate-kcm.patch ---
Index: workspace/kcontrol/dateandtime/clock.desktop
===================================================================
--- kcontrol/dateandtime/clock.desktop	(revision 780224)
+++ kcontrol/dateandtime/clock.desktop	(working copy)
@@ -1,5 +1,5 @@
 [Desktop Entry]
-Exec=kcmshell4 kde-clock.desktop
+Exec=kcmshell4 clock
 Icon=preferences-system-time
 Type=Service
 X-KDE-ServiceTypes=KCModule




More information about the fedora-extras-commits mailing list