[PC-BSD Commits] r4758 - pcbsd/trunk/kcmPBSystem

svn at pcbsd.org svn at pcbsd.org
Mon Oct 26 08:08:41 PST 2009


Author: kris
Date: 2009-10-26 09:08:41 -0700 (Mon, 26 Oct 2009)
New Revision: 4758

Added:
   pcbsd/trunk/kcmPBSystem/pcbsdsystem.desktop
Modified:
   pcbsd/trunk/kcmPBSystem/PBSystem.pro
   pcbsd/trunk/kcmPBSystem/kcm.cpp
   pcbsd/trunk/kcmPBSystem/notroot.cpp
   pcbsd/trunk/kcmPBSystem/notroot.h
Log:

Updated System Manager to generate / install i18n during install time, and load it properly



Modified: pcbsd/trunk/kcmPBSystem/PBSystem.pro
===================================================================
--- pcbsd/trunk/kcmPBSystem/PBSystem.pro	2009-10-26 16:07:23 UTC (rev 4757)
+++ pcbsd/trunk/kcmPBSystem/PBSystem.pro	2009-10-26 16:08:41 UTC (rev 4758)
@@ -82,6 +82,18 @@
 		i18n/PBSystem_zh_TW.ts \
 		i18n/PBSystem_zu.ts
 
+service.path=/usr/local/kde4/share/kde4/services/
+service.files=pcbsdsystem.desktop
+
+lang.path=/usr/local/kde4/share/apps/pcbsd/i18n/
+lang.files=i18n/*.qm
+
+dotrans.extra=cd i18n && lrelease-qt4 *.ts
+dotrans.path = i18n/
+dotrans.target = dotrans
+
+INSTALLS += dotrans lang service
+
 QMAKE_LIBDIR = /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
 
 QT += qt3support

Modified: pcbsd/trunk/kcmPBSystem/kcm.cpp
===================================================================
--- pcbsd/trunk/kcmPBSystem/kcm.cpp	2009-10-26 16:07:23 UTC (rev 4757)
+++ pcbsd/trunk/kcmPBSystem/kcm.cpp	2009-10-26 16:08:41 UTC (rev 4758)
@@ -3,11 +3,13 @@
 #include <klocale.h>
 #include <kglobal.h>
 #include <kgenericfactory.h>
+#include <kapplication.h>
 #include "notroot.h"
 #include <kcm.h>
 #include <pcbsd-utils.h>
 #include "pbsystemtab.h"
 #include <qstring.h>
+#include <QTranslator>
 
 K_PLUGIN_FACTORY(PCBSDSysFactory,
                  registerPlugin<PCBSDKCModule>();
@@ -22,8 +24,11 @@
 {
   layout = new QGridLayout(this);
   layout->setAutoAdd(true);
-  QString LANG="PBSystem";
-  KGlobal::locale()->insertCatalog(LANG);
+
+  QString locale = KGlobal::locale()->language();
+  QTranslator translator;
+  translator.load(QString("PBSystem_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
+  KApplication::installTranslator(&translator);
   
   buttons();
   setButtons(KCModule::Apply);

Modified: pcbsd/trunk/kcmPBSystem/notroot.cpp
===================================================================
--- pcbsd/trunk/kcmPBSystem/notroot.cpp	2009-10-26 16:07:23 UTC (rev 4757)
+++ pcbsd/trunk/kcmPBSystem/notroot.cpp	2009-10-26 16:08:41 UTC (rev 4758)
@@ -3,6 +3,9 @@
 #include <Q3ValueList>
 #include <QPixmap>
 #include <QTimer>
+#include <QProcess>
+#include <kglobal.h>
+#include <klocale.h>
 /***************************************************************************
  *   Copyright (C) 2006 - 2008 PC-BSD Software   *
  *   kris at pcbsd.com  *
@@ -40,15 +43,11 @@
 
 void NotRoot::slotLaunchAdmin()
 {
-    // Launch the kcmshell4 process as root
-    launchAdminProc = new Q3Process( this );
-    launchAdminProc->addArgument( "kdesu" );
-    launchAdminProc->addArgument( "kcmshell4" );
-    launchAdminProc->addArgument( "pcbsdsystem" );
- 
-    if ( !launchAdminProc->start() ) {
- 
-    }
+   QString locale = KGlobal::locale()->language();
+
+   QString prog = "kdesu 'kcmshell4 --lang " + locale + " pcbsdsystem' &";
+   system( prog.toLatin1() );
+
 }
 
 

Modified: pcbsd/trunk/kcmPBSystem/notroot.h
===================================================================
--- pcbsd/trunk/kcmPBSystem/notroot.h	2009-10-26 16:07:23 UTC (rev 4757)
+++ pcbsd/trunk/kcmPBSystem/notroot.h	2009-10-26 16:08:41 UTC (rev 4758)
@@ -4,7 +4,7 @@
 #include <qfile.h>
 #include <qmessagebox.h>
 #include <qdialog.h>
-#include <Q3Process>
+#include <QProcess>
 #include "ui_notroot.h"
 
 class NotRoot : public QDialog, private Ui::NotRoot
@@ -25,7 +25,7 @@
 	void slotLaunchAdmin();
 
 private:
-	Q3Process *launchAdminProc;
+	QProcess *launchAdminProc;
 
 signals:
 



More information about the Commits mailing list