-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 | 159 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 6 |
10 files changed, 119 insertions, 70 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 +1,6 @@ | |||
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 |
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 | |||
@@ -5,3 +5,3 @@ 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) |
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 | |||
@@ -59 +59,4 @@ QString DatebookPlugin::appName() const { | |||
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 | |||
@@ -38,3 +38,3 @@ public: | |||
38 | QString appName() const; | 38 | QString appName() const; |
39 | 39 | bool excludeFromRefresh() const; | |
40 | }; | 40 | }; |
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 | |||
@@ -56 +56,5 @@ QString MailPlugin::appName() const { | |||
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 | |||
@@ -42,4 +42,3 @@ public: | |||
42 | QString appName() const; | 42 | QString appName() const; |
43 | 43 | bool excludeFromRefresh() const; | |
44 | |||
45 | }; | 44 | }; |
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 | |||
@@ -58 +58,4 @@ QString TodolistPlugin::appName() const { | |||
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 | |||
@@ -39,3 +39,3 @@ public: | |||
39 | QString appName() const; | 39 | QString appName() const; |
40 | 40 | bool excludeFromRefresh() const; | |
41 | }; | 41 | }; |
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 | |||
@@ -47,2 +47,3 @@ struct TodayPlugin { | |||
47 | bool active; | 47 | bool active; |
48 | bool excludeRefresh; | ||
48 | int pos; | 49 | int pos; |
@@ -78,8 +79,8 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
78 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 79 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
79 | QDataStream stream( data, IO_ReadOnly ); | 80 | QDataStream stream( data, IO_ReadOnly ); |
80 | if ( msg == "message(QString)" ) { | 81 | if ( msg == "message(QString)" ) { |
81 | QString message; | 82 | QString message; |
82 | stream >> message; | 83 | stream >> message; |
83 | setOwnerField( message ); | 84 | setOwnerField( message ); |
84 | } | 85 | } |
85 | } | 86 | } |
@@ -88,3 +89,8 @@ 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 ); |
@@ -100,8 +106,8 @@ void Today::setOwnerField() { | |||
100 | if ( QFile::exists( file ) ) { | 106 | if ( QFile::exists( file ) ) { |
101 | Contact cont = Contact::readVCard( file )[0]; | 107 | Contact cont = Contact::readVCard( file )[0]; |
102 | QString returnString = cont.fullName(); | 108 | QString returnString = cont.fullName(); |
103 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); | 109 | OwnerField->setText( "<b>" + tr ( "Owned by " ) + returnString + "</b>" ); |
104 | } else { | 110 | } else { |
105 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); | 111 | OwnerField->setText( "<b>" + tr ( "Please fill out the business card" ) + " </b>" ); |
106 | } | 112 | } |
107 | } | 113 | } |
@@ -131,4 +137,3 @@ void Today::init() { | |||
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 | } |
@@ -141,8 +146,19 @@ 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; |
143 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { | 151 | if ( !pluginList.isEmpty() ) { |
144 | (*tit).library->unload(); | 152 | for ( tit = pluginList.begin(); tit != pluginList.end(); ++tit ) { |
145 | delete (*tit).library; | 153 | if ( (*tit).excludeRefresh ) { |
154 | pluginListRefreshExclude.insert( (*tit).name , (*tit) ); | ||
155 | qDebug( "Found an plug that does not want refresh feature" ); | ||
156 | } else { | ||
157 | (*tit).library->unload(); | ||
158 | delete (*tit).library; | ||
159 | } | ||
160 | } | ||
161 | pluginList.clear(); | ||
146 | } | 162 | } |
147 | pluginList.clear(); | 163 | |
148 | 164 | ||
@@ -164,46 +180,56 @@ void Today::loadPlugins() { | |||
164 | qDebug( QString(*it) ); | 180 | qDebug( QString(*it) ); |
165 | TodayPlugin plugin; | 181 | |
166 | plugin.library = lib; | 182 | // If plugin is exludes from refresh, get it in the list again here. |
167 | plugin.iface = iface; | 183 | |
168 | plugin.name = QString(*it); | 184 | if ( pluginListRefreshExclude.contains( (*it) ) ) { |
169 | 185 | tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); | |
170 | // find out if plugins should be shown | 186 | qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name ); |
171 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | ||
172 | plugin.active = true; | ||
173 | } else { | 187 | } else { |
174 | plugin.active = false; | 188 | |
175 | } | 189 | TodayPlugin plugin; |
176 | plugin.guiPart = plugin.iface->guiPart(); | 190 | plugin.library = lib; |
177 | 191 | plugin.iface = iface; | |
178 | // package the whole thing into a qwidget so it can be shown and hidden | 192 | plugin.name = QString(*it); |
179 | plugin.guiBox = new QWidget( this ); | 193 | |
180 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 194 | // find out if plugins should be shown |
181 | QPixmap plugPix; | 195 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
182 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 196 | plugin.active = true; |
183 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 197 | } else { |
184 | plugIcon->setPixmap( plugPix ); | 198 | plugin.active = false; |
185 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); | 199 | } |
186 | plugIcon->setName( plugin.guiPart->appName() ); | 200 | plugin.guiPart = plugin.iface->guiPart(); |
187 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); | 201 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
188 | // a scrollview for each plugin | 202 | |
189 | QScrollView* sv = new QScrollView( plugin.guiBox ); | 203 | // package the whole thing into a qwidget so it can be shown and hidden |
190 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); | 204 | plugin.guiBox = new QWidget( this ); |
191 | // not sure if that is good .-) | 205 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
192 | sv->setMinimumHeight( 10 ); | 206 | QPixmap plugPix; |
193 | sv->setResizePolicy( QScrollView::AutoOneFit ); | 207 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
194 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | 208 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
195 | sv->setFrameShape( QFrame::NoFrame ); | 209 | plugIcon->setPixmap( plugPix ); |
196 | sv->addChild( plugWidget ); | 210 | QWhatsThis::add( plugIcon, tr("Click here to launch the associated app") ); |
197 | // make sure the icon is on the top alligned | 211 | plugIcon->setName( plugin.guiPart->appName() ); |
198 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | 212 | connect( plugIcon, SIGNAL( clicked() ), this, SLOT( startApplication() ) ); |
199 | boxLayout->addWidget( sv, 0, AlignTop ); | 213 | // a scrollview for each plugin |
200 | boxLayout->setStretchFactor( plugIcon, 1 ); | 214 | QScrollView* sv = new QScrollView( plugin.guiBox ); |
201 | boxLayout->setStretchFactor( sv, 9 ); | 215 | QWidget *plugWidget = plugin.guiPart->widget( sv->viewport() ); |
202 | // "prebuffer" it in one more list, to get the sorting done | 216 | // not sure if that is good .-) |
203 | tempList.insert( plugin.name, plugin ); | 217 | sv->setMinimumHeight( 10 ); |
204 | 218 | sv->setResizePolicy( QScrollView::AutoOneFit ); | |
205 | // on first start the list is off course empty | 219 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); |
206 | if ( m_allApplets.isEmpty() ) { | 220 | sv->setFrameShape( QFrame::NoFrame ); |
207 | layout->addWidget( plugin.guiBox ); | 221 | sv->addChild( plugWidget ); |
208 | pluginList.append( plugin ); | 222 | // make sure the icon is on the top alligned |
223 | boxLayout->addWidget( plugIcon, 0, AlignTop ); | ||
224 | boxLayout->addWidget( sv, 0, AlignTop ); | ||
225 | boxLayout->setStretchFactor( plugIcon, 1 ); | ||
226 | boxLayout->setStretchFactor( sv, 9 ); | ||
227 | // "prebuffer" it in one more list, to get the sorting done | ||
228 | tempList.insert( plugin.name, plugin ); | ||
229 | |||
230 | // on first start the list is off course empty | ||
231 | if ( m_allApplets.isEmpty() ) { | ||
232 | layout->addWidget( plugin.guiBox ); | ||
233 | pluginList.append( plugin ); | ||
234 | } | ||
209 | } | 235 | } |
@@ -218,2 +244,3 @@ void Today::loadPlugins() { | |||
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 ) { |
@@ -270,5 +297,8 @@ 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; |
@@ -298,2 +328,5 @@ void Today::startConfig() { | |||
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 | } |
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 | |||
@@ -106,4 +106,6 @@ TodayConfig::TodayConfig( QWidget* parent, const char* name, bool modal ) | |||
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" ) ); |