author | harlekin <harlekin> | 2002-09-17 17:30:39 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-09-17 17:30:39 (UTC) |
commit | a1b2f800f53715452f75153218e33fcd8907bbbf (patch) (side-by-side diff) | |
tree | 878078c578767c1d14ed5c082709b233201b8244 | |
parent | e1614b49cf61ee37350828ce5b5178a9da752f39 (diff) | |
download | opie-a1b2f800f53715452f75153218e33fcd8907bbbf.zip opie-a1b2f800f53715452f75153218e33fcd8907bbbf.tar.gz opie-a1b2f800f53715452f75153218e33fcd8907bbbf.tar.bz2 |
activation and deactivation of plugins works now
-rw-r--r-- | core/pim/today/today.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 066a5a8..2095174 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -121,197 +121,197 @@ void Today::init() { // read config Config cfg( "today" ); cfg.setGroup( "Applets" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); } /** * Load the plugins */ void Today::loadPlugins() { QValueList<TodayPlugin>::Iterator tit; for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { (*tit).library->unload(); delete (*tit).library; } pluginList.clear(); QString path = QPEApplication::qpeDir() + "/plugins/today"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; uint count = 0; 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) ); TodayPlugin plugin; plugin.library = lib; plugin.iface = iface; plugin.name = QString(*it); if ( m_excludeApplets.grep( *it ).isEmpty() ) { plugin.active = true; } else { plugin.active = false; } plugin.guiPart = plugin.iface->guiPart(); plugin.guiBox = new QHBox( this ); QPixmap plugPix; plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( 18, 18 ), 0 ); OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); plugIcon->setPixmap( plugPix ); QScrollView* sv = new QScrollView( plugin.guiBox ); 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 ); sv->setFrameShape( QFrame::NoFrame ); sv->addChild( plugWidget ); //plugin.guiBox->addWidget( plugIcon, 0, AlignTop ); //plugin.guiBox->addWidget( sv, 0, AlignTop ); plugin.guiBox->setStretchFactor( plugIcon, 1 ); plugin.guiBox->setStretchFactor( sv, 9 ); layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); count++; } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } } } /** * Repaint method. Reread all fields. */ void Today::draw() { if ( pluginList.count() == 0 ) { QLabel *noPlugins = new QLabel( this ); noPlugins->setText( tr( "No plugins found" ) ); layout->addWidget( noPlugins ); return; } uint count = 0; TodayPlugin plugin; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; if ( plugin.active ) { qDebug( plugin.name + " is ACTIVE " ); - // QHBoxLayout* plugLayout = new QHBoxLayout( this ); plugin.guiBox->show(); } else { - // plugin.guiWidget->hide(); qDebug( plugin.name + " is INACTIVE" ); plugin.guiBox->hide(); } count++; } if ( count == 0 ) { QLabel *noPluginsActive = new QLabel( this ); noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } layout->addItem( new QSpacerItem( 1,1, QSizePolicy::Minimum, QSizePolicy::Expanding ) ); } /** * The method for the configuration dialog. */ void Today::startConfig() { TodayConfig conf( this, "dialog", true ); TodayPlugin plugin; QList<ConfigWidget> configWidgetList; for ( uint i = 0; i < pluginList.count(); i++ ) { plugin = pluginList[i]; // load the config widgets in the tabs if ( plugin.guiPart->configWidget( this ) != 0l ) { ConfigWidget* widget = plugin.guiPart->configWidget( this ); configWidgetList.append( widget ); conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() ); } // set the order/activate tab conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); } if ( conf.exec() == QDialog::Accepted ) { conf.writeConfig(); ConfigWidget *confWidget; for ( confWidget = configWidgetList.first(); confWidget != 0; confWidget = configWidgetList.next() ) { confWidget->writeConfig(); } 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; draw(); } } void Today::startAddressbook() { QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( "addressbook" ); } /** * launch addressbook (personal card) */ void Today::editCard() { startAddressbook(); while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { qApp->processEvents(); } QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); } /* * launches an App */ void Today::launchApp( QString appName ) { - QCopEnvelope e( "QPE/System", "execute(QString)" ); - e << QString( appName ); + QCopEnvelope e( "QPE/System", "execute(QString)" ); + e << QString( appName ); } Today::~Today() { } |