author | harlekin <harlekin> | 2002-10-31 17:09:01 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-31 17:09:01 (UTC) |
commit | 16fcb285f9ba7c514fc3f2695768a82feeb7182b (patch) (side-by-side diff) | |
tree | 4b1b09287dd339e7138608464c309f938f89e257 | |
parent | ba60ce32edbad5e743494c0de33534258ee5d80c (diff) | |
download | opie-16fcb285f9ba7c514fc3f2695768a82feeb7182b.zip opie-16fcb285f9ba7c514fc3f2695768a82feeb7182b.tar.gz opie-16fcb285f9ba7c514fc3f2695768a82feeb7182b.tar.bz2 |
started support for plugins without refresh, not finished yet
-rw-r--r-- | core/pim/today/changelog | 5 | ||||
-rw-r--r-- | core/pim/today/opie-today.control | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.cpp | 3 | ||||
-rw-r--r-- | core/pim/today/plugins/datebook/datebookplugin.h | 2 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/plugins/mail/mailplugin.h | 3 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.cpp | 3 | ||||
-rw-r--r-- | core/pim/today/plugins/todolist/todoplugin.h | 2 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 39 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 6 |
10 files changed, 59 insertions, 10 deletions
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index 93abdcb..ba3cdbc 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog @@ -1,12 +1,17 @@ +0.6 + +* longer refresh intervals possible +* plugins can decide now if they want to take part in refresh cycles + 0.5.2 * refresh settings * only launch datebook config when clicked on a date ( opie only ) * less qcop trouble on sharps retail rom 0.5.1 * icons scalable and clickable again 0.5 diff --git a/core/pim/today/opie-today.control b/core/pim/today/opie-today.control index 267a195..acdcf8e 100644 --- a/core/pim/today/opie-today.control +++ b/core/pim/today/opie-today.control @@ -1,16 +1,16 @@ Files: bin/today apps/1Pim/today.desktop pics/today/* Priority: optional Section: opie/applications Maintainer: Maximilian Reiß <harlekin@handhelds.org> Architecture: arm -Version: 0.5.2-$SUB_VERSION +Version: 0.6-$SUB_VERSION Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) License: GPL Description: today screen This today screen app gives an overview of appointments and todos. It also shows incoming and outgoing mails from opiemail. When using Opie (opie.handhelds.org) today can be autostarted on resume. It is highly configurable. diff --git a/core/pim/today/plugins/datebook/datebookplugin.cpp b/core/pim/today/plugins/datebook/datebookplugin.cpp index cacdb65..eda84be 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.cpp +++ b/core/pim/today/plugins/datebook/datebookplugin.cpp @@ -48,12 +48,15 @@ QWidget* DatebookPlugin::widget( QWidget* wid ) { QString DatebookPlugin::pixmapNameConfig() const { return "DateBook"; } TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { return new DatebookPluginConfig( wid , "Datebook" ); } QString DatebookPlugin::appName() const { return "datebook"; } +bool DatebookPlugin::excludeFromRefresh() const { + return false; +} diff --git a/core/pim/today/plugins/datebook/datebookplugin.h b/core/pim/today/plugins/datebook/datebookplugin.h index 4d0f8e6..13c62a9 100644 --- a/core/pim/today/plugins/datebook/datebookplugin.h +++ b/core/pim/today/plugins/datebook/datebookplugin.h @@ -27,17 +27,17 @@ class DatebookPlugin : public TodayPluginObject { public: DatebookPlugin(); ~DatebookPlugin(); QString pluginName() const; double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget( QWidget *); QString pixmapNameConfig() const; TodayConfigWidget* configWidget( QWidget *); QString appName() const; - + bool excludeFromRefresh() const; }; #endif diff --git a/core/pim/today/plugins/mail/mailplugin.cpp b/core/pim/today/plugins/mail/mailplugin.cpp index 1c90df4..d497970 100644 --- a/core/pim/today/plugins/mail/mailplugin.cpp +++ b/core/pim/today/plugins/mail/mailplugin.cpp @@ -45,12 +45,16 @@ QString MailPlugin::pixmapNameConfig() const { return 0l; } TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) { return 0l; } QString MailPlugin::appName() const { return "mail"; } +bool MailPlugin::excludeFromRefresh() const { + return false; +} + diff --git a/core/pim/today/plugins/mail/mailplugin.h b/core/pim/today/plugins/mail/mailplugin.h index d2a3dcb..c937b9e 100644 --- a/core/pim/today/plugins/mail/mailplugin.h +++ b/core/pim/today/plugins/mail/mailplugin.h @@ -31,17 +31,16 @@ class MailPlugin : public TodayPluginObject { public: MailPlugin(); ~MailPlugin(); QString pluginName() const; double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget(QWidget *); QString pixmapNameConfig() const; TodayConfigWidget* configWidget(QWidget *); QString appName() const; - - + bool excludeFromRefresh() const; }; #endif diff --git a/core/pim/today/plugins/todolist/todoplugin.cpp b/core/pim/today/plugins/todolist/todoplugin.cpp index 09b54af..e10b414 100644 --- a/core/pim/today/plugins/todolist/todoplugin.cpp +++ b/core/pim/today/plugins/todolist/todoplugin.cpp @@ -47,12 +47,15 @@ QString TodolistPlugin::pixmapNameConfig() const { return "TodoList"; } TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { return new TodolistPluginConfig( wid , "Todolist" ); } QString TodolistPlugin::appName() const { return "todolist"; } +bool TodolistPlugin::excludeFromRefresh() const { + return false; +} diff --git a/core/pim/today/plugins/todolist/todoplugin.h b/core/pim/today/plugins/todolist/todoplugin.h index 0a6669f..f98afdb 100644 --- a/core/pim/today/plugins/todolist/todoplugin.h +++ b/core/pim/today/plugins/todolist/todoplugin.h @@ -28,16 +28,16 @@ class TodolistPlugin : public TodayPluginObject { public: TodolistPlugin(); ~TodolistPlugin(); QString pluginName() const; double versionNumber() const; QString pixmapNameWidget() const; QWidget* widget(QWidget *); QString pixmapNameConfig() const; TodayConfigWidget* configWidget(QWidget *); QString appName() const; - + bool excludeFromRefresh() const; }; #endif 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 @@ -36,24 +36,25 @@ #include <opie/otabwidget.h> #include <qdialog.h> #include <qwhatsthis.h> struct TodayPlugin { QLibrary *library; TodayPluginInterface *iface; TodayPluginObject *guiPart; QWidget *guiBox; QString name; bool active; + bool excludeRefresh; int pos; }; static QValueList<TodayPlugin> pluginList; Today::Today( QWidget* parent, const char* name, WFlags fl ) : TodayBase( parent, name, fl ) { QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); #if defined(Q_WS_QWS) @@ -77,25 +78,30 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) */ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { QDataStream stream( data, IO_ReadOnly ); if ( msg == "message(QString)" ) { QString message; stream >> message; setOwnerField( message ); } } 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 ); } } /** * Initialises the owner field with the default value, the username */ void Today::setOwnerField() { QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); if ( QFile::exists( file ) ) { Contact cont = Contact::readVCard( file )[0]; @@ -120,69 +126,88 @@ void Today::setOwnerField( QString &message ) { * Init stuff needed for today. Reads the config file. */ void Today::init() { // read config Config cfg( "today" ); cfg.setGroup( "Plugins" ); m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); m_allApplets = cfg.readListEntry( "AllApplets", ',' ); cfg.setGroup( "General" ); m_iconSize = cfg.readNumEntry( "IconSize", 18 ); - m_refreshTimer->changeInterval( cfg.readNumEntry( "checkinterval", 15000 ) ); - + setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); } /** * 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" ); + } else { (*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; QMap<QString, TodayPlugin> tempList; 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 ); + } 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() ); connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); // a scrollview for each plugin @@ -198,33 +223,35 @@ 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 ); } + } } 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 ) { tempPlugin = ( tempList.find( *stringit ) ).data(); if ( !( (tempPlugin.name).isEmpty() ) ) { layout->addWidget( tempPlugin.guiBox ); pluginList.append( tempPlugin ); } } } } /** @@ -259,24 +286,27 @@ void Today::draw() { noPluginsActive->setText( tr( "No plugins activated" ) ); layout->addWidget( noPluginsActive ); } layout->addStretch(0); } /** * The method for the configuration dialog. */ 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 ); TodayPlugin plugin; QList<TodayConfigWidget> configWidgetList; for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { plugin = pluginList[i]; // load the config widgets in the tabs if ( plugin.guiPart->configWidget( this ) != 0l ) { TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); configWidgetList.append( widget ); @@ -287,24 +317,27 @@ void Today::startConfig() { conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); } if ( conf.exec() == QDialog::Accepted ) { conf.writeConfig(); TodayConfigWidget *confWidget; for ( confWidget = configWidgetList.first(); confWidget != 0; confWidget = configWidgetList.next() ) { confWidget->writeConfig(); } refresh(); + } else { + // since refresh is not called in that case , reconnect the signal + connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); } } /** * Refresh for the view. Reload all applets * */ void Today::refresh() { init(); qDebug(" refresh "); diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp index db1141a..8d0b069 100644 --- a/core/pim/today/todayconfig.cpp +++ b/core/pim/today/todayconfig.cpp @@ -95,26 +95,28 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) QLabel *iconSizeLabel = new QLabel( hbox_iconSize, "iconSizeLabel" ); iconSizeLabel->setText( tr( "Icon size" ) ); QWhatsThis::add( iconSizeLabel, tr( "Set the icon size in pixel" ) ); SpinBoxIconSize = new QSpinBox( hbox_iconSize, "TimeSpinner" ); SpinBoxIconSize->setMaxValue( 32 ); QWhatsThis::add( SpinBoxIconSize, tr( "Set the icon size in pixel" ) ); QHBox *hbox_refresh = new QHBox( tab_3 ); QLabel *refreshLabel = new QLabel( hbox_refresh ); refreshLabel->setText( tr( "Refresh" ) ); QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); SpinRefresh = new QSpinBox( hbox_refresh ); - SpinRefresh->setMinValue( 2 ); - SpinRefresh->setSuffix( tr( " seconds" ) ); + SpinRefresh->setMinValue( 0 ); + SpinRefresh->setSuffix( tr( " sec" ) ); + SpinRefresh->setMaxValue ( 7200 ); + SpinRefresh->setSpecialValueText ( tr("never") ); QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); tab3Layout->addWidget( hbox_auto ); tab3Layout->addWidget( hbox_inactive ); tab3Layout->addWidget( hbox_iconSize ); tab3Layout->addWidget( hbox_refresh ); TabWidget3->addTab( tab_3, "SettingsIcon", tr( "Misc" ) ); m_applets_changed = false; connect ( m_appletListView , SIGNAL( clicked ( QListViewItem * ) ), this, SLOT( appletChanged ( ) ) ); |