summaryrefslogtreecommitdiff
path: root/library/qpeapplication.cpp
authorzecke <zecke>2003-05-12 13:07:37 (UTC)
committer zecke <zecke>2003-05-12 13:07:37 (UTC)
commit4765c92ba3dcbd829cb2adde4a097dfe6283d7cc (patch) (unidiff)
tree7a13062058737af1564863f9caec692f145fdfaa /library/qpeapplication.cpp
parent65a043f4ac4b43967947c1e8d99c629bb993f065 (diff)
downloadopie-4765c92ba3dcbd829cb2adde4a097dfe6283d7cc.zip
opie-4765c92ba3dcbd829cb2adde4a097dfe6283d7cc.tar.gz
opie-4765c92ba3dcbd829cb2adde4a097dfe6283d7cc.tar.bz2
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
Diffstat (limited to 'library/qpeapplication.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/qpeapplication.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp
index e5da48c..f4db1ab 100644
--- a/library/qpeapplication.cpp
+++ b/library/qpeapplication.cpp
@@ -594,40 +594,28 @@ QPEApplication::QPEApplication( int & argc, char **argv, Type t )
594 setArgs( argc, argv ); 594 setArgs( argc, argv );
595 595
596#endif 596#endif
597 597
598 // qwsSetDecoration( new QPEDecoration() ); 598 // qwsSetDecoration( new QPEDecoration() );
599 599
600#ifndef QT_NO_TRANSLATION 600#ifndef QT_NO_TRANSLATION
601 601
602 QStringList langs = Global::languageList(); 602 QStringList langs = Global::languageList();
603 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { 603 for ( QStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) {
604 QString lang = *it; 604 QString lang = *it;
605 605
606 QTranslator * trans; 606 installTranslation( lang + "/libopie.qm");
607 QString tfn; 607 installTranslation( lang + "/libqpe.qm" );
608 installTranslation( lang + "/" + d->appName + ".qm" );
608 609
609 trans = new QTranslator( this );
610 tfn = qpeDir() + "/i18n/" + lang + "/libqpe.qm";
611 if ( trans->load( tfn ) )
612 installTranslator( trans );
613 else
614 delete trans;
615
616 trans = new QTranslator( this );
617 tfn = qpeDir() + "/i18n/" + lang + "/" + d->appName + ".qm";
618 if ( trans->load( tfn ) )
619 installTranslator( trans );
620 else
621 delete trans;
622 610
623 //###language/font hack; should look it up somewhere 611 //###language/font hack; should look it up somewhere
624#ifdef QWS 612#ifdef QWS
625 613
626 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) { 614 if ( lang == "ja" || lang == "zh_CN" || lang == "zh_TW" || lang == "ko" ) {
627 QFont fn = FontManager::unicodeFont( FontManager::Proportional ); 615 QFont fn = FontManager::unicodeFont( FontManager::Proportional );
628 setFont( fn ); 616 setFont( fn );
629 } 617 }
630#endif 618#endif
631 619
632 } 620 }
633#endif 621#endif
@@ -1718,24 +1706,36 @@ void QPEApplication::tryQuit()
1718 { 1706 {
1719 QCopEnvelope e( "QPE/System", "closing(QString)" ); 1707 QCopEnvelope e( "QPE/System", "closing(QString)" );
1720 e << d->appName; 1708 e << d->appName;
1721 } 1709 }
1722#endif 1710#endif
1723 processEvents(); 1711 processEvents();
1724 1712
1725 quit(); 1713 quit();
1726} 1714}
1727 1715
1728/*! 1716/*!
1729 \internal 1717 \internal
1718*/
1719void QPEApplication::installTranslation( const QString& baseName ) {
1720 QTranslator* trans = new QTranslator(this);
1721 QString tfn = qpeDir() + "/i18n/"+baseName;
1722 if ( trans->load( tfn ) )
1723 installTranslator( trans );
1724 else
1725 delete trans;
1726}
1727
1728/*!
1729 \internal
1730 User initiated quit. Makes the window 'Go Away'. If preloaded this means 1730 User initiated quit. Makes the window 'Go Away'. If preloaded this means
1731 hiding the window. If not it means quitting the application. 1731 hiding the window. If not it means quitting the application.
1732 As this is user initiated we don't need to check state. 1732 As this is user initiated we don't need to check state.
1733*/ 1733*/
1734void QPEApplication::hideOrQuit() 1734void QPEApplication::hideOrQuit()
1735{ 1735{
1736 processEvents(); 1736 processEvents();
1737 1737
1738 // If we are a preloaded application we don't actually quit, so emit 1738 // If we are a preloaded application we don't actually quit, so emit
1739 // a System message indicating we're quasi-closing. 1739 // a System message indicating we're quasi-closing.
1740 if ( d->preloaded && d->qpe_main_widget ) 1740 if ( d->preloaded && d->qpe_main_widget )
1741#ifndef QT_NO_COP 1741#ifndef QT_NO_COP