-rw-r--r-- | core/pim/today/today.cpp | 16 | ||||
-rw-r--r-- | core/pim/today/today.h | 1 |
2 files changed, 2 insertions, 15 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 1b31cfd..e6f8c93 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -164,54 +164,52 @@ void Today::loadPlugins() { | |||
164 | 164 | ||
165 | QString path = QPEApplication::qpeDir() + "/plugins/today"; | 165 | QString path = QPEApplication::qpeDir() + "/plugins/today"; |
166 | QDir dir( path, "lib*.so" ); | 166 | QDir dir( path, "lib*.so" ); |
167 | 167 | ||
168 | QStringList list = dir.entryList(); | 168 | QStringList list = dir.entryList(); |
169 | QStringList::Iterator it; | 169 | QStringList::Iterator it; |
170 | 170 | ||
171 | QMap<QString, TodayPlugin> tempList; | 171 | QMap<QString, TodayPlugin> tempList; |
172 | 172 | ||
173 | for ( it = list.begin(); it != list.end(); ++it ) { | 173 | for ( it = list.begin(); it != list.end(); ++it ) { |
174 | //TodayPluginInterface *iface = 0; | 174 | //TodayPluginInterface *iface = 0; |
175 | QInterfacePtr<TodayPluginInterface> iface; | 175 | QInterfacePtr<TodayPluginInterface> iface; |
176 | QLibrary *lib = new QLibrary( path + "/" + *it ); | 176 | QLibrary *lib = new QLibrary( path + "/" + *it ); |
177 | 177 | ||
178 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); | 178 | qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); |
179 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { | 179 | if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { |
180 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); | 180 | qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); |
181 | qDebug( QString(*it) ); | 181 | qDebug( QString(*it) ); |
182 | 182 | ||
183 | // If plugin is exludes from refresh, get it in the list again here. | 183 | // If plugin is exludes from refresh, get it in the list again here. |
184 | 184 | ||
185 | if ( pluginListRefreshExclude.contains( (*it) ) ) { | 185 | if ( pluginListRefreshExclude.contains( (*it) ) ) { |
186 | // if its not in allApplets list, add it to a layout | 186 | // if its not in allApplets list, add it to a layout |
187 | if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { | 187 | if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { |
188 | qDebug( "NUGASDA" ); | ||
189 | layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); | 188 | layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); |
190 | pluginList.append( pluginListRefreshExclude[(*it)] ); | 189 | pluginList.append( pluginListRefreshExclude[(*it)] ); |
191 | } else { | 190 | } else { |
192 | tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); | 191 | tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); |
193 | qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name ); | ||
194 | } | 192 | } |
195 | } else { | 193 | } else { |
196 | 194 | ||
197 | TodayPlugin plugin; | 195 | TodayPlugin plugin; |
198 | plugin.library = lib; | 196 | plugin.library = lib; |
199 | plugin.iface = iface; | 197 | plugin.iface = iface; |
200 | plugin.name = QString(*it); | 198 | plugin.name = QString(*it); |
201 | 199 | ||
202 | // find out if plugins should be shown | 200 | // find out if plugins should be shown |
203 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { | 201 | if ( m_excludeApplets.grep( *it ).isEmpty() ) { |
204 | plugin.active = true; | 202 | plugin.active = true; |
205 | } else { | 203 | } else { |
206 | plugin.active = false; | 204 | plugin.active = false; |
207 | } | 205 | } |
208 | 206 | ||
209 | plugin.guiPart = plugin.iface->guiPart(); | 207 | plugin.guiPart = plugin.iface->guiPart(); |
210 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); | 208 | plugin.excludeRefresh = plugin.guiPart->excludeFromRefresh(); |
211 | 209 | ||
212 | // package the whole thing into a qwidget so it can be shown and hidden | 210 | // package the whole thing into a qwidget so it can be shown and hidden |
213 | plugin.guiBox = new QWidget( this ); | 211 | plugin.guiBox = new QWidget( this ); |
214 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); | 212 | QHBoxLayout *boxLayout = new QHBoxLayout( plugin.guiBox ); |
215 | QPixmap plugPix; | 213 | QPixmap plugPix; |
216 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); | 214 | plugPix.convertFromImage( Resource::loadImage( plugin.guiPart->pixmapNameWidget() ).smoothScale( m_iconSize, m_iconSize ), 0 ); |
217 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); | 215 | OClickableLabel* plugIcon = new OClickableLabel( plugin.guiBox ); |
@@ -334,67 +332,57 @@ void Today::startConfig() { | |||
334 | } | 332 | } |
335 | 333 | ||
336 | if ( conf.exec() == QDialog::Accepted ) { | 334 | if ( conf.exec() == QDialog::Accepted ) { |
337 | conf.writeConfig(); | 335 | conf.writeConfig(); |
338 | TodayConfigWidget *confWidget; | 336 | TodayConfigWidget *confWidget; |
339 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 337 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
340 | confWidget = configWidgetList.next() ) { | 338 | confWidget = configWidgetList.next() ) { |
341 | confWidget->writeConfig(); | 339 | confWidget->writeConfig(); |
342 | } | 340 | } |
343 | refresh(); | 341 | refresh(); |
344 | } else { | 342 | } else { |
345 | // since refresh is not called in that case , reconnect the signal | 343 | // since refresh is not called in that case , reconnect the signal |
346 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); | 344 | connect( m_refreshTimer, SIGNAL( timeout() ), this, SLOT( refresh() ) ); |
347 | } | 345 | } |
348 | } | 346 | } |
349 | 347 | ||
350 | 348 | ||
351 | /** | 349 | /** |
352 | * Refresh for the view. Reload all applets | 350 | * Refresh for the view. Reload all applets |
353 | * | 351 | * |
354 | */ | 352 | */ |
355 | void Today::refresh() { | 353 | void Today::refresh() { |
356 | init(); | 354 | init(); |
357 | 355 | ||
358 | qDebug(" refresh "); | 356 | // qDebug(" refresh "); |
359 | // set the date in top label | 357 | // set the date in top label |
360 | QDate date = QDate::currentDate(); | 358 | QDate date = QDate::currentDate(); |
361 | QString time = ( tr( date.toString() ) ); | 359 | QString time = ( tr( date.toString() ) ); |
362 | 360 | ||
363 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 361 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
364 | 362 | ||
365 | if ( layout ) { | 363 | if ( layout ) { |
366 | delete layout; | 364 | delete layout; |
367 | } | 365 | } |
368 | layout = new QVBoxLayout( this ); | 366 | layout = new QVBoxLayout( this ); |
369 | layout->addWidget( Frame ); | 367 | layout->addWidget( Frame ); |
370 | layout->addWidget( OwnerField ); | 368 | layout->addWidget( OwnerField ); |
371 | 369 | ||
372 | loadPlugins(); | 370 | loadPlugins(); |
373 | draw(); | 371 | draw(); |
374 | } | 372 | } |
375 | 373 | ||
376 | void Today::startAddressbook() { | ||
377 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | ||
378 | e << QString( "addressbook" ); | ||
379 | } | ||
380 | |||
381 | |||
382 | void Today::startApplication() { | 374 | void Today::startApplication() { |
383 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 375 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
384 | e << QString( sender()->name() ); | 376 | e << QString( sender()->name() ); |
385 | } | 377 | } |
386 | 378 | ||
387 | /** | 379 | /** |
388 | * launch addressbook (personal card) | 380 | * launch addressbook (personal card) |
389 | */ | 381 | */ |
390 | void Today::editCard() { | 382 | void Today::editCard() { |
391 | startAddressbook(); | 383 | QCopEnvelope env( "QPE/Application/addressbook", "editPersonalAndClose()" ); |
392 | while( !QCopChannel::isRegistered( "QPE/Addressbook" ) ) { | ||
393 | qApp->processEvents(); | ||
394 | } | ||
395 | QCopEnvelope v( "QPE/Addressbook", "editPersonalAndClose()" ); | ||
396 | } | 384 | } |
397 | 385 | ||
398 | Today::~Today() { | 386 | Today::~Today() { |
399 | } | 387 | } |
400 | 388 | ||
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 4485a0b..35b7ee3 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -24,49 +24,48 @@ | |||
24 | #include <qlist.h> | 24 | #include <qlist.h> |
25 | #include <qhbox.h> | 25 | #include <qhbox.h> |
26 | 26 | ||
27 | #include <qpe/qlibrary.h> | 27 | #include <qpe/qlibrary.h> |
28 | #include <qpe/event.h> | 28 | #include <qpe/event.h> |
29 | 29 | ||
30 | #include "todayconfig.h" | 30 | #include "todayconfig.h" |
31 | #include "todaybase.h" | 31 | #include "todaybase.h" |
32 | #include <opie/todayplugininterface.h> | 32 | #include <opie/todayplugininterface.h> |
33 | 33 | ||
34 | class QVBoxLayout; | 34 | class QVBoxLayout; |
35 | class OClickableLabel; | 35 | class OClickableLabel; |
36 | 36 | ||
37 | 37 | ||
38 | class Today : public TodayBase { | 38 | class Today : public TodayBase { |
39 | 39 | ||
40 | Q_OBJECT | 40 | Q_OBJECT |
41 | 41 | ||
42 | public: | 42 | public: |
43 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 43 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
44 | ~Today(); | 44 | ~Today(); |
45 | 45 | ||
46 | private slots: | 46 | private slots: |
47 | void startConfig(); | 47 | void startConfig(); |
48 | void startAddressbook(); | ||
49 | void startApplication(); | 48 | void startApplication(); |
50 | void editCard(); | 49 | void editCard(); |
51 | void refresh(); | 50 | void refresh(); |
52 | 51 | ||
53 | private: | 52 | private: |
54 | void init(); | 53 | void init(); |
55 | void setOwnerField(); | 54 | void setOwnerField(); |
56 | void setOwnerField(QString &string); | 55 | void setOwnerField(QString &string); |
57 | void loadPlugins(); | 56 | void loadPlugins(); |
58 | void draw(); | 57 | void draw(); |
59 | void setRefreshTimer( int ); | 58 | void setRefreshTimer( int ); |
60 | 59 | ||
61 | private slots: | 60 | private slots: |
62 | void channelReceived(const QCString &msg, const QByteArray & data); | 61 | void channelReceived(const QCString &msg, const QByteArray & data); |
63 | 62 | ||
64 | private: | 63 | private: |
65 | TodayConfig *conf; | 64 | TodayConfig *conf; |
66 | QStringList m_excludeApplets; | 65 | QStringList m_excludeApplets; |
67 | QStringList m_allApplets; | 66 | QStringList m_allApplets; |
68 | 67 | ||
69 | QTimer *m_refreshTimer; | 68 | QTimer *m_refreshTimer; |
70 | 69 | ||
71 | bool m_refreshTimerEnabled; | 70 | bool m_refreshTimerEnabled; |
72 | int m_newStart; | 71 | int m_newStart; |