-rw-r--r-- | core/pim/today/today.cpp | 292 |
1 files changed, 84 insertions, 208 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 0a6269e..a8c8651 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -14,13 +14,12 @@ | |||
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | #define QTOPIA_INTERNAL_LANGLIST | ||
18 | |||
19 | #include "today.h" | 17 | #include "today.h" |
20 | 18 | ||
21 | #include <opie2/odebug.h> | 19 | #include <opie2/odebug.h> |
20 | #include <opie2/opluginloader.h> | ||
21 | #include <opie2/oconfig.h> | ||
22 | 22 | ||
23 | #include <qpe/config.h> | ||
24 | #include <qpe/qcopenvelope_qws.h> | 23 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/resource.h> | 24 | #include <qpe/resource.h> |
26 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
@@ -31,21 +30,23 @@ | |||
31 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
32 | 31 | ||
33 | using namespace Opie::Ui; | 32 | using namespace Opie::Ui; |
33 | using Opie::Core::OPluginItem; | ||
34 | using Opie::Core::OPluginLoader; | ||
35 | using Opie::Core::OPluginManager; | ||
36 | using Opie::Core::OConfig; | ||
37 | |||
38 | |||
34 | struct TodayPlugin { | 39 | struct TodayPlugin { |
35 | TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} | 40 | TodayPlugin() : iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} |
36 | QLibrary *library; | ||
37 | QInterfacePtr<TodayPluginInterface> iface; | 41 | QInterfacePtr<TodayPluginInterface> iface; |
38 | TodayPluginObject *guiPart; | 42 | TodayPluginObject *guiPart; |
43 | OPluginItem oplugin; | ||
39 | QWidget *guiBox; | 44 | QWidget *guiBox; |
40 | QString name; | 45 | QString name; |
41 | bool active; | ||
42 | bool excludeRefresh; | 46 | bool excludeRefresh; |
43 | int pos; | ||
44 | }; | 47 | }; |
45 | 48 | ||
46 | static QValueList<TodayPlugin> pluginList; | 49 | static QMap<QString, TodayPlugin> pluginList; |
47 | |||
48 | static QMap<QString, TodayPlugin> tempList; | ||
49 | 50 | ||
50 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 51 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
51 | : TodayBase( parent, name, fl ) { | 52 | : TodayBase( parent, name, fl ) { |
@@ -55,6 +56,7 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
55 | 56 | ||
56 | #if defined(Q_WS_QWS) | 57 | #if defined(Q_WS_QWS) |
57 | #if !defined(QT_NO_COP) | 58 | #if !defined(QT_NO_COP) |
59 | |||
58 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 60 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
59 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), | 61 | connect ( todayChannel, SIGNAL( received(const QCString&,const QByteArray&) ), |
60 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); | 62 | this, SLOT ( channelReceived(const QCString&,const QByteArray&) ) ); |
@@ -62,12 +64,8 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
62 | #endif | 64 | #endif |
63 | 65 | ||
64 | setOwnerField(); | 66 | setOwnerField(); |
65 | m_refreshTimer = new QTimer( this ); | ||
66 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
67 | m_refreshTimer->start( 15000 ); | ||
68 | m_big_box = 0L; | 67 | m_big_box = 0L; |
69 | 68 | ||
70 | |||
71 | layout = new QVBoxLayout( this ); | 69 | layout = new QVBoxLayout( this ); |
72 | layout->addWidget( Frame ); | 70 | layout->addWidget( Frame ); |
73 | layout->addWidget( OwnerField ); | 71 | layout->addWidget( OwnerField ); |
@@ -80,8 +78,12 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
80 | layout->addWidget( m_sv ); | 78 | layout->addWidget( m_sv ); |
81 | layout->setStretchFactor( m_sv,4 ); | 79 | layout->setStretchFactor( m_sv,4 ); |
82 | 80 | ||
83 | qApp->processEvents(); | 81 | m_refreshTimer = new QTimer( this ); |
82 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
83 | |||
84 | init(); | ||
84 | loadPlugins(); | 85 | loadPlugins(); |
86 | initialize(); | ||
85 | QPEApplication::showWidget( this ); | 87 | QPEApplication::showWidget( this ); |
86 | } | 88 | } |
87 | 89 | ||
@@ -100,7 +102,6 @@ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | |||
100 | void Today::setRefreshTimer( int interval ) { | 102 | void Today::setRefreshTimer( int interval ) { |
101 | 103 | ||
102 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 104 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
103 | |||
104 | // 0 is "never" case | 105 | // 0 is "never" case |
105 | if ( !interval == 0 ) { | 106 | if ( !interval == 0 ) { |
106 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 107 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
@@ -132,16 +133,16 @@ void Today::setOwnerField( QString &message ) { | |||
132 | } | 133 | } |
133 | } | 134 | } |
134 | 135 | ||
136 | |||
135 | /** | 137 | /** |
136 | * Init stuff needed for today. Reads the config file. | 138 | * Init stuff needed for today. Reads the config file. |
137 | */ | 139 | */ |
138 | void Today::init() { | 140 | void Today::init() { |
139 | // read config | 141 | // read config |
140 | Config cfg( "today" ); | 142 | OConfig cfg( "today" ); |
141 | |||
142 | cfg.setGroup( "Plugins" ); | 143 | cfg.setGroup( "Plugins" ); |
143 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 144 | // m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
144 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | 145 | // m_allApplets = cfg.readListEntry( "AllApplets", ',' ); |
145 | 146 | ||
146 | cfg.setGroup( "General" ); | 147 | cfg.setGroup( "General" ); |
147 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 148 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
@@ -169,75 +170,27 @@ void Today::init() { | |||
169 | m_bblayout = new QVBoxLayout ( m_big_box ); | 170 | m_bblayout = new QVBoxLayout ( m_big_box ); |
170 | } | 171 | } |
171 | 172 | ||
173 | |||
172 | /** | 174 | /** |
173 | * Load the plugins | 175 | * Load the plugins |
174 | */ | 176 | */ |
175 | void Today::loadPlugins() { | 177 | void Today::loadPlugins() { |
176 | 178 | ||
177 | init(); | 179 | m_pluginLoader = new OPluginLoader( "today", true ); |
178 | 180 | m_pluginLoader->setAutoDelete( true ); | |
179 | QValueList<TodayPlugin>::Iterator tit; | ||
180 | if ( !pluginList.isEmpty() ) { | ||
181 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | ||
182 | (*tit).guiBox->hide(); | ||
183 | (*tit).guiBox->reparent( 0, QPoint( 0, 0 ) ); | ||
184 | delete (*tit).guiBox; | ||
185 | (*tit).library->unload(); | ||
186 | delete (*tit).library; | ||
187 | } | ||
188 | pluginList.clear(); | ||
189 | } | ||
190 | |||
191 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | ||
192 | #ifdef Q_OS_MACX | ||
193 | owarn << "Searching for Plugins in: " << path << oendl; | ||
194 | QDir dir( path, "lib*.dylib" ); | ||
195 | #else | ||
196 | QDir dir( path, "lib*.so" ); | ||
197 | #endif | ||
198 | 181 | ||
199 | QStringList list = dir.entryList(); | 182 | OPluginItem::List lst = m_pluginLoader->allAvailable( true ); |
200 | QStringList::Iterator it; | ||
201 | 183 | ||
202 | // QMap<QString, TodayPlugin> tempList; | 184 | m_manager = new OPluginManager( m_pluginLoader ); |
185 | m_manager->load(); | ||
203 | 186 | ||
204 | for ( it = list.begin(); it != list.end(); ++it ) { | 187 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
205 | QInterfacePtr<TodayPluginInterface> iface; | 188 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
206 | QLibrary *lib = new QLibrary( path + "/" + *it ); | ||
207 | |||
208 | odebug << "querying: " << path + "/" + *it << oendl; | ||
209 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | ||
210 | odebug << "accepted: " << path + "/" + *it << oendl; | ||
211 | odebug << *it << oendl; | ||
212 | 189 | ||
213 | TodayPlugin plugin; | 190 | TodayPlugin plugin; |
214 | plugin.library = lib; | ||
215 | plugin.iface = iface; | 191 | plugin.iface = iface; |
216 | plugin.name = QString(*it); | 192 | plugin.name = (*it).name(); |
217 | 193 | plugin.oplugin = (*it); | |
218 | QString type = (*it).left( (*it).find(".") ); | ||
219 | |||
220 | QString lang; | ||
221 | Config config("locale"); | ||
222 | config.setGroup("Language"); | ||
223 | lang = config.readEntry( "Language", "en" ); | ||
224 | |||
225 | odebug << "Languages: " << lang << oendl; | ||
226 | QTranslator * trans = new QTranslator( qApp ); | ||
227 | QString tfn = QPEApplication::qpeDir()+"/i18n/" + lang + "/" + type + ".qm"; | ||
228 | if ( trans->load( tfn ) ) { | ||
229 | qApp->installTranslator( trans ); | ||
230 | } else { | ||
231 | delete trans; | ||
232 | } | ||
233 | |||
234 | |||
235 | // find out if plugins should be shown | ||
236 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | ||
237 | plugin.active = true; | ||
238 | } else { | ||
239 | plugin.active = false; | ||
240 | } | ||
241 | 194 | ||
242 | plugin.guiPart = plugin.iface->guiPart(); | 195 | plugin.guiPart = plugin.iface->guiPart(); |
243 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 196 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
@@ -249,7 +202,8 @@ void Today::loadPlugins() { | |||
249 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 202 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
250 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 203 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
251 | plugIcon->setPixmap( plugPix ); | 204 | plugIcon->setPixmap( plugPix ); |
252 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); | 205 | QWhatsThis::add |
206 | ( plugIcon, tr("Click here to launch the associated app") ); | ||
253 | plugIcon->setName( plugin.guiPart->appName() ); | 207 | plugIcon->setName( plugin.guiPart->appName() ); |
254 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 208 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
255 | 209 | ||
@@ -259,79 +213,11 @@ void Today::loadPlugins() { | |||
259 | boxLayout->setStretchFactor( plugIcon, 1 ); | 213 | boxLayout->setStretchFactor( plugIcon, 1 ); |
260 | boxLayout->setStretchFactor( plugWidget, 9 ); | 214 | boxLayout->setStretchFactor( plugWidget, 9 ); |
261 | 215 | ||
262 | // "prebuffer" it in one more list, to get the sorting done | 216 | pluginList.insert( plugin.name, plugin ); |
263 | tempList.insert( plugin.name, plugin ); | ||
264 | |||
265 | // on first start the list is off course empty | ||
266 | if ( m_allApplets.isEmpty() ) { | ||
267 | pluginList.append( plugin ); | ||
268 | m_bblayout->addWidget( plugin.guiBox ); | 217 | m_bblayout->addWidget( plugin.guiBox ); |
269 | } | 218 | } |
270 | 219 | ||
271 | // if plugin is not yet in the list, add it to the layout too | 220 | m_bblayout->addStretch( 1 ); |
272 | else if ( !m_allApplets.contains( plugin.name ) ) { | ||
273 | pluginList.append( plugin ); | ||
274 | } | ||
275 | } else { | ||
276 | odebug << "could not recognize " << path + "/" + *it << oendl; | ||
277 | delete lib; | ||
278 | } | ||
279 | |||
280 | } | ||
281 | |||
282 | |||
283 | if ( !m_allApplets.isEmpty() ) { | ||
284 | TodayPlugin tempPlugin; | ||
285 | QStringList::Iterator stringit; | ||
286 | |||
287 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | ||
288 | tempPlugin = ( tempList.find( *stringit ) ).data(); | ||
289 | if ( !( (tempPlugin.name).isEmpty() ) ) { | ||
290 | pluginList.append( tempPlugin ); | ||
291 | m_bblayout->addWidget( tempPlugin.guiBox ); | ||
292 | } | ||
293 | } | ||
294 | } | ||
295 | m_bblayout->addStretch( 2 ); | ||
296 | draw(); | ||
297 | } | ||
298 | |||
299 | |||
300 | |||
301 | |||
302 | /** | ||
303 | * Repaint method. Reread all fields. | ||
304 | */ | ||
305 | void Today::draw() { | ||
306 | |||
307 | if ( pluginList.count() == 0 ) { | ||
308 | QLabel *noPlugins = new QLabel( this ); | ||
309 | noPlugins->setText( tr( "No plugins found" ) ); | ||
310 | layout->addWidget( noPlugins ); | ||
311 | return; | ||
312 | } | ||
313 | |||
314 | uint count = 0; | ||
315 | TodayPlugin plugin; | ||
316 | for ( uint i = 0; i < pluginList.count(); i++ ) { | ||
317 | plugin = pluginList[i]; | ||
318 | |||
319 | if ( plugin.active ) { | ||
320 | //odebug << plugin.name << " is ACTIVE " << oendl; | ||
321 | plugin.guiBox->show(); | ||
322 | } else { | ||
323 | //odebug << plugin.name << " is INACTIVE " << oendl; | ||
324 | plugin.guiBox->hide(); | ||
325 | } | ||
326 | count++; | ||
327 | } | ||
328 | |||
329 | if ( count == 0 ) { | ||
330 | QLabel *noPluginsActive = new QLabel( this ); | ||
331 | noPluginsActive->setText( tr( "No plugins activated" ) ); | ||
332 | layout->addWidget( noPluginsActive ); | ||
333 | } | ||
334 | repaint(); | ||
335 | } | 221 | } |
336 | 222 | ||
337 | 223 | ||
@@ -345,69 +231,24 @@ void Today::startConfig() { | |||
345 | m_refreshTimer->stop( ); | 231 | m_refreshTimer->stop( ); |
346 | 232 | ||
347 | TodayConfig conf( this, "dialog", true ); | 233 | TodayConfig conf( this, "dialog", true ); |
348 | 234 | conf.setUpPlugins( m_manager, m_pluginLoader ); | |
349 | TodayPlugin plugin; | ||
350 | QList<TodayConfigWidget> configWidgetList; | ||
351 | |||
352 | for ( int i = pluginList.count() - 1; i >= 0; i-- ) { | ||
353 | plugin = pluginList[i]; | ||
354 | |||
355 | // load the config widgets in the tabs | ||
356 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | ||
357 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | ||
358 | configWidgetList.append( widget ); | ||
359 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() | ||
360 | , plugin.guiPart->appName() ); | ||
361 | } | ||
362 | // set the order/activate tab | ||
363 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | ||
364 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | ||
365 | } | ||
366 | 235 | ||
367 | if ( conf.exec() == QDialog::Accepted ) { | 236 | if ( conf.exec() == QDialog::Accepted ) { |
368 | conf.writeConfig(); | 237 | conf.writeConfig(); |
369 | TodayConfigWidget *confWidget; | 238 | initialize(); |
370 | for ( confWidget = configWidgetList.first(); confWidget != 0; | ||
371 | confWidget = configWidgetList.next() ) { | ||
372 | confWidget->writeConfig(); | ||
373 | } | ||
374 | |||
375 | // make the plugins to reinitialize ( reread its configs ) | ||
376 | reinitialize(); | ||
377 | draw(); | ||
378 | |||
379 | } else { | 239 | } else { |
380 | // since refresh is not called in that case , reconnect the signal | 240 | // since reinitialize is not called in that case , reconnect the signal |
381 | m_refreshTimer->start( 15000 ); // get the config value in here later | 241 | m_refreshTimer->start( 15000 ); // get the config value in here later |
382 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 242 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
383 | } | 243 | } |
384 | } | 244 | } |
385 | 245 | ||
386 | 246 | ||
387 | 247 | void Today::initialize() { | |
388 | void Today::reinitialize() { | ||
389 | 248 | ||
390 | Config cfg( "today" ); | 249 | Config cfg( "today" ); |
391 | cfg.setGroup( "Plugins" ); | 250 | cfg.setGroup( "Plugins" ); |
392 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | ||
393 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | ||
394 | |||
395 | /* reinitialize all plugins */ | ||
396 | QValueList<TodayPlugin>::Iterator it; | ||
397 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { | ||
398 | if ( !(*it).excludeRefresh ) { | ||
399 | (*it).guiPart->reinitialize(); | ||
400 | odebug << "reinit" << oendl; | ||
401 | } | ||
402 | 251 | ||
403 | /* check if plugins is still to be shown */ | ||
404 | if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) { | ||
405 | (*it).active = true; | ||
406 | } else { | ||
407 | (*it).active = false; | ||
408 | } | ||
409 | |||
410 | } | ||
411 | 252 | ||
412 | cfg.setGroup( "General" ); | 253 | cfg.setGroup( "General" ); |
413 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 254 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
@@ -426,19 +267,45 @@ void Today::reinitialize() { | |||
426 | TodayLabel->show(); | 267 | TodayLabel->show(); |
427 | } | 268 | } |
428 | 269 | ||
270 | if ( m_bblayout ) { | ||
429 | delete m_bblayout; | 271 | delete m_bblayout; |
272 | } | ||
430 | m_bblayout = new QVBoxLayout( m_big_box ); | 273 | m_bblayout = new QVBoxLayout( m_big_box ); |
274 | |||
275 | if ( pluginList.count() == 0 ) { | ||
276 | QLabel *noPlugins = new QLabel( this ); | ||
277 | noPlugins->setText( tr( "No plugins found" ) ); | ||
278 | layout->addWidget( noPlugins ); | ||
279 | } else { | ||
280 | |||
281 | uint count = 0; | ||
431 | TodayPlugin tempPlugin; | 282 | TodayPlugin tempPlugin; |
432 | QStringList::Iterator stringit; | 283 | OPluginItem::List lst = m_pluginLoader->allAvailable( true ); |
284 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | ||
433 | 285 | ||
434 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | 286 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
435 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 287 | |
288 | tempPlugin = ( pluginList.find( (*it).name() ).data() ); | ||
436 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 289 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
290 | if ( (*it).isEnabled() ) { | ||
291 | iface->guiPart()->reinitialize(); | ||
292 | odebug << "reinit" << oendl; | ||
293 | tempPlugin.guiBox->show(); | ||
437 | m_bblayout->addWidget( tempPlugin.guiBox ); | 294 | m_bblayout->addWidget( tempPlugin.guiBox ); |
295 | count++; | ||
296 | } else { | ||
297 | tempPlugin.guiBox->hide(); | ||
438 | } | 298 | } |
439 | } | 299 | } |
440 | m_bblayout->addStretch( 2 ); | 300 | } |
441 | 301 | if ( count == 0 ) { | |
302 | QLabel *noPluginsActive = new QLabel( this ); | ||
303 | noPluginsActive->setText( tr( "No plugins activated" ) ); | ||
304 | layout->addWidget( noPluginsActive ); | ||
305 | } | ||
306 | } | ||
307 | m_bblayout->addStretch( 1 ); | ||
308 | repaint(); | ||
442 | } | 309 | } |
443 | 310 | ||
444 | /** | 311 | /** |
@@ -447,13 +314,13 @@ void Today::reinitialize() { | |||
447 | */ | 314 | */ |
448 | void Today::refresh() { | 315 | void Today::refresh() { |
449 | 316 | ||
450 | QValueList<TodayPlugin>::Iterator it; | 317 | OPluginItem::List lst = m_pluginLoader->filtered( true ); |
451 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { | 318 | |
452 | if ( !(*it).excludeRefresh ) { | 319 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { |
453 | (*it).guiPart->refresh(); | 320 | TodayPluginInterface* iface = m_pluginLoader->load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); |
321 | iface->guiPart()->refresh(); | ||
454 | odebug << "refresh" << oendl; | 322 | odebug << "refresh" << oendl; |
455 | } | 323 | } |
456 | } | ||
457 | 324 | ||
458 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); | 325 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); |
459 | 326 | ||
@@ -461,11 +328,13 @@ void Today::refresh() { | |||
461 | repaint(); | 328 | repaint(); |
462 | } | 329 | } |
463 | 330 | ||
331 | |||
464 | void Today::startApplication() { | 332 | void Today::startApplication() { |
465 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 333 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
466 | e << QString( sender()->name() ); | 334 | e << QString( sender()->name() ); |
467 | } | 335 | } |
468 | 336 | ||
337 | |||
469 | /** | 338 | /** |
470 | * launch addressbook (personal card) | 339 | * launch addressbook (personal card) |
471 | */ | 340 | */ |
@@ -473,6 +342,13 @@ void Today::editCard() { | |||
473 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); | 342 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); |
474 | } | 343 | } |
475 | 344 | ||
345 | |||
476 | Today::~Today() { | 346 | Today::~Today() { |
347 | if (m_pluginLoader) { | ||
348 | delete m_pluginLoader; | ||
349 | } | ||
350 | if (m_manager) { | ||
351 | delete m_manager; | ||
352 | } | ||
477 | } | 353 | } |
478 | 354 | ||