Language settings from LANG enviroment variable (bug #6136)
authorArto Hyvättinen <arto.hyvattinen@gmail.com>
Fri, 13 Aug 2010 09:57:09 +0000 (12:57 +0300)
committerArto Hyvättinen <arto.hyvattinen@gmail.com>
Fri, 13 Aug 2010 09:57:09 +0000 (12:57 +0300)
src/main.cpp
src/urpomainwindow.cpp

index b3d18c3..7dc70d5 100644 (file)
@@ -1,7 +1,8 @@
 #include <QtGui/QApplication>
 #include <QTranslator>
 #include "urpomainwindow.h"
-#include <QLocale>
+#include <QString>
+#include <cstdlib>
 
 /*! @mainpage Urpo - Unix Remote Printing Operation
 
@@ -23,7 +24,10 @@ int main(int argc, char *argv[])
     QApplication a(argc, argv);
 
     QTranslator appTranslator;
-    appTranslator.load("urpo_" + QLocale::system().name(),":/");
+    // using LANG enviroment variable instead of QLocale because of Qt on Maemo problem
+    // bug #6136
+    QString language = std::getenv("LANG");
+    appTranslator.load("urpo_" + language.toLower() ,":/");
     a.installTranslator(&appTranslator);
 
     UrpoMainWindow w;
index b251b8a..40d23fb 100644 (file)
@@ -36,6 +36,9 @@
 #include <QUrl>
 #include <QLocale>
 #include <QFile>
+
+#include <cstdlib>
+
 #include "settingsdialog.h"
 
 #define VERSION "0.9"   /*! Program version */
@@ -44,6 +47,7 @@ UrpoMainWindow::UrpoMainWindow(QWidget *parent)
     : QMainWindow(parent)
 {
     setWindowTitle(QString("URPO ") + VERSION );
+    setWindowIcon( QIcon(":/urpo.png"));
 
     // Load connection settings
     settings_ = new UrpoConnectionSettings("Urpo","Urpo");
@@ -134,14 +138,22 @@ void UrpoMainWindow::initMenu()
 void UrpoMainWindow::initHelp()
 {
 
+
+
     // Init help
     helpBrowser_ = new QTextBrowser();
     helpBrowser_->setWindowTitle(tr("Urpo Help"));
 
     // Load help file
     // Try to load locale version index_fi etc.
-    QString language=QLocale::system().name().left(2);
-    QString helpfilename = QString(":/help/index_") + language + QString(".html");
+
+    // using LANG enviroment variable instead of QLocale because of Qt on Maemo problem
+    // bug #6136
+    QString language = std::getenv("LANG");
+
+    QString helpfilename = QString(":/help/index_") + language.left(2).toLower() + QString(".html");
+
+    monitor_->debugMessage(helpfilename);
 
     QFile helpfile( helpfilename );
     if( helpfile.exists() )