summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
Unidiff
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp40
1 files changed, 11 insertions, 29 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index 70ffec1..4dbfbd8 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -14,16 +14,17 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19** $Id$ 19** $Id$
20** 20**
21**********************************************************************/ 21**********************************************************************/
22#define QTOPIA_INTERNAL_LANGLIST
22#include <stdlib.h> 23#include <stdlib.h>
23#include <unistd.h> 24#include <unistd.h>
24#include <qfile.h> 25#include <qfile.h>
25#ifdef Q_WS_QWS 26#ifdef Q_WS_QWS
26#ifndef QT_NO_COP 27#ifndef QT_NO_COP
27#if QT_VERSION <= 231 28#if QT_VERSION <= 231
28#define private public 29#define private public
29#define sendLocally processEvent 30#define sendLocally processEvent
@@ -132,32 +133,17 @@ public:
132 qcopq.clear(); 133 qcopq.clear();
133 } 134 }
134}; 135};
135 136
136class ResourceMimeFactory : public QMimeSourceFactory { 137class ResourceMimeFactory : public QMimeSourceFactory {
137public: 138public:
138 ResourceMimeFactory() 139 ResourceMimeFactory()
139 { 140 {
140 QStringList path; 141 setFilePath( Global::helpPath() );
141 QString lang = getenv("LANG");
142 if ( !lang.isEmpty() )
143 path += QPEApplication::qpeDir() + "/help/" + lang + "/html";
144 path += QPEApplication::qpeDir() + "/pics";
145 path += QPEApplication::qpeDir() + "/help/en/html";
146 path += QPEApplication::qpeDir() + "/docs";
147 QString dir = QDir::current().canonicalPath();
148 if ( dir == "/" )
149 dir += "/docs";
150 else {
151 path += dir + "/../pics";
152 dir += "/../docs";
153 path += dir;
154 }
155 setFilePath( path );
156 setExtensionType("html","text/html;charset=UTF-8"); 142 setExtensionType("html","text/html;charset=UTF-8");
157 } 143 }
158 144
159 const QMimeSource* data(const QString& abs_name) const 145 const QMimeSource* data(const QString& abs_name) const
160 { 146 {
161 const QMimeSource* r = QMimeSourceFactory::data(abs_name); 147 const QMimeSource* r = QMimeSourceFactory::data(abs_name);
162 if ( !r ) { 148 if ( !r ) {
163 int sl = abs_name.length(); 149 int sl = abs_name.length();
@@ -532,42 +518,38 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t )
532 /* overide stored arguments */ 518 /* overide stored arguments */
533 setArgs(argc, argv); 519 setArgs(argc, argv);
534 520
535#endif 521#endif
536 522
537 qwsSetDecoration( new QPEDecoration() ); 523 qwsSetDecoration( new QPEDecoration() );
538 524
539#ifndef QT_NO_TRANSLATION 525#ifndef QT_NO_TRANSLATION
540 char *l = getenv( "LANG" ); 526 QStringList langs = Global::languageList();
541 QString lang; 527 for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) {
542 if ( l ) { 528 QString lang = *it;
543 lang = l;
544 529
545 /* 530 QTranslator * trans;
546 Config config("qpe"); 531 QString tfn;
547 config.setGroup( "Appearance" );
548 lang = config.readEntry( "Language", lang );
549 */
550 532
551 QTranslator * trans = new QTranslator(this); 533 trans = new QTranslator(this);
552 QString tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; 534 tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm";
553 if ( trans->load( tfn )) 535 if ( trans->load( tfn ))
554 installTranslator( trans ); 536 installTranslator( trans );
555 else 537 else
556 delete trans; 538 delete trans;
557 539
558 trans = new QTranslator(this); 540 trans = new QTranslator(this);
559 tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; 541 tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm";
560 if ( trans->load( tfn )) 542 if ( trans->load( tfn ))
561 installTranslator( trans ); 543 installTranslator( trans );
562 else 544 else
563 delete trans; 545 delete trans;
564 546
565 //###language/font hack; should look it up somewhere 547 //###language/font hack; should look it up somewhere
566 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 548 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
567 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 549 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
568 setFont( fn ); 550 setFont( fn );
569 } 551 }
570 } 552 }
571#endif 553#endif
572 554
573 applyStyle(); 555 applyStyle();