From 4765c92ba3dcbd829cb2adde4a097dfe6283d7cc Mon Sep 17 00:00:00 2001 From: zecke Date: Mon, 12 May 2003 13:07:37 +0000 Subject: Hospital Hacking Session Install libopie.qm make apps fully translatable... refactor installing trans into a method instead of having the same code copy and pasted three times --- diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index e5da48c..f4db1ab 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -603,22 +603,10 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t ) for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { QString lang = *it; - QTranslator * trans; - QString tfn; + installTranslation( lang + "/libopie.qm"); + installTranslation( lang + "/libqpe.qm" ); + installTranslation( 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 + "/" + d->appName + ".qm"; - if ( trans->load( tfn ) ) - installTranslator( trans ); - else - delete trans; //###language/font hack; should look it up somewhere #ifdef QWS @@ -1727,6 +1715,18 @@ void QPEApplication::tryQuit() /*! \internal +*/ +void QPEApplication::installTranslation( const QString& baseName ) { + QTranslator* trans = new QTranslator(this); + QString tfn = qpeDir() + "/i18n/"+baseName; + if ( trans->load( tfn ) ) + installTranslator( trans ); + else + delete trans; +} + +/*! + \internal User initiated quit. Makes the window 'Go Away'. If preloaded this means hiding the window. If not it means quitting the application. As this is user initiated we don't need to check state. diff --git a/library/qpeapplication.h b/library/qpeapplication.h index 0bad8b7..e35c008 100644 --- a/library/qpeapplication.h +++ b/library/qpeapplication.h @@ -122,6 +122,9 @@ protected: virtual void polish ( QWidget * ); // this is actually implemented in qt_override.cpp (!) private: +#ifndef QT_NO_TRANSLATION + void installTranslation( const QString& baseName ); +#endif void mapToDefaultAction( QWSKeyEvent *ke, int defKey ); #if defined(Q_WS_QWS) && !defined(QT_NO_COP) -- cgit v0.9.0.2