-rw-r--r-- | core/pim/today/today.cpp | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 7537631..d8b427d 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -110,12 +110,8 @@ void Today::setOwnerField( QString &message ) { void Today::init() { - - QDate date = QDate::currentDate(); - QString time = ( tr( date.toString() ) ); - - DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); - // read config Config cfg( "today" ); - cfg.setGroup( "Applets" ); + cfg.setGroup( "Plugins" ); + m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); + m_allApplets = cfg.readListEntry( "AllApplets", ',' ); } @@ -135,3 +131,2 @@ void Today::loadPlugins() { - QString path = QPEApplication::qpeDir() + "/plugins/today"; @@ -142,2 +137,5 @@ void Today::loadPlugins() { + + QMap<QString, TodayPlugin> tempList; + for ( it = list.begin(); it != list.end(); ++it ) { @@ -166,3 +164,2 @@ void Today::loadPlugins() { QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); - QPixmap plugPix; @@ -171,3 +168,2 @@ void Today::loadPlugins() { plugIcon->setPixmap( plugPix ); - // a scrollview for each plugin @@ -180,3 +176,2 @@ void Today::loadPlugins() { sv->addChild( plugWidget ); - // make sure the icon is on the top alligned @@ -186,5 +181,10 @@ void Today::loadPlugins() { boxLayout->setStretchFactor( sv, 9 ); - layout->addWidget( plugin.guiBox ); + // "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 ); + } } else { @@ -194,2 +194,14 @@ void Today::loadPlugins() { } + + if ( !m_allApplets.isEmpty() ) { + TodayPlugin tempPlugin; + QStringList::Iterator stringit; + for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { + tempPlugin = ( tempList.find( *stringit ) ).data(); + if ( !( (tempPlugin.name).isEmpty() ) ) { + layout->addWidget( tempPlugin.guiBox ); + pluginList.append( tempPlugin ); + } + } + } } @@ -229,4 +241,3 @@ void Today::draw() { } - //layout->addStretch(0); - //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + layout->addStretch(0); } @@ -243,3 +254,4 @@ void Today::startConfig() { QList<ConfigWidget> configWidgetList; - for ( uint i = 0; i < pluginList.count(); i++ ) { + + for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { plugin = pluginList[i]; @@ -248,3 +260,3 @@ void Today::startConfig() { if ( plugin.guiPart->configWidget( this ) != 0l ) { - ConfigWidget* widget = plugin.guiPart->configWidget( this ); + ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); configWidgetList.append( widget ); @@ -276,2 +288,8 @@ void Today::refresh() { + // set the date in top label + QDate date = QDate::currentDate(); + QString time = ( tr( date.toString() ) ); + + DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); + if ( layout ) { |