-rw-r--r-- | core/pim/today/today.cpp | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 8184730..3eda5c0 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -47,2 +47,3 @@ struct TodayPlugin { bool active; + bool excludeRefresh; int pos; @@ -88,3 +89,8 @@ void Today::setRefreshTimer( int interval ) { - if ( m_refreshTimerEnabled ) { + + disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); + + // 0 is "never" case + if ( !interval == 0 ) { + connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); m_refreshTimer->changeInterval( interval ); @@ -131,4 +137,3 @@ void Today::init() { m_iconSize = cfg.readNumEntry( "IconSize", 18 ); - m_refreshTimer->changeInterval( cfg.readNumEntry( "checkinterval", 15000 ) ); - + setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); } @@ -141,4 +146,12 @@ void Today::loadPlugins() { + // extra list for plugins that exclude themself from periodic refresh + QMap<QString, TodayPlugin> pluginListRefreshExclude; + QValueList<TodayPlugin>::Iterator tit; + if ( !pluginList.isEmpty() ) { for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { + if ( (*tit).excludeRefresh ) { + pluginListRefreshExclude.insert( (*tit).name , (*tit) ); + qDebug( "Found an plug that does not want refresh feature" ); + } else { (*tit).library->unload(); @@ -146,3 +159,6 @@ void Today::loadPlugins() { } + } pluginList.clear(); + } + @@ -164,2 +180,10 @@ void Today::loadPlugins() { qDebug( QString(*it) ); + + // If plugin is exludes from refresh, get it in the list again here. + + if ( pluginListRefreshExclude.contains( (*it) ) ) { + tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); + qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name ); + } else { + TodayPlugin plugin; @@ -176,2 +200,3 @@ void Today::loadPlugins() { plugin.guiPart = plugin.iface->guiPart(); + plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); @@ -209,2 +234,3 @@ void Today::loadPlugins() { } + } } else { @@ -218,2 +244,3 @@ void Today::loadPlugins() { QStringList::Iterator stringit; + for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { @@ -270,2 +297,5 @@ void Today::startConfig() { + // disconnect timer to prevent problems while being on config dialog + disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); + TodayConfig conf( this, "dialog", true ); @@ -298,2 +328,5 @@ void Today::startConfig() { refresh(); + } else { + // since refresh is not called in that case , reconnect the signal + connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); } |