-rw-r--r-- | library/qpeapplication.cpp | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 70ffec1..4dbfbd8 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -10,24 +10,25 @@ ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** ** $Id$ ** **********************************************************************/ +#define QTOPIA_INTERNAL_LANGLIST #include <stdlib.h> #include <unistd.h> #include <qfile.h> #ifdef Q_WS_QWS #ifndef QT_NO_COP #if QT_VERSION <= 231 #define private public #define sendLocally processEvent #include "qcopenvelope_qws.h" #undef private #else #include "qcopenvelope_qws.h" @@ -128,40 +129,25 @@ public: { QCopRec* r; for (QListIterator<QCopRec> it(qcopq); (r=it.current()); ++it) QCopChannel::sendLocally(r->channel,r->message,r->data); qcopq.clear(); } }; class ResourceMimeFactory : public QMimeSourceFactory { public: ResourceMimeFactory() { - QStringList path; - QString lang = getenv("LANG"); - if ( !lang.isEmpty() ) - path += QPEApplication::qpeDir() + "/help/" + lang + "/html"; - path += QPEApplication::qpeDir() + "/pics"; - path += QPEApplication::qpeDir() + "/help/en/html"; - path += QPEApplication::qpeDir() + "/docs"; - QString dir = QDir::current().canonicalPath(); - if ( dir == "/" ) - dir += "/docs"; - else { - path += dir + "/../pics"; - dir += "/../docs"; - path += dir; - } - setFilePath( path ); + setFilePath( Global::helpPath() ); setExtensionType("html","text/html;charset=UTF-8"); } const QMimeSource* data(const QString& abs_name) const { const QMimeSource* r = QMimeSourceFactory::data(abs_name); if ( !r ) { int sl = abs_name.length(); do { sl = abs_name.findRev('/',sl-1); QString name = sl>=0 ? abs_name.mid(sl+1) : abs_name; int dot = name.findRev('.'); @@ -528,44 +514,40 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t ) argc-=1; } } /* overide stored arguments */ setArgs(argc, argv); #endif qwsSetDecoration( new QPEDecoration() ); #ifndef QT_NO_TRANSLATION - char *l = getenv( "LANG" ); - QString lang; - if ( l ) { - lang = l; + QStringList langs = Global::languageList(); + for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { + QString lang = *it; - /* - Config config("qpe"); - config.setGroup( "Appearance" ); - lang = config.readEntry( "Language", lang ); - */ + QTranslator * trans; + QString tfn; - QTranslator * trans = new QTranslator(this); - QString tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; + trans = new QTranslator(this); + tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; if ( trans->load( tfn )) installTranslator( trans ); else delete trans; trans = new QTranslator(this); - tfn = qpeDir()+"/i18n/"+lang+"/libqpe.qm"; + tfn = qpeDir()+"/i18n/"+lang+"/"+d->appName+".qm"; if ( trans->load( tfn )) installTranslator( trans ); else delete trans; //###language/font hack; should look it up somewhere if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { QFont fn = FontManager::unicodeFont( FontManager::Proportional ); setFont( fn ); } } #endif |