From 916117cea198d7b971362814f568168dca5b4c92 Mon Sep 17 00:00:00 2001 From: amnon Date: Fri, 9 Jul 2010 17:32:44 +0000 Subject: [PATCH] proper fix-root-onlx-kcms.patch --- kdebase-workspace/PKGBUILD | 10 ++-- kdebase-workspace/fix_root-only-kcms.patch | 47 +++++++++++++++++++ .../fix_root-only-kcms.patch.fixme | 44 ----------------- 3 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 kdebase-workspace/fix_root-only-kcms.patch delete mode 100644 kdebase-workspace/fix_root-only-kcms.patch.fixme diff --git a/kdebase-workspace/PKGBUILD b/kdebase-workspace/PKGBUILD index 0615a1ebb..3060daa10 100644 --- a/kdebase-workspace/PKGBUILD +++ b/kdebase-workspace/PKGBUILD @@ -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 ..." diff --git a/kdebase-workspace/fix_root-only-kcms.patch b/kdebase-workspace/fix_root-only-kcms.patch new file mode 100644 index 000000000..f33049188 --- /dev/null +++ b/kdebase-workspace/fix_root-only-kcms.patch @@ -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 + #include + #include ++#include + #include + + #include "MenuItem.h" +@@ -131,6 +132,35 @@ + return; + } + ++ { ++ MenuItem *menuItemPtr = menuItem.data( Qt::UserRole ).value(); ++ 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 indexes; + for ( int done = 0; menuItem.model()->rowCount( menuItem ) > done; done = 1 + done ) { + indexes << menuItem.model()->index( done, 0, menuItem ); diff --git a/kdebase-workspace/fix_root-only-kcms.patch.fixme b/kdebase-workspace/fix_root-only-kcms.patch.fixme deleted file mode 100644 index 8751ef857..000000000 --- a/kdebase-workspace/fix_root-only-kcms.patch.fixme +++ /dev/null @@ -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 - #include - #include -+#include - #include - - #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 indexes; - for ( int done = 0; menuItem.model()->rowCount( menuItem ) > done; done = 1 + done ) {