-rw-r--r-- | core/pim/today/today.cpp | 159 |
1 files changed, 96 insertions, 63 deletions
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 | |||
@@ -24,219 +24,246 @@ | |||
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/contact.h> | 26 | #include <qpe/contact.h> |
27 | 27 | ||
28 | #include <qdir.h> | 28 | #include <qdir.h> |
29 | #include <qfile.h> | 29 | #include <qfile.h> |
30 | #include <qpushbutton.h> | 30 | #include <qpushbutton.h> |
31 | #include <qlabel.h> | 31 | #include <qlabel.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qpixmap.h> | 33 | #include <qpixmap.h> |
34 | #include <qlayout.h> | 34 | #include <qlayout.h> |
35 | #include <qhbox.h> | 35 | #include <qhbox.h> |
36 | #include <opie/otabwidget.h> | 36 | #include <opie/otabwidget.h> |
37 | #include <qdialog.h> | 37 | #include <qdialog.h> |
38 | #include <qwhatsthis.h> | 38 | #include <qwhatsthis.h> |
39 | 39 | ||
40 | 40 | ||
41 | struct TodayPlugin { | 41 | 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 ) |
54 | : TodayBase( parent, name, fl ) { | 55 | : TodayBase( parent, name, fl ) { |
55 | 56 | ||
56 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 57 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
57 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 58 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
58 | 59 | ||
59 | #if defined(Q_WS_QWS) | 60 | #if defined(Q_WS_QWS) |
60 | #if !defined(QT_NO_COP) | 61 | #if !defined(QT_NO_COP) |
61 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 62 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
62 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 63 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
63 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 64 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
64 | #endif | 65 | #endif |
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | setOwnerField(); | 68 | setOwnerField(); |
68 | m_refreshTimer = new QTimer( this ); | 69 | m_refreshTimer = new QTimer( this ); |
69 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 70 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
70 | m_refreshTimer->start( 15000 ); | 71 | m_refreshTimer->start( 15000 ); |
71 | refresh(); | 72 | refresh(); |
72 | showMaximized(); | 73 | showMaximized(); |
73 | } | 74 | } |
74 | 75 | ||
75 | /** | 76 | /** |
76 | * Qcop receive method. | 77 | * Qcop receive method. |
77 | */ | 78 | */ |
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 | } |
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 | /** |
96 | * Initialises the owner field with the default value, the username | 102 | * Initialises the owner field with the default value, the username |
97 | */ | 103 | */ |
98 | void Today::setOwnerField() { | 104 | void Today::setOwnerField() { |
99 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); | 105 | QString file = Global::applicationFileName( "addressbook", "businesscard.vcf" ); |
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 | } |
108 | 114 | ||
109 | /** | 115 | /** |
110 | * Set the owner field with a given QString, for example per qcop. | 116 | * Set the owner field with a given QString, for example per qcop. |
111 | */ | 117 | */ |
112 | void Today::setOwnerField( QString &message ) { | 118 | void Today::setOwnerField( QString &message ) { |
113 | if ( !message.isEmpty() ) { | 119 | if ( !message.isEmpty() ) { |
114 | OwnerField->setText( "<b>" + message + "</b>" ); | 120 | OwnerField->setText( "<b>" + message + "</b>" ); |
115 | } | 121 | } |
116 | } | 122 | } |
117 | 123 | ||
118 | 124 | ||
119 | /** | 125 | /** |
120 | * Init stuff needed for today. Reads the config file. | 126 | * Init stuff needed for today. Reads the config file. |
121 | */ | 127 | */ |
122 | void Today::init() { | 128 | void Today::init() { |
123 | // read config | 129 | // read config |
124 | Config cfg( "today" ); | 130 | Config cfg( "today" ); |
125 | 131 | ||
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; |
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 | ||
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; |
154 | 170 | ||
155 | QMap<QString, TodayPlugin> tempList; | 171 | QMap<QString, TodayPlugin> tempList; |
156 | 172 | ||
157 | for ( it = list.begin(); it != list.end(); ++it ) { | 173 | for ( it = list.begin(); it != list.end(); ++it ) { |
158 | TodayPluginInterface *iface = 0; | 174 | TodayPluginInterface *iface = 0; |
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) ); |
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 | } |
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 | } |
225 | } | 252 | } |
226 | } | 253 | } |
227 | } | 254 | } |
228 | 255 | ||
229 | 256 | ||
230 | /** | 257 | /** |
231 | * Repaint method. Reread all fields. | 258 | * Repaint method. Reread all fields. |
232 | */ | 259 | */ |
233 | void Today::draw() { | 260 | void Today::draw() { |
234 | 261 | ||
235 | if ( pluginList.count() == 0 ) { | 262 | if ( pluginList.count() == 0 ) { |
236 | QLabel *noPlugins = new QLabel( this ); | 263 | QLabel *noPlugins = new QLabel( this ); |
237 | noPlugins->setText( tr( "No plugins found" ) ); | 264 | noPlugins->setText( tr( "No plugins found" ) ); |
238 | layout->addWidget( noPlugins ); | 265 | layout->addWidget( noPlugins ); |
239 | return; | 266 | return; |
240 | } | 267 | } |
241 | 268 | ||
242 | uint count = 0; | 269 | uint count = 0; |
@@ -247,76 +274,82 @@ void Today::draw() { | |||
247 | if ( plugin.active ) { | 274 | if ( plugin.active ) { |
248 | // qDebug( plugin.name + " is ACTIVE " ); | 275 | // qDebug( plugin.name + " is ACTIVE " ); |
249 | plugin.guiBox->show(); | 276 | plugin.guiBox->show(); |
250 | } else { | 277 | } else { |
251 | // qDebug( plugin.name + " is INACTIVE" ); | 278 | // qDebug( plugin.name + " is INACTIVE" ); |
252 | plugin.guiBox->hide(); | 279 | plugin.guiBox->hide(); |
253 | } | 280 | } |
254 | count++; | 281 | count++; |
255 | } | 282 | } |
256 | 283 | ||
257 | if ( count == 0 ) { | 284 | if ( count == 0 ) { |
258 | QLabel *noPluginsActive = new QLabel( this ); | 285 | QLabel *noPluginsActive = new QLabel( this ); |
259 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 286 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
260 | layout->addWidget( noPluginsActive ); | 287 | layout->addWidget( noPluginsActive ); |
261 | } | 288 | } |
262 | layout->addStretch(0); | 289 | layout->addStretch(0); |
263 | } | 290 | } |
264 | 291 | ||
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-- ) { |
277 | plugin = pluginList[i]; | 307 | plugin = pluginList[i]; |
278 | 308 | ||
279 | // load the config widgets in the tabs | 309 | // load the config widgets in the tabs |
280 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 310 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
281 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | 311 | TodayConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
282 | configWidgetList.append( widget ); | 312 | configWidgetList.append( widget ); |
283 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() | 313 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() |
284 | , plugin.guiPart->appName() ); | 314 | , plugin.guiPart->appName() ); |
285 | } | 315 | } |
286 | // set the order/activate tab | 316 | // set the order/activate tab |
287 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | 317 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
288 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 318 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
289 | } | 319 | } |
290 | 320 | ||
291 | if ( conf.exec() == QDialog::Accepted ) { | 321 | if ( conf.exec() == QDialog::Accepted ) { |
292 | conf.writeConfig(); | 322 | conf.writeConfig(); |
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 |
305 | * | 338 | * |
306 | */ | 339 | */ |
307 | void Today::refresh() { | 340 | void Today::refresh() { |
308 | init(); | 341 | init(); |
309 | 342 | ||
310 | qDebug(" refresh "); | 343 | qDebug(" refresh "); |
311 | // set the date in top label | 344 | // set the date in top label |
312 | QDate date = QDate::currentDate(); | 345 | QDate date = QDate::currentDate(); |
313 | QString time = ( tr( date.toString() ) ); | 346 | QString time = ( tr( date.toString() ) ); |
314 | 347 | ||
315 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 348 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
316 | 349 | ||
317 | if ( layout ) { | 350 | if ( layout ) { |
318 | delete layout; | 351 | delete layout; |
319 | } | 352 | } |
320 | layout = new QVBoxLayout( this ); | 353 | layout = new QVBoxLayout( this ); |
321 | layout->addWidget( Frame ); | 354 | layout->addWidget( Frame ); |
322 | layout->addWidget( OwnerField ); | 355 | layout->addWidget( OwnerField ); |