summaryrefslogtreecommitdiff
Unidiff
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 @@
1#include <qdir.h> 1#include <qdir.h>
2 2
3#include <qpe/global.h> 3#include <qpe/global.h>
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qpe/qlibrary.h> 5#include <qpe/qlibrary.h>
6#include <oappinterface.h> 6#include <oappinterface.h>
7#include <oappplugin.h> 7#include <oappplugin.h>
8 8
9#include <opie/otabwidget.h> 9#include <opie/otabwidget.h>
10 10
11int main( int argc, char **argv ) 11int main( int argc, char **argv )
12{ 12{
13 QPEApplication a( argc, argv ); 13 QPEApplication a( argc, argv );
14 int ret = 0;
15 14
16 OTabWidget *tabwidget = new OTabWidget(0, "tab widget"); 15 OTabWidget *tabwidget = new OTabWidget(0, "tab widget");
17 16
18 QString path = QPEApplication::qpeDir() + "/plugins/app"; 17 QString path = QPEApplication::qpeDir() + "/plugins/app";
19 QDir dir( path, "lib*.so" ); 18 QDir dir( path, "lib*.so" );
20 19
21 QStringList list = dir.entryList(); 20 QStringList list = dir.entryList();
22 QStringList::Iterator it; 21 QStringList::Iterator it;
23 22
24 QInterfacePtr<OAppInterface> iface; 23 QInterfacePtr<OAppInterface> iface;
25 for ( it = list.begin(); it != list.end(); ++it ) { 24 for ( it = list.begin(); it != list.end(); ++it ) {
26 QLibrary *lib = new QLibrary( path + "/" + *it ); 25 QLibrary *lib = new QLibrary( path + "/" + *it );
27 26
28 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); 27 qDebug( "querying: %s", QString( path + "/" + *it ).latin1() );
29 if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) { 28 if ( lib->queryInterface( IID_OAppInterface, (QUnknownInterface**)&iface ) == QS_OK ) {
30 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() ); 29 qDebug( "accepted: %s", QString( path + "/" + *it ).latin1() );
31 30
32 QList<QWidget> list = iface->widgets(); 31 QList<QWidget> list = iface->widgets();
33
34 QWidget *widget; 32 QWidget *widget;
35 for ( widget = list.first(); widget != 0; widget = list.next() ) 33 for ( widget = list.first(); widget != 0; widget = list.next() )
36 tabwidget->addTab(widget, QString(*it), QString(*it)); 34 tabwidget->addTab(widget, QString(*it), QString(*it));
35
36 QString lang = getenv( "LANG" );
37 if (lang.isNull())
38 lang = "en";
39 QTranslator *trans = new QTranslator(qApp);
40 QString type = (*it).left( (*it).find(".") );
41 if (type.left(3) == "lib")
42 type = type.mid(3);
43 type = type.right( type.find("lib") );
44 QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm";
45 if ( trans->load( tfn ))
46 qApp->installTranslator( trans );
47 else
48 delete trans;
37 } 49 }
38 } 50 }
39 51
40 a.showMainDocumentWidget(tabwidget); 52 a.showMainDocumentWidget(tabwidget);
41 return a.exec(); 53 return a.exec();
42} 54}