[PC-BSD Commits] r4756 - pcbsd/trunk/kcmPFManager

svn at pcbsd.org svn at pcbsd.org
Mon Oct 26 07:25:56 PST 2009


Author: kris
Date: 2009-10-26 08:25:56 -0700 (Mon, 26 Oct 2009)
New Revision: 4756

Modified:
   pcbsd/trunk/kcmPFManager/kcm.cpp
   pcbsd/trunk/kcmPFManager/notroot.cpp
   pcbsd/trunk/kcmPFManager/notroot.h
   pcbsd/trunk/kcmPFManager/pfmanager.pro
Log:

Fixed up the PF manager to create / install i18n data automatically, and load it properly when running via kdesu



Modified: pcbsd/trunk/kcmPFManager/kcm.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/kcm.cpp	2009-10-26 13:29:26 UTC (rev 4755)
+++ pcbsd/trunk/kcmPFManager/kcm.cpp	2009-10-26 15:25:56 UTC (rev 4756)
@@ -1,10 +1,11 @@
-
 #include <klocale.h>
 #include <kglobal.h>
 #include <kgenericfactory.h>
+#include <kapplication.h>
 #include <qprocess.h>
 #include <qmessagebox.h>
 #include <qlayout.h>
+#include <QTranslator>
 #include "kcm.hpp"
 #include "pfmanagerdlg.hpp"
 #include "ui_mainwindow.h"
@@ -25,7 +26,11 @@
 
   buttons();
   QString LANG="PFManager";
-  KGlobal::locale()->insertCatalog(LANG);
+ 
+  QString locale = KGlobal::locale()->language();
+  QTranslator translator;
+  translator.load(QString("PFManager_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
+  KApplication::installTranslator(&translator);
 
 
 

Modified: pcbsd/trunk/kcmPFManager/notroot.cpp
===================================================================
--- pcbsd/trunk/kcmPFManager/notroot.cpp	2009-10-26 13:29:26 UTC (rev 4755)
+++ pcbsd/trunk/kcmPFManager/notroot.cpp	2009-10-26 15:25:56 UTC (rev 4756)
@@ -1,8 +1,11 @@
 //Added by qt3to4:
 #include <Q3TextStream>
 #include <Q3ValueList>
+#include <QProcess>
 #include <QPixmap>
 #include <QTimer>
+#include <kglobal.h>
+#include <klocale.h>
 /***************************************************************************
  *   Copyright (C) 2006 - 2008 PC-BSD Software   *
  *   kris at pcbsd.com  *
@@ -37,15 +40,15 @@
 
 void NotRoot::slotLaunchAdmin()
 {
+    QString locale = KGlobal::locale()->language();
+
     // Launch the kcmshell4 process as root
-    launchAdminProc = new Q3Process( this );
-    launchAdminProc->addArgument( "kdesu" );
-    launchAdminProc->addArgument( "kcmshell4" );
-    launchAdminProc->addArgument( "pfmanager" );
+    QString prog = "kdesu";
+    QStringList args;
+    args << "kcmshell4" << "--lang" << locale << "pfmanager";
  
-    if ( !launchAdminProc->start() ) {
- 
-    }
+    launchAdminProc = new QProcess( this );
+    launchAdminProc->start(prog,args);
 }
 
 

Modified: pcbsd/trunk/kcmPFManager/notroot.h
===================================================================
--- pcbsd/trunk/kcmPFManager/notroot.h	2009-10-26 13:29:26 UTC (rev 4755)
+++ pcbsd/trunk/kcmPFManager/notroot.h	2009-10-26 15:25:56 UTC (rev 4756)
@@ -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:
 

Modified: pcbsd/trunk/kcmPFManager/pfmanager.pro
===================================================================
--- pcbsd/trunk/kcmPFManager/pfmanager.pro	2009-10-26 13:29:26 UTC (rev 4755)
+++ pcbsd/trunk/kcmPFManager/pfmanager.pro	2009-10-26 15:25:56 UTC (rev 4756)
@@ -106,13 +106,17 @@
 
 kcm.path=/usr/local/kde4/lib/kde4/
 kcm.files=kcm_pfmanager.la
-kcm.extra=cp -f libkcm_pfmanager.so.1.0.0 /usr/local/kde4/lib/kde4/kcm_pfmanager.so
+kcm.extra=ln -fs /usr/local/kde4/lib/kde4/libkcm_pfmanager.so.1.0.0 /usr/local/kde4/lib/kde4/kcm_pfmanager.so
 
-lang.path=/usr/PCBSD/LANGS/
-lang.files=PFManager_en.ts PFManager_de.ts
+lang.path=/usr/local/kde4/share/apps/pcbsd/i18n/
+lang.files=i18n/*.qm
 
-INSTALLS += lang desktop kcm
+dotrans.extra=cd i18n && lrelease-qt4 *.ts
+dotrans.path = i18n/
+dotrans.target = dotrans
 
+INSTALLS += dotrans lang desktop kcm
+
 QMAKE_LIBDIR = /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
 
 



More information about the Commits mailing list