author | harlekin <harlekin> | 2003-02-12 11:40:53 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-02-12 11:40:53 (UTC) |
commit | d5ca5bf9f6fc8d47c2786af80342b13036f14d36 (patch) (unidiff) | |
tree | 83b131e59306b2a387f893bc13491fbae6357702 /core | |
parent | d9f46624eff7817ea46a4cb2f9bd4e908308df45 (diff) | |
download | opie-d5ca5bf9f6fc8d47c2786af80342b13036f14d36.zip opie-d5ca5bf9f6fc8d47c2786af80342b13036f14d36.tar.gz opie-d5ca5bf9f6fc8d47c2786af80342b13036f14d36.tar.bz2 |
now plugins should be translatable too
-rw-r--r-- | core/pim/today/plugins/datebook/datebookevent.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 25 |
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, | |||
41 | config.setGroup( "Time" ); | 41 | config.setGroup( "Time" ); |
42 | // if 24 h format | 42 | // if 24 h format |
43 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 43 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
44 | 44 | ||
45 | msg += "<B>" + (ev).description() + "</B>"; | 45 | msg += "<B>" + (ev).description() + "</B>"; |
46 | if ( (ev).event().hasAlarm() ) { | 46 | if ( (ev).event().hasAlarm() ) { |
47 | msg += " <b>[with alarm]</b>"; | 47 | msg += " <b>" + tr("[with alarm]") +"</b>"; |
48 | } | 48 | } |
49 | 49 | ||
50 | // include location or not | 50 | // include location or not |
51 | if ( show_location ) { | 51 | if ( show_location ) { |
52 | msg += "<BR><i>" + (ev).location() + "</i>"; | 52 | msg += "<BR><i>" + (ev).location() + "</i>"; |
53 | } | 53 | } |
@@ -64,13 +64,13 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
64 | + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) | 64 | + "<b> - </b>" + ampmTime( QTime( (ev).event().end().time() ) ) |
65 | + differDate( tempDate ); | 65 | + differDate( tempDate ); |
66 | } | 66 | } |
67 | 67 | ||
68 | // include possible note or not | 68 | // include possible note or not |
69 | if ( show_notes ) { | 69 | if ( show_notes ) { |
70 | msg += "<br> <i>note</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); | 70 | msg += "<br> <i>" + tr("note") + "</i>:" +( (ev).notes() ).mid( 0, maxCharClip ); |
71 | } | 71 | } |
72 | setText( msg ); | 72 | setText( msg ); |
73 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); | 73 | connect( this, SIGNAL( clicked() ), this, SLOT( editMe() ) ); |
74 | } | 74 | } |
75 | 75 | ||
76 | DateBookEvent::~DateBookEvent() { | 76 | 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 @@ | |||
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | |||
19 | #define QTOPIA_INTERNAL_LANGLIST | ||
20 | |||
18 | #include "today.h" | 21 | #include "today.h" |
19 | #include <opie/todayconfigwidget.h> | 22 | #include <opie/todayconfigwidget.h> |
20 | 23 | ||
21 | #include <qpe/config.h> | 24 | #include <qpe/config.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 25 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
@@ -33,13 +36,13 @@ | |||
33 | #include <qpixmap.h> | 36 | #include <qpixmap.h> |
34 | #include <qlayout.h> | 37 | #include <qlayout.h> |
35 | #include <qhbox.h> | 38 | #include <qhbox.h> |
36 | #include <opie/otabwidget.h> | 39 | #include <opie/otabwidget.h> |
37 | #include <qdialog.h> | 40 | #include <qdialog.h> |
38 | #include <qwhatsthis.h> | 41 | #include <qwhatsthis.h> |
39 | 42 | #include <qtranslator.h> | |
40 | 43 | ||
41 | struct TodayPlugin { | 44 | struct TodayPlugin { |
42 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 45 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} |
43 | QLibrary *library; | 46 | QLibrary *library; |
44 | QInterfacePtr<TodayPluginInterface> iface; | 47 | QInterfacePtr<TodayPluginInterface> iface; |
45 | TodayPluginObject *guiPart; | 48 | TodayPluginObject *guiPart; |
@@ -158,14 +161,14 @@ void Today::loadPlugins() { | |||
158 | init(); | 161 | init(); |
159 | QValueList<TodayPlugin>::Iterator tit; | 162 | QValueList<TodayPlugin>::Iterator tit; |
160 | if ( !pluginList.isEmpty() ) { | 163 | if ( !pluginList.isEmpty() ) { |
161 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 164 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
162 | (*tit).guiBox->hide(); | 165 | (*tit).guiBox->hide(); |
163 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); | 166 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); |
164 | (*tit).library->unload(); | ||
165 | delete (*tit).guiBox; | 167 | delete (*tit).guiBox; |
168 | (*tit).library->unload(); | ||
166 | delete (*tit).library; | 169 | delete (*tit).library; |
167 | } | 170 | } |
168 | pluginList.clear(); | 171 | pluginList.clear(); |
169 | } | 172 | } |
170 | 173 | ||
171 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 174 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
@@ -187,12 +190,26 @@ void Today::loadPlugins() { | |||
187 | 190 | ||
188 | TodayPlugin plugin; | 191 | TodayPlugin plugin; |
189 | plugin.library = lib; | 192 | plugin.library = lib; |
190 | plugin.iface = iface; | 193 | plugin.iface = iface; |
191 | plugin.name = QString(*it); | 194 | plugin.name = QString(*it); |
192 | 195 | ||
196 | QString type = (*it).left( (*it).find(".") ); | ||
197 | QStringList langs = Global::languageList(); | ||
198 | for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { | ||
199 | QString lang = *lit; | ||
200 | qDebug( "Languages: " + lang ); | ||
201 | QTranslator * trans = new QTranslator( qApp ); | ||
202 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; | ||
203 | if ( trans->load( tfn ) ) { | ||
204 | qApp->installTranslator( trans ); | ||
205 | } else { | ||
206 | delete trans; | ||
207 | } | ||
208 | } | ||
209 | |||
193 | // find out if plugins should be shown | 210 | // find out if plugins should be shown |
194 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 211 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
195 | plugin.active = true; | 212 | plugin.active = true; |
196 | } else { | 213 | } else { |
197 | plugin.active = false; | 214 | plugin.active = false; |
198 | } | 215 | } |
@@ -300,12 +317,13 @@ void Today::draw() { | |||
300 | * The method for the configuration dialog. | 317 | * The method for the configuration dialog. |
301 | */ | 318 | */ |
302 | void Today::startConfig() { | 319 | void Today::startConfig() { |
303 | 320 | ||
304 | // disconnect timer to prevent problems while being on config dialog | 321 | // disconnect timer to prevent problems while being on config dialog |
305 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 322 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
323 | m_refreshTimer->stop( ); | ||
306 | 324 | ||
307 | TodayConfig conf( this, "dialog", true ); | 325 | TodayConfig conf( this, "dialog", true ); |
308 | 326 | ||
309 | TodayPlugin plugin; | 327 | TodayPlugin plugin; |
310 | QList<TodayConfigWidget> configWidgetList; | 328 | QList<TodayConfigWidget> configWidgetList; |
311 | 329 | ||
@@ -331,13 +349,14 @@ void Today::startConfig() { | |||
331 | confWidget = configWidgetList.next() ) { | 349 | confWidget = configWidgetList.next() ) { |
332 | confWidget->writeConfig(); | 350 | confWidget->writeConfig(); |
333 | } | 351 | } |
334 | loadPlugins(); | 352 | loadPlugins(); |
335 | } else { | 353 | } else { |
336 | // since refresh is not called in that case , reconnect the signal | 354 | // since refresh is not called in that case , reconnect the signal |
337 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 355 | m_refreshTimer->start( 15000 ); // get the config value in here later |
356 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
338 | } | 357 | } |
339 | } | 358 | } |
340 | 359 | ||
341 | 360 | ||
342 | /** | 361 | /** |
343 | * Refresh for the view. Reload all applets | 362 | * Refresh for the view. Reload all applets |