author | harlekin <harlekin> | 2002-10-31 17:09:01 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-31 17:09:01 (UTC) |
commit | 16fcb285f9ba7c514fc3f2695768a82feeb7182b (patch) (unidiff) | |
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,6 +1,11 @@ | |||
1 | 0.6 | ||
2 | |||
3 | * longer refresh intervals possible | ||
4 | * plugins can decide now if they want to take part in refresh cycles | ||
5 | |||
1 | 0.5.2 | 6 | 0.5.2 |
2 | 7 | ||
3 | * refresh settings | 8 | * refresh settings |
4 | * only launch datebook config when clicked on a date ( opie only ) | 9 | * only launch datebook config when clicked on a date ( opie only ) |
5 | * less qcop trouble on sharps retail rom | 10 | * less qcop trouble on sharps retail rom |
6 | 11 | ||
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,12 +1,12 @@ | |||
1 | Files: bin/today apps/1Pim/today.desktop pics/today/* | 1 | Files: bin/today apps/1Pim/today.desktop pics/today/* |
2 | Priority: optional | 2 | Priority: optional |
3 | Section: opie/applications | 3 | Section: opie/applications |
4 | Maintainer: Maximilian Reiß <harlekin@handhelds.org> | 4 | Maintainer: Maximilian Reiß <harlekin@handhelds.org> |
5 | Architecture: arm | 5 | Architecture: arm |
6 | Version: 0.5.2-$SUB_VERSION | 6 | Version: 0.6-$SUB_VERSION |
7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) | 7 | Depends: opie-base ($QPE_VERSION), libopie ($QPE_VERSION) |
8 | License: GPL | 8 | License: GPL |
9 | Description: today screen | 9 | Description: today screen |
10 | This today screen app gives an overview of appointments | 10 | This today screen app gives an overview of appointments |
11 | and todos. | 11 | and todos. |
12 | It also shows incoming and outgoing mails from opiemail. | 12 | It also shows incoming and outgoing mails from opiemail. |
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 | |||
@@ -54,6 +54,9 @@ TodayConfigWidget* DatebookPlugin::configWidget( QWidget* wid ) { | |||
54 | } | 54 | } |
55 | 55 | ||
56 | QString DatebookPlugin::appName() const { | 56 | QString DatebookPlugin::appName() const { |
57 | return "datebook"; | 57 | return "datebook"; |
58 | } | 58 | } |
59 | 59 | ||
60 | bool DatebookPlugin::excludeFromRefresh() const { | ||
61 | return false; | ||
62 | } | ||
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 | |||
@@ -33,11 +33,11 @@ public: | |||
33 | double versionNumber() const; | 33 | double versionNumber() const; |
34 | QString pixmapNameWidget() const; | 34 | QString pixmapNameWidget() const; |
35 | QWidget* widget( QWidget *); | 35 | QWidget* widget( QWidget *); |
36 | QString pixmapNameConfig() const; | 36 | QString pixmapNameConfig() const; |
37 | TodayConfigWidget* configWidget( QWidget *); | 37 | TodayConfigWidget* configWidget( QWidget *); |
38 | QString appName() const; | 38 | QString appName() const; |
39 | 39 | bool excludeFromRefresh() const; | |
40 | }; | 40 | }; |
41 | 41 | ||
42 | 42 | ||
43 | #endif | 43 | #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 | |||
@@ -51,6 +51,10 @@ TodayConfigWidget* MailPlugin::configWidget( QWidget* wid ) { | |||
51 | 51 | ||
52 | QString MailPlugin::appName() const { | 52 | QString MailPlugin::appName() const { |
53 | return "mail"; | 53 | return "mail"; |
54 | } | 54 | } |
55 | 55 | ||
56 | 56 | ||
57 | bool MailPlugin::excludeFromRefresh() const { | ||
58 | return false; | ||
59 | } | ||
60 | |||
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 | |||
@@ -37,11 +37,10 @@ public: | |||
37 | double versionNumber() const; | 37 | double versionNumber() const; |
38 | QString pixmapNameWidget() const; | 38 | QString pixmapNameWidget() const; |
39 | QWidget* widget(QWidget *); | 39 | QWidget* widget(QWidget *); |
40 | QString pixmapNameConfig() const; | 40 | QString pixmapNameConfig() const; |
41 | TodayConfigWidget* configWidget(QWidget *); | 41 | TodayConfigWidget* configWidget(QWidget *); |
42 | QString appName() const; | 42 | QString appName() const; |
43 | 43 | bool excludeFromRefresh() const; | |
44 | |||
45 | }; | 44 | }; |
46 | 45 | ||
47 | #endif | 46 | #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 | |||
@@ -53,6 +53,9 @@ TodayConfigWidget* TodolistPlugin::configWidget( QWidget* wid ) { | |||
53 | 53 | ||
54 | QString TodolistPlugin::appName() const { | 54 | QString TodolistPlugin::appName() const { |
55 | return "todolist"; | 55 | return "todolist"; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | bool TodolistPlugin::excludeFromRefresh() const { | ||
60 | return false; | ||
61 | } | ||
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 | |||
@@ -34,10 +34,10 @@ public: | |||
34 | double versionNumber() const; | 34 | double versionNumber() const; |
35 | QString pixmapNameWidget() const; | 35 | QString pixmapNameWidget() const; |
36 | QWidget* widget(QWidget *); | 36 | QWidget* widget(QWidget *); |
37 | QString pixmapNameConfig() const; | 37 | QString pixmapNameConfig() const; |
38 | TodayConfigWidget* configWidget(QWidget *); | 38 | TodayConfigWidget* configWidget(QWidget *); |
39 | QString appName() const; | 39 | QString appName() const; |
40 | 40 | bool excludeFromRefresh() const; | |
41 | }; | 41 | }; |
42 | 42 | ||
43 | #endif | 43 | #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 | |||
@@ -42,12 +42,13 @@ struct TodayPlugin { | |||
42 | QLibrary *library; | 42 | QLibrary *library; |
43 | TodayPluginInterface *iface; | 43 | TodayPluginInterface *iface; |
44 | TodayPluginObject *guiPart; | 44 | TodayPluginObject *guiPart; |
45 | QWidget *guiBox; | 45 | QWidget *guiBox; |
46 | QString name; | 46 | QString name; |
47 | bool active; | 47 | bool active; |
48 | bool excludeRefresh; | ||
48 | int pos; | 49 | int pos; |
49 | }; | 50 | }; |
50 | 51 | ||
51 | static QValueList<TodayPlugin> pluginList; | 52 | static QValueList<TodayPlugin> pluginList; |
52 | 53 | ||
53 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 54 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
@@ -83,13 +84,18 @@ void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | |||
83 | setOwnerField( message ); | 84 | setOwnerField( message ); |
84 | } | 85 | } |
85 | } | 86 | } |
86 | 87 | ||
87 | void Today::setRefreshTimer( int interval ) { | 88 | void Today::setRefreshTimer( int interval ) { |
88 | 89 | ||
89 | if ( m_refreshTimerEnabled ) { | 90 | |
91 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
92 | |||
93 | // 0 is "never" case | ||
94 | if ( !interval == 0 ) { | ||
95 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
90 | m_refreshTimer->changeInterval( interval ); | 96 | m_refreshTimer->changeInterval( interval ); |
91 | } | 97 | } |
92 | } | 98 | } |
93 | 99 | ||
94 | 100 | ||
95 | /** | 101 | /** |
@@ -126,28 +132,38 @@ void Today::init() { | |||
126 | cfg.setGroup( "Plugins" ); | 132 | cfg.setGroup( "Plugins" ); |
127 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); | 133 | m_excludeApplets = cfg.readListEntry( "ExcludeApplets", ',' ); |
128 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); | 134 | m_allApplets = cfg.readListEntry( "AllApplets", ',' ); |
129 | 135 | ||
130 | cfg.setGroup( "General" ); | 136 | cfg.setGroup( "General" ); |
131 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); | 137 | m_iconSize = cfg.readNumEntry( "IconSize", 18 ); |
132 | m_refreshTimer->changeInterval( cfg.readNumEntry( "checkinterval", 15000 ) ); | 138 | setRefreshTimer( cfg.readNumEntry( "checkinterval", 15000 ) ); |
133 | |||
134 | } | 139 | } |
135 | 140 | ||
136 | 141 | ||
137 | /** | 142 | /** |
138 | * Load the plugins | 143 | * Load the plugins |
139 | */ | 144 | */ |
140 | void Today::loadPlugins() { | 145 | void Today::loadPlugins() { |
141 | 146 | ||
147 | // extra list for plugins that exclude themself from periodic refresh | ||
148 | QMap<QString, TodayPlugin> pluginListRefreshExclude; | ||
149 | |||
142 | QValueList<TodayPlugin>::Iterator tit; | 150 | QValueList<TodayPlugin>::Iterator tit; |
151 | if ( !pluginList.isEmpty() ) { | ||
143 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 152 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
153 | if ( (*tit).excludeRefresh ) { | ||
154 | pluginListRefreshExclude.insert( (*tit).name , (*tit) ); | ||
155 | qDebug( "Found an plug that does not want refresh feature" ); | ||
156 | } else { | ||
144 | (*tit).library->unload(); | 157 | (*tit).library->unload(); |
145 | delete (*tit).library; | 158 | delete (*tit).library; |
146 | } | 159 | } |
160 | } | ||
147 | pluginList.clear(); | 161 | pluginList.clear(); |
162 | } | ||
163 | |||
148 | 164 | ||
149 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 165 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
150 | QDir dir( path, "lib*.so" ); | 166 | QDir dir( path, "lib*.so" ); |
151 | 167 | ||
152 | QStringList list = dir.entryList(); | 168 | QStringList list = dir.entryList(); |
153 | QStringList::Iterator it; | 169 | QStringList::Iterator it; |
@@ -159,24 +175,33 @@ void Today::loadPlugins() { | |||
159 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 175 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
160 | 176 | ||
161 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 177 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
162 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 178 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
163 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 179 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); |
164 | qDebug( QString(*it) ); | 180 | qDebug( QString(*it) ); |
181 | |||
182 | // If plugin is exludes from refresh, get it in the list again here. | ||
183 | |||
184 | if ( pluginListRefreshExclude.contains( (*it) ) ) { | ||
185 | tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); | ||
186 | qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name ); | ||
187 | } else { | ||
188 | |||
165 | TodayPlugin plugin; | 189 | TodayPlugin plugin; |
166 | plugin.library = lib; | 190 | plugin.library = lib; |
167 | plugin.iface = iface; | 191 | plugin.iface = iface; |
168 | plugin.name = QString(*it); | 192 | plugin.name = QString(*it); |
169 | 193 | ||
170 | // find out if plugins should be shown | 194 | // find out if plugins should be shown |
171 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 195 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
172 | plugin.active = true; | 196 | plugin.active = true; |
173 | } else { | 197 | } else { |
174 | plugin.active = false; | 198 | plugin.active = false; |
175 | } | 199 | } |
176 | plugin.guiPart = plugin.iface->guiPart(); | 200 | plugin.guiPart = plugin.iface->guiPart(); |
201 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | ||
177 | 202 | ||
178 | // package the whole thing into a qwidget so it can be shown and hidden | 203 | // package the whole thing into a qwidget so it can be shown and hidden |
179 | plugin.guiBox = new QWidget( this ); | 204 | plugin.guiBox = new QWidget( this ); |
180 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 205 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
181 | QPixmap plugPix; | 206 | QPixmap plugPix; |
182 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 207 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
@@ -204,21 +229,23 @@ void Today::loadPlugins() { | |||
204 | 229 | ||
205 | // on first start the list is off course empty | 230 | // on first start the list is off course empty |
206 | if ( m_allApplets.isEmpty() ) { | 231 | if ( m_allApplets.isEmpty() ) { |
207 | layout->addWidget( plugin.guiBox ); | 232 | layout->addWidget( plugin.guiBox ); |
208 | pluginList.append( plugin ); | 233 | pluginList.append( plugin ); |
209 | } | 234 | } |
235 | } | ||
210 | } else { | 236 | } else { |
211 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); | 237 | qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); |
212 | delete lib; | 238 | delete lib; |
213 | } | 239 | } |
214 | } | 240 | } |
215 | 241 | ||
216 | if ( !m_allApplets.isEmpty() ) { | 242 | if ( !m_allApplets.isEmpty() ) { |
217 | TodayPlugin tempPlugin; | 243 | TodayPlugin tempPlugin; |
218 | QStringList::Iterator stringit; | 244 | QStringList::Iterator stringit; |
245 | |||
219 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { | 246 | for( stringit = m_allApplets.begin(); stringit != m_allApplets.end(); ++stringit ) { |
220 | tempPlugin = ( tempList.find( *stringit ) ).data(); | 247 | tempPlugin = ( tempList.find( *stringit ) ).data(); |
221 | if ( !( (tempPlugin.name).isEmpty() ) ) { | 248 | if ( !( (tempPlugin.name).isEmpty() ) ) { |
222 | layout->addWidget( tempPlugin.guiBox ); | 249 | layout->addWidget( tempPlugin.guiBox ); |
223 | pluginList.append( tempPlugin ); | 250 | pluginList.append( tempPlugin ); |
224 | } | 251 | } |
@@ -265,12 +292,15 @@ void Today::draw() { | |||
265 | 292 | ||
266 | /** | 293 | /** |
267 | * The method for the configuration dialog. | 294 | * The method for the configuration dialog. |
268 | */ | 295 | */ |
269 | void Today::startConfig() { | 296 | void Today::startConfig() { |
270 | 297 | ||
298 | // disconnect timer to prevent problems while being on config dialog | ||
299 | disconnect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
300 | |||
271 | TodayConfig conf( this, "dialog", true ); | 301 | TodayConfig conf( this, "dialog", true ); |
272 | 302 | ||
273 | TodayPlugin plugin; | 303 | TodayPlugin plugin; |
274 | QList<TodayConfigWidget> configWidgetList; | 304 | QList<TodayConfigWidget> configWidgetList; |
275 | 305 | ||
276 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | 306 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { |
@@ -293,12 +323,15 @@ void Today::startConfig() { | |||
293 | TodayConfigWidget *confWidget; | 323 | TodayConfigWidget *confWidget; |
294 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 324 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
295 | confWidget = configWidgetList.next() ) { | 325 | confWidget = configWidgetList.next() ) { |
296 | confWidget->writeConfig(); | 326 | confWidget->writeConfig(); |
297 | } | 327 | } |
298 | refresh(); | 328 | refresh(); |
329 | } else { | ||
330 | // since refresh is not called in that case , reconnect the signal | ||
331 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | ||
299 | } | 332 | } |
300 | } | 333 | } |
301 | 334 | ||
302 | 335 | ||
303 | /** | 336 | /** |
304 | * Refresh for the view. Reload all applets | 337 | * Refresh for the view. Reload all applets |
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 | |||
@@ -101,14 +101,16 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) | |||
101 | 101 | ||
102 | QHBox *hbox_refresh = new QHBox( tab_3 ); | 102 | QHBox *hbox_refresh = new QHBox( tab_3 ); |
103 | QLabel *refreshLabel = new QLabel( hbox_refresh ); | 103 | QLabel *refreshLabel = new QLabel( hbox_refresh ); |
104 | refreshLabel->setText( tr( "Refresh" ) ); | 104 | refreshLabel->setText( tr( "Refresh" ) ); |
105 | QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); | 105 | QWhatsThis::add( refreshLabel, tr( "How often should Today refresh itself" ) ); |
106 | SpinRefresh = new QSpinBox( hbox_refresh ); | 106 | SpinRefresh = new QSpinBox( hbox_refresh ); |
107 | SpinRefresh->setMinValue( 2 ); | 107 | SpinRefresh->setMinValue( 0 ); |
108 | SpinRefresh->setSuffix( tr( " seconds" ) ); | 108 | SpinRefresh->setSuffix( tr( " sec" ) ); |
109 | SpinRefresh->setMaxValue ( 7200 ); | ||
110 | SpinRefresh->setSpecialValueText ( tr("never") ); | ||
109 | QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); | 111 | QWhatsThis::add( SpinRefresh, tr( "How often should Today refresh itself" ) ); |
110 | 112 | ||
111 | tab3Layout->addWidget( hbox_auto ); | 113 | tab3Layout->addWidget( hbox_auto ); |
112 | tab3Layout->addWidget( hbox_inactive ); | 114 | tab3Layout->addWidget( hbox_inactive ); |
113 | tab3Layout->addWidget( hbox_iconSize ); | 115 | tab3Layout->addWidget( hbox_iconSize ); |
114 | tab3Layout->addWidget( hbox_refresh ); | 116 | tab3Layout->addWidget( hbox_refresh ); |