1 |
jmbsvicetto 08/10/02 11:53:23 |
2 |
|
3 |
Added: systemsettings-enable-admin-mode.patch |
4 |
Log: |
5 |
Added a missing patch file. |
6 |
(Portage version: 2.2_rc11/cvs/Linux 2.6.26-gentoo-r1 x86_64) |
7 |
|
8 |
Revision Changes Path |
9 |
1.1 kde-base/systemsettings/files/systemsettings-enable-admin-mode.patch |
10 |
|
11 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/kde-base/systemsettings/files/systemsettings-enable-admin-mode.patch?rev=1.1&view=markup |
12 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/kde-base/systemsettings/files/systemsettings-enable-admin-mode.patch?rev=1.1&content-type=text/plain |
13 |
|
14 |
Index: systemsettings-enable-admin-mode.patch |
15 |
=================================================================== |
16 |
--- systemsettings-4.1.0/systemsettings/mainwindow.cpp.orig 2008-06-10 15:41:03.000000000 +0400 |
17 |
+++ systemsettings-4.1.0/systemsettings/mainwindow.cpp 2008-07-25 15:43:14.000000000 +0400 |
18 |
@@ -27,6 +27,7 @@ |
19 |
|
20 |
#include <QLayout> |
21 |
#include <QStackedWidget> |
22 |
+#include <QProcess> |
23 |
|
24 |
#include <KAction> |
25 |
#include <KActionCollection> |
26 |
@@ -42,6 +43,7 @@ |
27 |
#include <KStandardAction> |
28 |
#include <KTabWidget> |
29 |
#include <kcategorizedsortfilterproxymodel.h> |
30 |
+#include <KStandardDirs> |
31 |
#include <kcategorizedview.h> |
32 |
#include <kcategorydrawer.h> |
33 |
#include <kiconloader.h> |
34 |
@@ -299,9 +301,13 @@ |
35 |
return; |
36 |
|
37 |
MenuItem * mItem = selected.data( Qt::UserRole ).value<MenuItem*>(); |
38 |
+ bool needsRootPrivs = false; |
39 |
if ( mItem ) { |
40 |
kDebug() << "Selected item: " << mItem->service->name(); |
41 |
kDebug() << "Comment: " << mItem->service->comment(); |
42 |
+ |
43 |
+ needsRootPrivs = mItem->service->property( "X-KDE-RootOnly", QVariant::Bool ).toBool(); |
44 |
+ kDebug() << "Needs root privs:" << needsRootPrivs; |
45 |
} else { |
46 |
kDebug() << ":'( Got dud pointer from " << selected.data( Qt::DisplayRole ).toString(); |
47 |
Q_ASSERT(mItem); // Would core dump below. Do it now |
48 |
@@ -313,6 +319,35 @@ |
49 |
if ( groupWidget ) |
50 |
return; |
51 |
|
52 |
+ if ( needsRootPrivs ) |
53 |
+ { |
54 |
+ QString kdesu = KStandardDirs::findExe( "kdesu" ); |
55 |
+ //kDebug() << "kdesu path:" << kdesu; |
56 |
+ |
57 |
+ QString cmd = mItem->service->exec().trimmed(); |
58 |
+ |
59 |
+ /* Prepare the process to run the kcmshell */ |
60 |
+ if ( cmd.left(5) == "kdesu" ) |
61 |
+ { |
62 |
+ cmd = cmd.remove(0,5).trimmed(); |
63 |
+ |
64 |
+ /* Remove all kdesu switches */ |
65 |
+ while ( cmd.length() > 1 && cmd[ 0 ] == '-' ) |
66 |
+ cmd = cmd.remove( 0, cmd.indexOf( ' ' ) ).trimmed(); |
67 |
+ } |
68 |
+ |
69 |
+ if ( cmd.left(9) == "kcmshell4" ) |
70 |
+ cmd = cmd.remove(0,9).trimmed(); |
71 |
+ |
72 |
+ QStringList args; |
73 |
+ args << "-c" << QString( "%1 %2 --lang %3" ).arg( KStandardDirs::locate("exe", "kcmshell4") ).arg( cmd ).arg( KGlobal::locale()->language() ); |
74 |
+ |
75 |
+ kDebug() << "Starting root module: " << args; |
76 |
+ QProcess::execute( kdesu, args ); |
77 |
+ |
78 |
+ return; |
79 |
+ } |
80 |
+ |
81 |
groupWidget = moduleItemToWidgetDict[mItem->service]; |
82 |
|
83 |
if( !groupWidget ) { |