summaryrefslogtreecommitdiff
authorkergoth <kergoth>2003-05-13 21:06:17 (UTC)
committer kergoth <kergoth>2003-05-13 21:06:17 (UTC)
commitf31e2ecd95aba951dc77d98f02b45cb1297046ac (patch) (side-by-side diff)
tree2631fd833a0f28fb664f0b47e0c10f6e814c2281
parentf36387ff38fa08dd0bea4d1569f5ff0b88fcfb96 (diff)
downloadopie-f31e2ecd95aba951dc77d98f02b45cb1297046ac.zip
opie-f31e2ecd95aba951dc77d98f02b45cb1297046ac.tar.gz
opie-f31e2ecd95aba951dc77d98f02b45cb1297046ac.tar.bz2
Load langs
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/taboapp/main.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/core/apps/taboapp/main.cpp b/core/apps/taboapp/main.cpp
index 497e29f..5f7f86c 100644
--- a/core/apps/taboapp/main.cpp
+++ b/core/apps/taboapp/main.cpp
@@ -1,42 +1,54 @@
#include <qdir.h>
#include <qpe/global.h>
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <oappinterface.h>
#include <oappplugin.h>
#include <opie/otabwidget.h>
int main( int argc, char **argv )
{
QPEApplication a( argc, argv );
- int ret = 0;
OTabWidget *tabwidget = new OTabWidget(0, "tab widget");
QString path = QPEApplication::qpeDir() + "/plugins/app";
QDir dir( path, "lib*.so" );
QStringList list = dir.entryList();
QStringList::Iterator it;
QInterfacePtr<OAppInterface> iface;
for ( it = list.begin(); it != list.end(); ++it ) {
QLibrary *lib = new QLibrary( path + "/" + *it );
qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
QList<QWidget> list = iface->widgets();
-
QWidget *widget;
for ( widget = list.first(); widget != 0; widget = list.next() )
tabwidget->addTab(widget, QString(*it), QString(*it));
+
+ QString lang = getenv( "LANG" );
+ if (lang.isNull())
+ lang = "en";
+ QTranslator *trans = new QTranslator(qApp);
+ QString type = (*it).left( (*it).find(".") );
+ if (type.left(3) == "lib")
+ type = type.mid(3);
+ type = type.right( type.find("lib") );
+ QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
+ if ( trans->load( tfn ))
+ qApp->installTranslator( trans );
+ else
+ delete trans;
}
}
a.showMainDocumentWidget(tabwidget);
return a.exec();
}