proper fix-root-onlx-kcms.patch

This commit is contained in:
amnon 2010-07-09 17:32:44 +00:00
parent 3c2032bde6
commit ec216a6855
3 changed files with 52 additions and 49 deletions

View File

@ -26,7 +26,7 @@ pkgname=('kdebase-workspace'
arch=('i686' 'x86_64')
pkgver=${_kdever}
pkgrel=1.1
pkgrel=1.2
pkgdesc="split package"
url="http://www.kde.org"
@ -76,7 +76,7 @@ source=($_mirror/${_origname}-$_kdever.tar.bz2
fix_kdm_configdef.patch
# "fix" some sytemsettings modules that need root access
# FIXME fix_root-only-kcms.patch
fix_root-only-kcms.patch
# experimental, software transparency for plasma panels
# feature_plasma-transparent-panel-v4-rb#472.patch
@ -122,7 +122,7 @@ md5sums=('8dc81a878fe23220bef7bf2d386779d9' # kdebase-workspace-4.4.92.tar.bz2
'814350c52c135d6f7bdada1e29223d38' # fix_terminate-server.patch
'5d752cf39a28306438bb6d82db6e1696' # fix_ck-shutdown.patch
'97a5eb51e6f9d460f0d61bb322a1db5e' # fix_kdm_configdef.patch
# FIXME '6df4a57eb6b5b99df9ec21b76f07c027' # fix_root-only-kcms.patch
'5f963f80a026f0600edae1b1c70411e5' # fix_root-only-kcms.patch
# '13c3203589143e9e2fc757c17375227a' # feature_plasma-transparent-panel-v4-rb#472.patch
# '7361012da217f9aeeca61f0e9956e1d0' # feature_brightness-osd.patch
@ -165,8 +165,8 @@ build()
patch -Np0 -i ${srcdir}/fix_kdm-increase-xserver-timeout-bnc#462478.patch || return 1
patch -Np0 -i ${srcdir}/fix_terminate-server.patch || return 1
patch -Np1 -i ${srcdir}/fix_ck-shutdown.patch || return 1
patch -p0 -N -i ${srcdir}/kdm_configdef.patch || return 1
# patch -Np1 -i ${srcdir}/fix_root-only-kcms.patch || return 1
patch -p0 -N -i ${srcdir}/fix_kdm_configdef.patch || return 1
patch -Np1 -i ${srcdir}/fix_root-only-kcms.patch || return 1
# FIXME: update feature patches
# msg "applying feature patches ..."

View File

@ -0,0 +1,47 @@
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 <kauthaction.h>
#include "MenuItem.h"
@@ -131,6 +132,35 @@
return;
}
+ {
+ 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();
+
+ /* 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( 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::startDetached( kdesu, args );
+
+ return;
+ }
+ }
+
QList<QModelIndex> indexes;
for ( int done = 0; menuItem.model()->rowCount( menuItem ) > done; done = 1 + done ) {
indexes << menuItem.model()->index( done, 0, menuItem );

View File

@ -1,44 +0,0 @@
diff -Npur kdebase-workspace-4.4.92/systemsettings/core/ModuleView.cpp.orig kdebase-workspace-4.4.92/systemsettings/core/ModuleView.cpp
--- kdebase-workspace-4.4.92/systemsettings/core/ModuleView.cpp.orig 2010-07-07 19:10:09.000000000 +0200
+++ kdebase-workspace-4.4.92/systemsettings/core/ModuleView.cpp 2010-07-08 04:44:48.626089908 +0200
@@ -41,6 +41,7 @@
#include <KCModuleProxy>
#include <KStandardGuiItem>
#include <KDialogButtonBox>
+#include <KStandardDirs>
#include <kauthaction.h>
#include "MenuItem.h"
@@ -130,6 +131,32 @@ void ModuleView::loadModule( QModelIndex
if ( !menuItem.isValid() ) {
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<QModelIndex> indexes;
for ( int done = 0; menuItem.model()->rowCount( menuItem ) > done; done = 1 + done ) {