Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
python-kdebase4
systemsettings-root-kcm.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File systemsettings-root-kcm.diff of Package python-kdebase4
Index: systemsettings/core/ModuleView.cpp =================================================================== --- systemsettings/core/ModuleView.cpp.orig +++ systemsettings/core/ModuleView.cpp @@ -41,6 +41,7 @@ #include <KStandardGuiItem> #include <KDialogButtonBox> #include <kauthaction.h> +#include <KStandardDirs> #include "MenuItem.h" @@ -129,6 +130,40 @@ void ModuleView::loadModule( MenuItem *m return; } + if ( menuItem->needsRootPrivs() ) + { + QString kdesu = KStandardDirs::findExe( "kdesu" ); + //kDebug() << "kdesu path:" << 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; + if ( cmd.startsWith('/' ) ) + // call eg "/sbin/yast2" + args << "-i" << QString( menuItem->service()->icon() ) << "-c" << cmd; + else + 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(); Index: systemsettings/core/MenuItem.cpp =================================================================== --- systemsettings/core/MenuItem.cpp.orig +++ systemsettings/core/MenuItem.cpp @@ -43,6 +43,7 @@ public: int weight; KService::Ptr service; KCModuleInfo item; + bool needsRootPrivs; }; MenuItem::MenuItem( bool isMenu, MenuItem * itsParent ) @@ -50,6 +51,7 @@ MenuItem::MenuItem( bool isMenu, MenuIte { d->parent = itsParent; d->menu = isMenu; + d->needsRootPrivs = false; if ( d->parent ) { d->parent->children().append( this ); @@ -123,12 +125,18 @@ bool MenuItem::menu() const return d->menu; } +bool MenuItem::needsRootPrivs() const +{ + return d->needsRootPrivs; +} + void MenuItem::setService( const KService::Ptr& service ) { d->service = service; d->category = service->property("X-KDE-System-Settings-Category").toString(); d->name = service->name(); d->item = KCModuleInfo( service ); + d->needsRootPrivs = service->property("X-KDE-RootOnly", QVariant::Bool ).toBool(); const QVariant itemWeight = service->property( "X-KDE-Weight", QVariant::Int ); if( itemWeight.isValid() ) { d->weight = itemWeight.toInt(); Index: systemsettings/core/MenuItem.h =================================================================== --- systemsettings/core/MenuItem.h.orig +++ systemsettings/core/MenuItem.h @@ -155,6 +155,8 @@ public: */ void setService( const KService::Ptr& service ); + bool needsRootPrivs() const; + private: class Private; Private *const d;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor