summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-10-31 17:09:01 (UTC)
committer harlekin <harlekin>2002-10-31 17:09:01 (UTC)
commit16fcb285f9ba7c514fc3f2695768a82feeb7182b (patch) (side-by-side diff)
tree4b1b09287dd339e7138608464c309f938f89e257
parentba60ce32edbad5e743494c0de33534258ee5d80c (diff)
downloadopie-16fcb285f9ba7c514fc3f2695768a82feeb7182b.zip
opie-16fcb285f9ba7c514fc3f2695768a82feeb7182b.tar.gz
opie-16fcb285f9ba7c514fc3f2695768a82feeb7182b.tar.bz2
started support for plugins without refresh, not finished yet
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/pim/today/changelog5
-rw-r--r--core/pim/today/opie-today.control2
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.cpp3
-rw-r--r--core/pim/today/plugins/datebook/datebookplugin.h2
-rw-r--r--core/pim/today/plugins/mail/mailplugin.cpp4
-rw-r--r--core/pim/today/plugins/mail/mailplugin.h3
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.cpp3
-rw-r--r--core/pim/today/plugins/todolist/todoplugin.h2
-rw-r--r--core/pim/today/today.cpp39
-rw-r--r--core/pim/today/todayconfig.cpp6
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,3 +1,8 @@
+0.6
+
+* longer refresh intervals possible
+* plugins can decide now if they want to take part in refresh cycles
+
0.5.2
* refresh settings
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
@@ -3,7 +3,7 @@ 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
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
@@ -57,3 +57,6 @@ 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
@@ -36,7 +36,7 @@ public:
QString pixmapNameConfig() const;
TodayConfigWidget* configWidget( QWidget *);
QString appName() const;
-
+ bool excludeFromRefresh() const;
};
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
@@ -54,3 +54,7 @@ QString MailPlugin::appName() const {
}
+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
@@ -40,8 +40,7 @@ public:
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
@@ -56,3 +56,6 @@ QString TodolistPlugin::appName() const {
}
+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
@@ -37,7 +37,7 @@ public:
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
@@ -45,6 +45,7 @@ struct TodayPlugin {
QWidget *guiBox;
QString name;
bool active;
+ bool excludeRefresh;
int pos;
};
@@ -86,7 +87,12 @@ void Today::channelReceived( const QCString &msg, const QByteArray & data ) {
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 );
}
}
@@ -129,8 +135,7 @@ void Today::init() {
cfg.setGroup( "General" );
m_iconSize = cfg.readNumEntry( "IconSize", 18 );
- m_refreshTimer->changeInterval( cfg.readNumEntry( "checkinterval", 15000 ) );
-
+ setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) );
}
@@ -139,12 +144,23 @@ void Today::init() {
*/
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" );
@@ -162,6 +178,14 @@ void Today::loadPlugins() {
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;
@@ -174,6 +198,7 @@ void Today::loadPlugins() {
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 );
@@ -207,6 +232,7 @@ void Today::loadPlugins() {
layout->addWidget( plugin.guiBox );
pluginList.append( plugin );
}
+ }
} else {
qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() );
delete lib;
@@ -216,6 +242,7 @@ 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() ) ) {
@@ -268,6 +295,9 @@ void Today::draw() {
*/
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;
@@ -296,6 +326,9 @@ void Today::startConfig() {
confWidget->writeConfig();
}
refresh();
+ } else {
+ // since refresh is not called in that case , reconnect the signal
+ connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( 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
@@ -104,8 +104,10 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal )
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 );