summaryrefslogtreecommitdiff
path: root/core/pim/today/today.cpp
Unidiff
Diffstat (limited to 'core/pim/today/today.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/today.cpp42
1 files changed, 25 insertions, 17 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 91028c8..1f758f2 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -67,13 +67,14 @@ Today::Today( QWidget* parent, const char* name, WFlags fl )
67#endif 67#endif
68 68
69 setOwnerField(); 69 setOwnerField();
70 m_refreshTimer = new QTimer( this ); 70 m_refreshTimer = new QTimer( this );
71 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 71 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
72 m_refreshTimer->start( 15000 ); 72 m_refreshTimer->start( 15000 );
73 refresh(); 73 init();
74 loadPlugins();
74 showMaximized(); 75 showMaximized();
75} 76}
76 77
77/** 78/**
78 * Qcop receive method. 79 * Qcop receive method.
79 */ 80 */
@@ -133,12 +134,27 @@ void Today::init() {
133 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); 134 m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' );
134 m_allApplets = cfg.readListEntry( "AllApplets", ',' ); 135 m_allApplets = cfg.readListEntry( "AllApplets", ',' );
135 136
136 cfg.setGroup( "General" ); 137 cfg.setGroup( "General" );
137 m_iconSize = cfg.readNumEntry( "IconSize", 18 ); 138 m_iconSize = cfg.readNumEntry( "IconSize", 18 );
138 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); 139 setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
140
141
142 // qDebug(" refresh ");
143 // set the date in top label
144 QDate date = QDate::currentDate();
145 QString time = ( tr( date.toString() ) );
146
147 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) );
148
149 if ( layout ) {
150 delete layout;
151 }
152 layout = new QVBoxLayout( this );
153 layout->addWidget( Frame );
154 layout->addWidget( OwnerField );
139} 155}
140 156
141 157
142/** 158/**
143 * Load the plugins 159 * Load the plugins
144 */ 160 */
@@ -263,12 +279,13 @@ void Today::loadPlugins() {
263 if ( !( (tempPlugin.name).isEmpty() ) ) { 279 if ( !( (tempPlugin.name).isEmpty() ) ) {
264 layout->addWidget( tempPlugin.guiBox ); 280 layout->addWidget( tempPlugin.guiBox );
265 pluginList.append( tempPlugin ); 281 pluginList.append( tempPlugin );
266 } 282 }
267 } 283 }
268 } 284 }
285 draw();
269} 286}
270 287
271 288
272/** 289/**
273 * Repaint method. Reread all fields. 290 * Repaint method. Reread all fields.
274 */ 291 */
@@ -337,13 +354,13 @@ void Today::startConfig() {
337 conf.writeConfig(); 354 conf.writeConfig();
338 TodayConfigWidget *confWidget; 355 TodayConfigWidget *confWidget;
339 for ( confWidget = configWidgetList.first(); confWidget != 0; 356 for ( confWidget = configWidgetList.first(); confWidget != 0;
340 confWidget = configWidgetList.next() ) { 357 confWidget = configWidgetList.next() ) {
341 confWidget->writeConfig(); 358 confWidget->writeConfig();
342 } 359 }
343 refresh(); 360 loadPlugins();
344 } else { 361 } else {
345 // since refresh is not called in that case , reconnect the signal 362 // since refresh is not called in that case , reconnect the signal
346 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); 363 connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) );
347 } 364 }
348} 365}
349 366
@@ -352,28 +369,19 @@ void Today::startConfig() {
352 * Refresh for the view. Reload all applets 369 * Refresh for the view. Reload all applets
353 * 370 *
354 */ 371 */
355void Today::refresh() { 372void Today::refresh() {
356 init(); 373 init();
357 374
358 // qDebug(" refresh "); 375 QValueList<TodayPlugin>::Iterator it;
359 // set the date in top label 376 for ( it = pluginList.begin(); it != pluginList.end(); ++it ) {
360 QDate date = QDate::currentDate(); 377 if ( !(*it).excludeRefresh ) {
361 QString time = ( tr( date.toString() ) ); 378 (*it).guiPart->refresh();
362 379 qDebug( "refresh" );
363 DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); 380 }
364
365 if ( layout ) {
366 delete layout;
367 } 381 }
368 layout = new QVBoxLayout( this );
369 layout->addWidget( Frame );
370 layout->addWidget( OwnerField );
371
372 loadPlugins();
373 draw();
374} 382}
375 383
376void Today::startApplication() { 384void Today::startApplication() {
377 QCopEnvelope e( "QPE/System", "execute(QString)" ); 385 QCopEnvelope e( "QPE/System", "execute(QString)" );
378 e << QString( sender()->name() ); 386 e << QString( sender()->name() );
379} 387}