-rw-r--r-- | library/global.cpp | 55 | ||||
-rw-r--r-- | library/qpeapplication.cpp | 40 | ||||
-rwxr-xr-x | mkipks | 2 | ||||
-rw-r--r-- | noncore/games/minesweep/Makefile.in | 18 |
4 files changed, 71 insertions, 44 deletions
diff --git a/library/global.cpp b/library/global.cpp index fd7579a..dd15eb7 100644 --- a/library/global.cpp +++ b/library/global.cpp @@ -14,12 +14,13 @@ ** 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. ** **********************************************************************/ +#define QTOPIA_INTERNAL_LANGLIST #include <qpe/qpedebug.h> #include <qpe/global.h> #include <qpe/qdawg.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/storage.h> @@ -167,18 +168,24 @@ const QDawg& Global::fixedDawg() if ( !fixed_dawg ) { if ( !docDirCreated ) createDocDir(); fixed_dawg = new QDawg; QString dawgfilename = dictDir() + "/dawg"; - QString lang = getenv( "LANG" ); - QString dawgfilename_lang = dawgfilename + "." + lang; - QString words_lang = dictDir() + "/words." + lang; - if ( QFile::exists(dawgfilename_lang) || - QFile::exists(words_lang) ) - dawgfilename = dawgfilename_lang; + QString words_lang; + QStringList langs = Global::languageList(); + for (QStringList::ConstIterator it = langs.begin(); it!=langs.end(); ++it) { + QString lang = *it; + words_lang = dictDir() + "/words." + lang; + QString dawgfilename_lang = dawgfilename + "." + lang; + if ( QFile::exists(dawgfilename_lang) || + QFile::exists(words_lang) ) { + dawgfilename = dawgfilename_lang; + break; + } + } QFile dawgfile(dawgfilename); if ( !dawgfile.exists() ) { QString fn = dictDir() + "/words"; if ( QFile::exists(words_lang) ) fn = words_lang; @@ -636,9 +643,45 @@ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) DocLnkSet ide( path, mimefilter ); folder->appendFrom(ide); } } } +QStringList Global::languageList() +{ + QString lang = getenv("LANG"); + QStringList langs; + langs.append(lang); + int i = lang.find("."); + if ( i > 0 ) + lang = lang.left( i ); + i = lang.find( "_" ); + if ( i > 0 ) + langs.append(lang.left(i)); + return langs; +} + +QStringList Global::helpPath() +{ + QStringList path; + QStringList langs = Global::languageList(); + for (QStringList::ConstIterator it = langs.fromLast(); it!=langs.end(); --it) { + QString lang = *it; + 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; + } + return path; +} #include "global.moc" diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index 70ffec1..4dbfbd8 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -16,12 +16,13 @@ ** 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 @@ -134,28 +135,13 @@ public: }; 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); @@ -534,38 +520,34 @@ QPEApplication::QPEApplication( int& argc, char **argv, Type t ) #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 + //###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 @@ -173,13 +173,13 @@ do echo >>$SPEC "%description" sed -n -e '/^Description:/,$ p' $i | tail +2 >>$SPEC echo >>$SPEC "%files" echo >>$SPEC "%defattr(-,root,root)" /bin/ls $RPMFILES >>$SPEC - rpm -bb $SPEC --target $ARCH-unknown-linux + rpm -bb --target $ARCH-unknown-linux $SPEC # rm $SPEC elif [ -z "$IMAGEDIR" ] then #size=$(du -h -s $DATADIR | sed -e 's/[ ].*//') size=$(mkfs.jffs2 -r $DATADIR | wc -c) echo "Package: $packagename" >$CTRLDIR/control diff --git a/noncore/games/minesweep/Makefile.in b/noncore/games/minesweep/Makefile.in index 67ea94c..6df2608 100644 --- a/noncore/games/minesweep/Makefile.in +++ b/noncore/games/minesweep/Makefile.in @@ -66,14 +66,16 @@ all: $(DESTDIR)$(TARGET) $(DESTDIR)$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(SYSCONF_LINK) $(LFLAGS) -o $(DESTDIR)$(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) moc: $(SRCMOC) -tmake: - tmake minesweep.pro +tmake: Makefile.in + +Makefile.in: minesweep.pro + tmake minesweep.pro -o Makefile.in clean: -rm -f $(OBJECTS) $(OBJMOC) $(SRCMOC) $(UICIMPLS) $(UICDECLS) -rm -f *~ core -rm -f allmoc.cpp @@ -102,25 +104,25 @@ REQUIRES= ####### Compile main.o: main.cpp \ minesweep.h \ - $(OPIEDIR)/include/qpe/qpeapplication.h + /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/qpeapplication.h minefield.o: minefield.cpp \ minefield.h \ - $(OPIEDIR)/include/qpe/config.h + /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/config.h minesweep.o: minesweep.cpp \ minesweep.h \ minefield.h \ - $(OPIEDIR)/include/qpe/resource.h \ - $(OPIEDIR)/include/qpe/config.h \ - $(OPIEDIR)/include/qpe/qpetoolbar.h \ - $(OPIEDIR)/include/qpe/qpemenubar.h + /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/resource.h \ + /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/config.h \ + /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/qpetoolbar.h \ + /home/kergoth/roms/openzaurus/buildroot-oz/build/opie/include/qpe/qpemenubar.h moc_minefield.o: moc_minefield.cpp \ minefield.h moc_minesweep.o: moc_minesweep.cpp \ minesweep.h |