-rw-r--r-- | core/pim/today/today.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 3eda5c0..01ef02d 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -143,25 +143,25 @@ void Today::init() { * Load the plugins */ 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" ); + qDebug( "Found an plugin that does not want refresh feature" ); } else { (*tit).library->unload(); delete (*tit).library; } } pluginList.clear(); } QString path = QPEApplication::qpeDir() + "/plugins/today"; QDir dir( path, "lib*.so" ); @@ -173,39 +173,48 @@ void Today::loadPlugins() { for ( it = list.begin(); it != list.end(); ++it ) { TodayPluginInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); 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 ); + + // if its not in allApplets list, add it to a layout + if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { + qDebug( "NUGASDA" ); + layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); + pluginList.append( pluginListRefreshExclude[(*it)] ); + } else { + tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); + qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name ); + } } else { TodayPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it); // find out if plugins should be shown if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; } + plugin.guiPart = plugin.iface->guiPart(); plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); // package the whole thing into a qwidget so it can be shown and hidden plugin.guiBox = new QWidget( this ); QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); QPixmap plugPix; plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); plugIcon->setPixmap( plugPix ); QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); plugIcon->setName( plugin.guiPart->appName() ); @@ -223,24 +232,30 @@ void Today::loadPlugins() { boxLayout->addWidget( plugIcon, 0, AlignTop ); boxLayout->addWidget( sv, 0, AlignTop ); boxLayout->setStretchFactor( plugIcon, 1 ); boxLayout->setStretchFactor( sv, 9 ); // "prebuffer" it in one more list, to get the sorting done tempList.insert( plugin.name, plugin ); // on first start the list is off course empty if ( m_allApplets.isEmpty() ) { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); } + + // if plugin is not yet in the list, add it to the layout too + if ( !m_allApplets.contains( plugin.name ) ) { + layout->addWidget( plugin.guiBox ); + pluginList.append( plugin ); + } } } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } } if ( !m_allApplets.isEmpty() ) { TodayPlugin tempPlugin; QStringList::Iterator stringit; for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { |