summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-02-12 11:40:53 (UTC)
committer harlekin <harlekin>2003-02-12 11:40:53 (UTC)
commitd5ca5bf9f6fc8d47c2786af80342b13036f14d36 (patch) (side-by-side diff)
tree83b131e59306b2a387f893bc13491fbae6357702
parentd9f46624eff7817ea46a4cb2f9bd4e908308df45 (diff)
downloadopie-d5ca5bf9f6fc8d47c2786af80342b13036f14d36.zip
opie-d5ca5bf9f6fc8d47c2786af80342b13036f14d36.tar.gz
opie-d5ca5bf9f6fc8d47c2786af80342b13036f14d36.tar.bz2
now plugins should be translatable too
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/today/plugins/datebook/datebookevent.cpp4
-rw-r--r--core/pim/today/today.cpp25
2 files changed, 24 insertions, 5 deletions
diff --git a/core/pim/today/plugins/datebook/datebookevent.cpp b/core/pim/today/plugins/datebook/datebookevent.cpp
index 48f204e..3c1e97a 100644
--- a/core/pim/today/plugins/datebook/datebookevent.cpp
+++ b/core/pim/today/plugins/datebook/datebookevent.cpp
@@ -41,13 +41,13 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
config.setGroup( "Time" );
// if 24 h format
ampm = config.readBoolEntry( "AMPM", TRUE );
msg += "<B>" + (ev).description() + "</B>";
if ( (ev).event().hasAlarm() ) {
- msg += " <b>[with alarm]</b>";
+ msg += " <b>" + tr("[with alarm]") +"</b>";
}
// include location or not
if ( show_location ) {
msg += "<BR><i>" + (ev).location() + "</i>";
}
@@ -64,13 +64,13 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev,
+ "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) )
+ differDate( tempDate );
}
// include possible note or not
if ( show_notes ) {
- msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
+ msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip );
}
setText( msg );
connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) );
}
DateBookEvent::~DateBookEvent() {
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 2f6907d..2497ee1 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -12,12 +12,15 @@
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
+
+#define QTOPIA_INTERNAL_LANGLIST
+
#include "today.h"
#include <opie/todayconfigwidget.h>
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/resource.h>
@@ -33,13 +36,13 @@
#include <qpixmap.h>
#include <qlayout.h>
#include <qhbox.h>
#include <opie/otabwidget.h>
#include <qdialog.h>
#include <qwhatsthis.h>
-
+#include <qtranslator.h>
struct TodayPlugin {
TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {}
QLibrary *library;
QInterfacePtr<TodayPluginInterface> iface;
TodayPluginObject *guiPart;
@@ -158,14 +161,14 @@ void Today::loadPlugins() {
init();
QValueList<TodayPlugin>::Iterator tit;
if ( !pluginList.isEmpty() ) {
for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) {
(*tit).guiBox->hide();
(*tit).guiBox->reparent( 0, QPoint( 0, 0 ) );
- (*tit).library->unload();
delete (*tit).guiBox;
+ (*tit).library->unload();
delete (*tit).library;
}
pluginList.clear();
}
QString path = QPEApplication::qpeDir() + "/plugins/today";
@@ -187,12 +190,26 @@ void Today::loadPlugins() {
TodayPlugin plugin;
plugin.library = lib;
plugin.iface = iface;
plugin.name = QString(*it);
+ QString type = (*it).left( (*it).find(".") );
+ QStringList langs = Global::languageList();
+ for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) {
+ QString lang = *lit;
+ qDebug( "Languages: " + lang );
+ QTranslator * trans = new QTranslator( qApp );
+ QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm";
+ if ( trans->load( tfn ) ) {
+ qApp->installTranslator( trans );
+ } else {
+ delete trans;
+ }
+ }
+
// find out if plugins should be shown
if ( m_excludeApplets.grep( *it ).isEmpty() ) {
plugin.active = true;
} else {
plugin.active = false;
}
@@ -300,12 +317,13 @@ void Today::draw() {
* The method for the configuration dialog.
*/
void Today::startConfig() {
// disconnect timer to prevent problems while being on config dialog
disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
+ m_refreshTimer->stop( );
TodayConfig conf( this, "dialog", true );
TodayPlugin plugin;
QList<TodayConfigWidget> configWidgetList;
@@ -331,13 +349,14 @@ void Today::startConfig() {
confWidget = configWidgetList.next() ) {
confWidget->writeConfig();
}
loadPlugins();
} else {
// since refresh is not called in that case , reconnect the signal
- connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
+ m_refreshTimer->start( 15000 ); // get the config value in here later
+ connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
}
}
/**
* Refresh for the view. Reload all applets