分页: 1 / 1

[问题]KDE4怎么修改成正常时间

发表于 : 2008-06-29 16:41
youout
KUBUNTU4怎么设置时间为正常的时间呀!!!

发表于 : 2008-06-29 17:34
nihui
一个缺失的功能.........

代码: 全选

/usr/lib/kde4/bin/kdesu systemsettings

发表于 : 2008-06-29 17:36
eexpress
这么复杂的界面,设置个时间。难怪影响开发进度。泥灰上吧。

发表于 : 2008-06-29 18:45
nihui
eexpress 写了:这么复杂的界面,设置个时间。难怪影响开发进度。泥灰上吧。
补丁早就有了..............可是 kubuntu team 没有用.... :(

代码: 全选

diff -ur kdebase-workspace-4.0.72/systemsettings/mainwindow.cpp kdebase-workspace-4.0.72-rootprivs/systemsettings/mainwindow.cpp
--- kdebase-workspace-4.0.72/systemsettings/mainwindow.cpp      2008-04-30 15:58:34.000000000 +0200
+++ kdebase-workspace-4.0.72-rootprivs/systemsettings/mainwindow.cpp    2008-05-07 01:05:14.000000000 +0200
@@ -27,6 +27,7 @@
 
 #include <QLayout>
 #include <QStackedWidget>
+#include <QProcess>
 
 #include <KAction>
 #include <KActionCollection>
@@ -42,6 +43,7 @@
 #include <KStandardAction>
 #include <KTabWidget>
 #include <kcategorizedsortfilterproxymodel.h>
+#include <KStandardDirs>
 #include <kcategorizedview.h>
 #include <kcategorydrawer.h>
 #include <kiconloader.h>
@@ -297,9 +299,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();
         Q_ASSERT(mItem); // Would core dump below. Do it now
@@ -311,6 +317,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 ) {

发表于 : 2008-06-30 14:11
youout
谢谢!!! :D

发表于 : 2008-08-19 13:37
lemonade
四楼的,能给个完全的代码吗?

发表于 : 2008-08-19 18:07
zhong
eexpress 写了:这么复杂的界面,设置个时间。难怪影响开发进度。泥灰上吧。
是你自己觉得复杂...........日期..时间..时区..就三个设置..何来复杂一说? 可笑

发表于 : 2008-08-19 19:40
lemonade
楼主可以在shell中修改时间:date -s
不过要重启,不然apt不能使用。

发表于 : 2008-08-19 22:44
zhangqiang
在BIOS里面改了就是了。呵呵,偶就是这样做的。

发表于 : 2008-08-20 2:02
fortruth
eexpress 写了:这么复杂的界面,设置个时间。难怪影响开发进度。泥灰上吧。
人家,刚回来,先让人家休息休息.!
老久不见,小泥灰.了 ..怎么样. 定好了上哪个大了么???

Re: [问题]KDE4怎么修改成正常时间

发表于 : 2009-05-02 10:07
popzkk
用root登录试试。或许可以。

Re: [问题]KDE4怎么修改成正常时间

发表于 : 2009-05-02 18:48
nihui
过期,锁掉...

最新的 KDE4 已经没有这个问题了。