author | waspe <waspe> | 2003-11-04 16:41:07 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-11-04 16:41:07 (UTC) |
commit | da5c9b06fe0081050ab8165cf3d189dbc8117bf6 (patch) (unidiff) | |
tree | 30dd36ad48413c39aa348ff5a49e130ef6ee2e4e /core/pim | |
parent | efcd8d6a743261194b55df3afeec956fde9886d4 (diff) | |
download | opie-da5c9b06fe0081050ab8165cf3d189dbc8117bf6.zip opie-da5c9b06fe0081050ab8165cf3d189dbc8117bf6.tar.gz opie-da5c9b06fe0081050ab8165cf3d189dbc8117bf6.tar.bz2 |
resolved merge conflict
-rw-r--r-- | core/pim/today/today.cpp | 152 |
1 files changed, 114 insertions, 38 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index cb18c1c..dd8d59b 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -49,4 +49,6 @@ struct TodayPlugin { | |||
49 | static QValueList<TodayPlugin> pluginList; | 49 | static QValueList<TodayPlugin> pluginList; |
50 | 50 | ||
51 | static QMap<QString, TodayPlugin> tempList; | ||
52 | |||
51 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 53 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
52 | : TodayBase( parent, name, fl ) { | 54 | : TodayBase( parent, name, fl ) { |
@@ -67,5 +69,20 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
67 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 69 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
68 | m_refreshTimer->start( 15000 ); | 70 | m_refreshTimer->start( 15000 ); |
69 | //init(); | 71 | m_big_box = 0L; |
72 | |||
73 | |||
74 | layout = new QVBoxLayout( this ); | ||
75 | layout->addWidget( Frame ); | ||
76 | layout->addWidget( OwnerField ); | ||
77 | |||
78 | m_sv = new QScrollView( this ); | ||
79 | m_sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
80 | m_sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
81 | m_sv->setFrameShape( QFrame::NoFrame ); | ||
82 | |||
83 | layout->addWidget( m_sv ); | ||
84 | layout->setStretchFactor( m_sv,4 ); | ||
85 | |||
86 | qApp->processEvents(); | ||
70 | loadPlugins(); | 87 | loadPlugins(); |
71 | showMaximized(); | 88 | showMaximized(); |
@@ -133,13 +150,9 @@ void Today::init() { | |||
133 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 150 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
134 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); | 151 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); |
135 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | 152 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
136 | 153 | ||
137 | // set the date in top label | 154 | // set the date in top label |
138 | QDate date = QDate::currentDate(); | 155 | QDate date = QDate::currentDate(); |
139 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); | 156 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); |
140 | |||
141 | if ( layout ) { | ||
142 | delete layout; | ||
143 | } | ||
144 | 157 | ||
145 | if ( m_hideBanner ) { | 158 | if ( m_hideBanner ) { |
@@ -151,7 +164,11 @@ void Today::init() { | |||
151 | } | 164 | } |
152 | 165 | ||
153 | layout = new QVBoxLayout( this ); | 166 | if ( m_big_box ) { |
154 | layout->addWidget( Frame ); | 167 | delete m_big_box; |
155 | layout->addWidget( OwnerField ); | 168 | } |
169 | |||
170 | m_big_box = new QWidget( m_sv->viewport() ); | ||
171 | m_sv->addChild( m_big_box ); | ||
172 | m_bblayout = new QVBoxLayout ( m_big_box ); | ||
156 | } | 173 | } |
157 | 174 | ||
@@ -162,4 +179,5 @@ void Today::loadPlugins() { | |||
162 | 179 | ||
163 | init(); | 180 | init(); |
181 | |||
164 | QValueList<TodayPlugin>::Iterator tit; | 182 | QValueList<TodayPlugin>::Iterator tit; |
165 | if ( !pluginList.isEmpty() ) { | 183 | if ( !pluginList.isEmpty() ) { |
@@ -185,7 +203,5 @@ void Today::loadPlugins() { | |||
185 | QStringList::Iterator it; | 203 | QStringList::Iterator it; |
186 | 204 | ||
187 | qWarning("Found: %d entries !", list.count() ); | 205 | // QMap<QString, TodayPlugin> tempList; |
188 | |||
189 | QMap<QString, TodayPlugin> tempList; | ||
190 | 206 | ||
191 | for ( it = list.begin(); it != list.end(); ++it ) { | 207 | for ( it = list.begin(); it != list.end(); ++it ) { |
@@ -223,4 +239,5 @@ void Today::loadPlugins() { | |||
223 | } | 239 | } |
224 | 240 | ||
241 | |||
225 | // find out if plugins should be shown | 242 | // find out if plugins should be shown |
226 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 243 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
@@ -234,5 +251,5 @@ void Today::loadPlugins() { | |||
234 | 251 | ||
235 | // package the whole thing into a qwidget so it can be shown and hidden | 252 | // package the whole thing into a qwidget so it can be shown and hidden |
236 | plugin.guiBox = new QWidget( this ); | 253 | plugin.guiBox = new QWidget( m_big_box ); |
237 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 254 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
238 | QPixmap plugPix; | 255 | QPixmap plugPix; |
@@ -243,30 +260,22 @@ void Today::loadPlugins() { | |||
243 | plugIcon->setName( plugin.guiPart->appName() ); | 260 | plugIcon->setName( plugin.guiPart->appName() ); |
244 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 261 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
245 | // a scrollview for each plugin | 262 | |
246 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 263 | QWidget *plugWidget = plugin.guiPart->widget( plugin.guiBox ); |
247 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | ||
248 | // not sure if that is good .-) | ||
249 | sv->setMinimumHeight( 12 ); | ||
250 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
251 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
252 | sv->setFrameShape( QFrame::NoFrame ); | ||
253 | sv->addChild( plugWidget ); | ||
254 | // make sure the icon is on the top alligned | ||
255 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 264 | boxLayout->addWidget( plugIcon, 0, AlignTop ); |
256 | boxLayout->addWidget( sv, 0, AlignTop ); | 265 | boxLayout->addWidget( plugWidget, 0, AlignTop ); |
257 | boxLayout->setStretchFactor( plugIcon, 1 ); | 266 | boxLayout->setStretchFactor( plugIcon, 1 ); |
258 | boxLayout->setStretchFactor( sv, 9 ); | 267 | boxLayout->setStretchFactor( plugWidget, 9 ); |
259 | // "prebuffer" it in one more list, to get the sorting done | 268 | |
269 | // "prebuffer" it in one more list, to get the sorting done | ||
260 | tempList.insert( plugin.name, plugin ); | 270 | tempList.insert( plugin.name, plugin ); |
261 | 271 | ||
262 | // on first start the list is off course empty | 272 | // on first start the list is off course empty |
263 | if ( m_allApplets.isEmpty() ) { | 273 | if ( m_allApplets.isEmpty() ) { |
264 | layout->addWidget( plugin.guiBox ); | ||
265 | pluginList.append( plugin ); | 274 | pluginList.append( plugin ); |
275 | m_bblayout->addWidget( plugin.guiBox ); | ||
266 | } | 276 | } |
267 | 277 | ||
268 | // if plugin is not yet in the list, add it to the layout too | 278 | // if plugin is not yet in the list, add it to the layout too |
269 | else if ( !m_allApplets.contains( plugin.name ) ) { | 279 | else if ( !m_allApplets.contains( plugin.name ) ) { |
270 | layout->addWidget( plugin.guiBox ); | ||
271 | pluginList.append( plugin ); | 280 | pluginList.append( plugin ); |
272 | } | 281 | } |
@@ -275,6 +284,8 @@ void Today::loadPlugins() { | |||
275 | delete lib; | 284 | delete lib; |
276 | } | 285 | } |
286 | |||
277 | } | 287 | } |
278 | 288 | ||
289 | |||
279 | if ( !m_allApplets.isEmpty() ) { | 290 | if ( !m_allApplets.isEmpty() ) { |
280 | TodayPlugin tempPlugin; | 291 | TodayPlugin tempPlugin; |
@@ -284,13 +295,16 @@ void Today::loadPlugins() { | |||
284 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 295 | tempPlugin = ( tempList.find( *stringit ) ).data(); |
285 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 296 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
286 | layout->addWidget( tempPlugin.guiBox ); | ||
287 | pluginList.append( tempPlugin ); | 297 | pluginList.append( tempPlugin ); |
298 | m_bblayout->addWidget( tempPlugin.guiBox ); | ||
288 | } | 299 | } |
289 | } | 300 | } |
290 | } | 301 | } |
302 | m_bblayout->addStretch( 2 ); | ||
291 | draw(); | 303 | draw(); |
292 | } | 304 | } |
293 | 305 | ||
294 | 306 | ||
307 | |||
308 | |||
295 | /** | 309 | /** |
296 | * Repaint method. Reread all fields. | 310 | * Repaint method. Reread all fields. |
@@ -325,5 +339,5 @@ void Today::draw() { | |||
325 | layout->addWidget( noPluginsActive ); | 339 | layout->addWidget( noPluginsActive ); |
326 | } | 340 | } |
327 | layout->addStretch(0); | 341 | repaint(); |
328 | } | 342 | } |
329 | 343 | ||
@@ -365,13 +379,74 @@ void Today::startConfig() { | |||
365 | confWidget->writeConfig(); | 379 | confWidget->writeConfig(); |
366 | } | 380 | } |
367 | loadPlugins(); | 381 | |
382 | // make the plugins to reinitialize ( reread its configs ) | ||
383 | reinitialize(); | ||
384 | draw(); | ||
385 | |||
368 | } else { | 386 | } else { |
369 | // since refresh is not called in that case , reconnect the signal | 387 | // since refresh is not called in that case , reconnect the signal |
370 | m_refreshTimer->start( 15000 ); // get the config value in here later | 388 | m_refreshTimer->start( 15000 ); // get the config value in here later |
371 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 389 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
372 | } | 390 | } |
373 | } | 391 | } |
374 | 392 | ||
375 | 393 | ||
394 | |||
395 | void Today::reinitialize() { | ||
396 | |||
397 | Config cfg( "today" ); | ||
398 | cfg.setGroup( "Plugins" ); | ||
399 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | ||
400 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | ||
401 | |||
402 | /* reinitialize all plugins */ | ||
403 | QValueList<TodayPlugin>::Iterator it; | ||
404 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { | ||
405 | if ( !(*it).excludeRefresh ) { | ||
406 | (*it).guiPart->reinitialize(); | ||
407 | qDebug( "reinit" ); | ||
408 | } | ||
409 | |||
410 | /* check if plugins is still to be shown */ | ||
411 | if ( m_excludeApplets.grep( (*it).name ).isEmpty() ) { | ||
412 | (*it).active = true; | ||
413 | } else { | ||
414 | (*it).active = false; | ||
415 | } | ||
416 | |||
417 | } | ||
418 | |||
419 | cfg.setGroup( "General" ); | ||
420 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | ||
421 | m_hideBanner = cfg.readNumEntry( "HideBanner", 0 ); | ||
422 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); | ||
423 | |||
424 | // set the date in top label | ||
425 | QDate date = QDate::currentDate(); | ||
426 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( date ) + "</font>" ) ); | ||
427 | |||
428 | if ( m_hideBanner ) { | ||
429 | Opiezilla->hide(); | ||
430 | TodayLabel->hide(); | ||
431 | } else { | ||
432 | Opiezilla->show(); | ||
433 | TodayLabel->show(); | ||
434 | } | ||
435 | |||
436 | delete m_bblayout; | ||
437 | m_bblayout = new QVBoxLayout( m_big_box ); | ||
438 | TodayPlugin tempPlugin; | ||
439 | QStringList::Iterator stringit; | ||
440 | |||
441 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | ||
442 | tempPlugin = ( tempList.find( *stringit ) ).data(); | ||
443 | if ( !( (tempPlugin.name).isEmpty() ) ) { | ||
444 | m_bblayout->addWidget( tempPlugin.guiBox ); | ||
445 | } | ||
446 | } | ||
447 | m_bblayout->addStretch( 2 ); | ||
448 | |||
449 | } | ||
450 | |||
376 | /** | 451 | /** |
377 | * Refresh for the view. Reload all applets | 452 | * Refresh for the view. Reload all applets |
@@ -380,15 +455,16 @@ void Today::startConfig() { | |||
380 | void Today::refresh() { | 455 | void Today::refresh() { |
381 | 456 | ||
382 | init(); | ||
383 | |||
384 | QValueList<TodayPlugin>::Iterator it; | 457 | QValueList<TodayPlugin>::Iterator it; |
385 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { | 458 | for ( it = pluginList.begin(); it != pluginList.end(); ++it ) { |
386 | if ( !(*it).excludeRefresh ) { | 459 | if ( !(*it).excludeRefresh ) { |
387 | (*it).guiPart->refresh(); | 460 | (*it).guiPart->refresh(); |
388 | layout->addWidget( (*it).guiBox ); | ||
389 | qDebug( "refresh" ); | 461 | qDebug( "refresh" ); |
390 | } | 462 | } |
391 | } | 463 | } |
392 | layout->addStretch(0); | 464 | |
465 | DateLabel->setText( QString( "<font color=#FFFFFF>" + TimeString::longDateString( QDate::currentDate() ) + "</font>" ) ); | ||
466 | |||
467 | updateGeometry(); | ||
468 | repaint(); | ||
393 | } | 469 | } |
394 | 470 | ||