[PC-BSD Commits] r4762 - pcbsd/trunk/ServiceManager
svn at pcbsd.org
svn at pcbsd.org
Mon Oct 26 08:44:00 PST 2009
Author: kris
Date: 2009-10-26 09:44:00 -0700 (Mon, 26 Oct 2009)
New Revision: 4762
Added:
pcbsd/trunk/ServiceManager/pcbsdservices.desktop
Modified:
pcbsd/trunk/ServiceManager/kcm.cpp
pcbsd/trunk/ServiceManager/notroot.cpp
pcbsd/trunk/ServiceManager/notroot.h
pcbsd/trunk/ServiceManager/servicemanager.pro
Log:
Updated pcbsdservice manager, install i18n data automatically and fix loading i18n as root
Modified: pcbsd/trunk/ServiceManager/kcm.cpp
===================================================================
--- pcbsd/trunk/ServiceManager/kcm.cpp 2009-10-26 16:27:32 UTC (rev 4761)
+++ pcbsd/trunk/ServiceManager/kcm.cpp 2009-10-26 16:44:00 UTC (rev 4762)
@@ -4,6 +4,8 @@
#include <klocale.h>
#include <kglobal.h>
#include <kgenericfactory.h>
+#include <kapplication.h>
+#include <QTranslator>
#include "servicemanager.h"
#include "notroot.h"
#include <kcm.h>
@@ -22,10 +24,11 @@
buttons();
- QString LANG="ServiceManager";
- KGlobal::locale()->insertCatalog(LANG);
+ QString locale = KGlobal::locale()->language();
+ QTranslator translator;
+ translator.load(QString("ServiceManager_") + locale, "/usr/local/kde4/share/apps/pcbsd/i18n/");
+ KApplication::installTranslator(&translator);
-
if ( checkRoot() )
{
buttons();
@@ -49,31 +52,7 @@
bool PCBSDSERVICEMANAGER::checkRoot() {
-
- FILE *file = popen("whoami","r");
-
- char buffer[100];
-
- QString line = "";
- char firstChar;
-
- if ((firstChar = fgetc(file)) != -1){
- line += firstChar;
- line += fgets(buffer,100,file);
- }
-
- pclose(file);
-
- //QMessageBox::critical( 0, "Application name here", "Username: " + line );
-
-
- sleep(1);
- if ( line.indexOf("root") == -1)
- {
- return FALSE;
- } else {
- return TRUE;
- }
+ return ( getuid() == 0 );
}
Modified: pcbsd/trunk/ServiceManager/notroot.cpp
===================================================================
--- pcbsd/trunk/ServiceManager/notroot.cpp 2009-10-26 16:27:32 UTC (rev 4761)
+++ pcbsd/trunk/ServiceManager/notroot.cpp 2009-10-26 16:44:00 UTC (rev 4762)
@@ -27,6 +27,8 @@
***************************************************************************/
#include "notroot.h"
#include "ui_notroot.h"
+#include <kglobal.h>
+#include <klocale.h>
void NotRoot::programInit()
{
@@ -38,13 +40,9 @@
void NotRoot::slotLaunchAdmin()
{
- // Launch the kcmshell4 process as root
- QString prog = "kdesu";
- QStringList args;
- args << "kcmshell4" << "pcbsdservices";
- launchAdminProc = new QProcess( this );
-
- launchAdminProc->start(prog, args);
+ QString locale = KGlobal::locale()->language();
+
+ QString prog = "kdesu 'kcmshell4 --lang " + locale + " pcbsdservices' &";
+ system( prog.toLatin1() );
}
-
Modified: pcbsd/trunk/ServiceManager/notroot.h
===================================================================
--- pcbsd/trunk/ServiceManager/notroot.h 2009-10-26 16:27:32 UTC (rev 4761)
+++ pcbsd/trunk/ServiceManager/notroot.h 2009-10-26 16:44:00 UTC (rev 4762)
@@ -25,7 +25,6 @@
void slotLaunchAdmin();
private:
- QProcess *launchAdminProc;
signals:
Modified: pcbsd/trunk/ServiceManager/servicemanager.pro
===================================================================
--- pcbsd/trunk/ServiceManager/servicemanager.pro 2009-10-26 16:27:32 UTC (rev 4761)
+++ pcbsd/trunk/ServiceManager/servicemanager.pro 2009-10-26 16:44:00 UTC (rev 4762)
@@ -78,6 +78,14 @@
FORMS = servicemanager.ui \
notroot.ui
+desktop.path=/usr/local/kde4/share/kde4/services/
+desktop.files=pcbsdservices.desktop
+
+dotrans.path=/usr/local/kde4/share/apps/pcbsd/i18n/
+dotrans.extra=cd i18n && lrelease-qt4 *.ts && cp *.qm /usr/local/kde4/share/apps/pcbsd/i18n/
+
+INSTALLS += dotrans desktop
+
RESOURCES += servicemanager.qrc
QMAKE_LIBDIR = /usr/local/kde4/lib /usr/local/lib/qt4 /usr/local/lib
More information about the Commits
mailing list