-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 @@ -8,24 +8,25 @@ ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** 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. ** **********************************************************************/ +#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> #include <qpe/applnk.h> #if defined(Q_WS_QWS) && !defined(QT_NO_COP) #include "qpe/qcopenvelope_qws.h" #endif #include <qfile.h> @@ -161,30 +162,36 @@ Global::Global() words for the current locale. \sa addedDawg() */ 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; QFile in(fn); if ( in.open(IO_ReadOnly) ) { fixed_dawg->createFromWords(&in); dawgfile.open(IO_WriteOnly); fixed_dawg->write(&dawgfile); dawgfile.close(); @@ -630,15 +637,51 @@ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter) StorageInfo storage; const QList<FileSystem> &fs = storage.fileSystems(); QListIterator<FileSystem> it ( fs ); for ( ; it.current(); ++it ) { if ( (*it)->isRemovable() ) { QString path = (*it)->path(); 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 @@ -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,50 +514,46 @@ 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 + //###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 applyStyle(); if ( type() == GuiServer ) { setScreenSaverInterval(-1); setVolume(); @@ -167,25 +167,25 @@ do echo >$SPEC "Summary: $summary" echo >>$SPEC "Name: $packagename" echo >>$SPEC "Group: $section" ########## echo >>$SPEC "License: $license" echo >>$SPEC "Version: ${version%-*}" echo >>$SPEC "Release: ${version#*-}" 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 echo "Installed-Size: $size" >>$CTRLDIR/control echo "Filename: ./$package.ipk" >>$CTRLDIR/control echo "Version: $version" >>$CTRLDIR/control echo "Depends: $depends" >>$CTRLDIR/control egrep -v "^(Files|Version|Depends):" >>$CTRLDIR/control $i echo "$DEB_VERSION" >$TDIR/debian-binary 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 @@ -60,26 +60,28 @@ OBJMOC = moc_minefield.o \ $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $< ####### Build rules 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 ####### Extension Modules listpromodules: @echo listallmodules: @@ -96,37 +98,37 @@ REQUIRES= ####### Sub-libraries ###### Combined headers ####### 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 moc_minefield.cpp: minefield.h $(MOC) minefield.h -o moc_minefield.cpp moc_minesweep.cpp: minesweep.h $(MOC) minesweep.h -o moc_minesweep.cpp |