summaryrefslogtreecommitdiff
path: root/library/global.cpp
authorkergoth <kergoth>2002-02-04 22:14:18 (UTC)
committer kergoth <kergoth>2002-02-04 22:14:18 (UTC)
commitd46cb220a09b41312d86bb33573940d3dcba2588 (patch) (side-by-side diff)
tree6aacb1589d5de2ca908d067f99ba64dc608a6fa5 /library/global.cpp
parent500e2f0cdbe82035516b7a1c576e08e0b2ad72b3 (diff)
downloadopie-d46cb220a09b41312d86bb33573940d3dcba2588.zip
opie-d46cb220a09b41312d86bb33573940d3dcba2588.tar.gz
opie-d46cb220a09b41312d86bb33573940d3dcba2588.tar.bz2
latest qtopia merge as of 20020204.
Diffstat (limited to 'library/global.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/global.cpp55
1 files changed, 49 insertions, 6 deletions
diff --git a/library/global.cpp b/library/global.cpp
index fd7579a..dd15eb7 100644
--- a/library/global.cpp
+++ b/library/global.cpp
@@ -17,6 +17,7 @@
** not clear to you.
**
**********************************************************************/
+#define QTOPIA_INTERNAL_LANGLIST
#include <qpe/qpedebug.h>
#include <qpe/global.h>
#include <qpe/qdawg.h>
@@ -170,12 +171,18 @@ const QDawg& Global::fixedDawg()
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() ) {
@@ -639,6 +646,42 @@ void Global::findDocuments(DocLnkSet* folder, const QString &mimefilter)
}
}
+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"