-rw-r--r-- | core/pim/today/today.cpp | 58 |
1 files changed, 22 insertions, 36 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index f052a9f..7537631 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -65,7 +65,5 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) setOwnerField(); - init(); - loadPlugins(); - draw(); + refresh(); showMaximized(); } @@ -119,5 +117,4 @@ void Today::init() { // read config Config cfg( "today" ); - cfg.setGroup( "Applets" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); @@ -137,4 +134,5 @@ void Today::loadPlugins() { pluginList.clear(); + QString path = QPEApplication::qpeDir() + "/plugins/today"; QDir dir( path, "lib*.so" ); @@ -143,5 +141,4 @@ void Today::loadPlugins() { QStringList::Iterator it; - uint count = 0; for ( it = list.begin(); it != list.end(); ++it ) { TodayPluginInterface *iface = 0; @@ -157,4 +154,5 @@ void Today::loadPlugins() { plugin.name = QString(*it); + // find out if plugins should be shown if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; @@ -177,5 +175,4 @@ void Today::loadPlugins() { QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); sv->setMinimumHeight( plugin.guiPart->minHeight() ); - //sv->setMaximumHeight( plugin.guiPart->maxHeight() ); sv->setResizePolicy( QScrollView::AutoOneFit ); sv->setHScrollBarMode( QScrollView::AlwaysOff ); @@ -191,5 +188,4 @@ void Today::loadPlugins() { pluginList.append( plugin ); - count++; } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); @@ -232,6 +228,6 @@ void Today::draw() { layout->addWidget( noPluginsActive ); } - - layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); + //layout->addStretch(0); + //layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); } @@ -245,5 +241,4 @@ void Today::startConfig() { TodayPlugin plugin; - QList<ConfigWidget> configWidgetList; for ( uint i = 0; i < pluginList.count(); i++ ) { @@ -268,27 +263,26 @@ void Today::startConfig() { confWidget->writeConfig(); } + refresh(); + } +} - init(); - - TodayPlugin plugin; - QValueList<TodayPlugin> plugList; - for ( uint i = 0; i < pluginList.count(); i++ ) { - plugin = pluginList[i]; - if ( m_excludeApplets.grep( plugin.name ).isEmpty() ) { - qDebug("CONFIG " + plugin.name + " ACTIVE"); - plugin.active = true; - } else { - qDebug("CONFIG " + plugin.name + " INACTIVE"); - plugin.active = false; - } - plugList.append( plugin ); - } - pluginList = plugList; +/** + * Refresh for the view. Reload all applets + * + */ +void Today::refresh() { + init(); - draw(); + if ( layout ) { + delete layout; } -} + layout = new QVBoxLayout( this ); + layout->addWidget( Frame ); + layout->addWidget( OwnerField ); + loadPlugins(); + draw(); +} void Today::startAddressbook() { @@ -309,12 +303,4 @@ void Today::editCard() { } -/* - * launches an App - */ -void Today::launchApp( QString appName ) { - QCopEnvelope e( "QPE/System", "execute(QString)" ); - e << QString( appName ); -} - Today::~Today() { } |