-rw-r--r-- | core/pim/today/today.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index d8b427d..901a61a 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -1,84 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | * today.cpp | 2 | * today.cpp |
3 | * | 3 | * |
4 | * copyright : (c) 2002 by Maximilian Reiß | 4 | * copyright : (c) 2002 by Maximilian Reiß |
5 | * email : harlekin@handhelds.org | 5 | * email : harlekin@handhelds.org |
6 | * | 6 | * |
7 | */ | 7 | */ |
8 | /*************************************************************************** | 8 | /*************************************************************************** |
9 | * * | 9 | * * |
10 | * This program is free software; you can redistribute it and/or modify * | 10 | * This program is free software; you can redistribute it and/or modify * |
11 | * it under the terms of the GNU General Public License as published by * | 11 | * it under the terms of the GNU General Public License as published by * |
12 | * the Free Software Foundation; either version 2 of the License, or * | 12 | * the Free Software Foundation; either version 2 of the License, or * |
13 | * (at your option) any later version. * | 13 | * (at your option) any later version. * |
14 | * * | 14 | * * |
15 | ***************************************************************************/ | 15 | ***************************************************************************/ |
16 | 16 | ||
17 | 17 | ||
18 | #include "today.h" | 18 | #include "today.h" |
19 | #include "configwidget.h" | 19 | #include "configwidget.h" |
20 | 20 | ||
21 | #include <qpe/config.h> | 21 | #include <qpe/config.h> |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | #include <qpe/resource.h> | 23 | #include <qpe/resource.h> |
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 <qtabwidget.h> | 36 | #include <opie/otabwidget.h> |
37 | #include <qdialog.h> | 37 | #include <qdialog.h> |
38 | 38 | ||
39 | 39 | ||
40 | struct TodayPlugin { | 40 | struct TodayPlugin { |
41 | QLibrary *library; | 41 | QLibrary *library; |
42 | TodayPluginInterface *iface; | 42 | TodayPluginInterface *iface; |
43 | TodayPluginObject *guiPart; | 43 | TodayPluginObject *guiPart; |
44 | QWidget *guiBox; | 44 | QWidget *guiBox; |
45 | QString name; | 45 | QString name; |
46 | bool active; | 46 | bool active; |
47 | int pos; | 47 | int pos; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | static QValueList<TodayPlugin> pluginList; | 50 | static QValueList<TodayPlugin> pluginList; |
51 | 51 | ||
52 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 52 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
53 | : TodayBase( parent, name, fl ) { | 53 | : TodayBase( parent, name, fl ) { |
54 | 54 | ||
55 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); | 55 | QObject::connect( (QObject*)ConfigButton, SIGNAL( clicked() ), this, SLOT( startConfig() ) ); |
56 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); | 56 | QObject::connect( (QObject*)OwnerField, SIGNAL( clicked() ), this, SLOT( editCard() ) ); |
57 | 57 | ||
58 | #if defined(Q_WS_QWS) | 58 | #if defined(Q_WS_QWS) |
59 | #if !defined(QT_NO_COP) | 59 | #if !defined(QT_NO_COP) |
60 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); | 60 | QCopChannel *todayChannel = new QCopChannel( "QPE/Today" , this ); |
61 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), | 61 | connect ( todayChannel, SIGNAL( received( const QCString &, const QByteArray &) ), |
62 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); | 62 | this, SLOT ( channelReceived( const QCString &, const QByteArray &) ) ); |
63 | #endif | 63 | #endif |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | setOwnerField(); | 66 | setOwnerField(); |
67 | refresh(); | 67 | refresh(); |
68 | showMaximized(); | 68 | showMaximized(); |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Qcop receive method. | 72 | * Qcop receive method. |
73 | */ | 73 | */ |
74 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { | 74 | void Today::channelReceived( const QCString &msg, const QByteArray & data ) { |
75 | QDataStream stream( data, IO_ReadOnly ); | 75 | QDataStream stream( data, IO_ReadOnly ); |
76 | if ( msg == "message(QString)" ) { | 76 | if ( msg == "message(QString)" ) { |
77 | QString message; | 77 | QString message; |
78 | stream >> message; | 78 | stream >> message; |
79 | setOwnerField( message ); | 79 | setOwnerField( message ); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Initialises the owner field with the default value, the username | 84 | * Initialises the owner field with the default value, the username |
@@ -215,97 +215,98 @@ void Today::draw() { | |||
215 | if ( pluginList.count() == 0 ) { | 215 | if ( pluginList.count() == 0 ) { |
216 | QLabel *noPlugins = new QLabel( this ); | 216 | QLabel *noPlugins = new QLabel( this ); |
217 | noPlugins->setText( tr( "No plugins found" ) ); | 217 | noPlugins->setText( tr( "No plugins found" ) ); |
218 | layout->addWidget( noPlugins ); | 218 | layout->addWidget( noPlugins ); |
219 | return; | 219 | return; |
220 | } | 220 | } |
221 | 221 | ||
222 | uint count = 0; | 222 | uint count = 0; |
223 | TodayPlugin plugin; | 223 | TodayPlugin plugin; |
224 | for ( uint i = 0; i < pluginList.count(); i++ ) { | 224 | for ( uint i = 0; i < pluginList.count(); i++ ) { |
225 | plugin = pluginList[i]; | 225 | plugin = pluginList[i]; |
226 | 226 | ||
227 | if ( plugin.active ) { | 227 | if ( plugin.active ) { |
228 | qDebug( plugin.name + " is ACTIVE " ); | 228 | qDebug( plugin.name + " is ACTIVE " ); |
229 | plugin.guiBox->show(); | 229 | plugin.guiBox->show(); |
230 | } else { | 230 | } else { |
231 | qDebug( plugin.name + " is INACTIVE" ); | 231 | qDebug( plugin.name + " is INACTIVE" ); |
232 | plugin.guiBox->hide(); | 232 | plugin.guiBox->hide(); |
233 | } | 233 | } |
234 | count++; | 234 | count++; |
235 | } | 235 | } |
236 | 236 | ||
237 | if ( count == 0 ) { | 237 | if ( count == 0 ) { |
238 | QLabel *noPluginsActive = new QLabel( this ); | 238 | QLabel *noPluginsActive = new QLabel( this ); |
239 | noPluginsActive->setText( tr( "No plugins activated" ) ); | 239 | noPluginsActive->setText( tr( "No plugins activated" ) ); |
240 | layout->addWidget( noPluginsActive ); | 240 | layout->addWidget( noPluginsActive ); |
241 | } | 241 | } |
242 | layout->addStretch(0); | 242 | layout->addStretch(0); |
243 | } | 243 | } |
244 | 244 | ||
245 | 245 | ||
246 | /** | 246 | /** |
247 | * The method for the configuration dialog. | 247 | * The method for the configuration dialog. |
248 | */ | 248 | */ |
249 | void Today::startConfig() { | 249 | void Today::startConfig() { |
250 | 250 | ||
251 | TodayConfig conf( this, "dialog", true ); | 251 | TodayConfig conf( this, "dialog", true ); |
252 | 252 | ||
253 | TodayPlugin plugin; | 253 | TodayPlugin plugin; |
254 | QList<ConfigWidget> configWidgetList; | 254 | QList<ConfigWidget> configWidgetList; |
255 | 255 | ||
256 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { | 256 | for ( int i = pluginList.count() - 1 ; i >= 0; i-- ) { |
257 | plugin = pluginList[i]; | 257 | plugin = pluginList[i]; |
258 | 258 | ||
259 | // load the config widgets in the tabs | 259 | // load the config widgets in the tabs |
260 | if ( plugin.guiPart->configWidget( this ) != 0l ) { | 260 | if ( plugin.guiPart->configWidget( this ) != 0l ) { |
261 | ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); | 261 | ConfigWidget* widget = plugin.guiPart->configWidget( conf.TabWidget3 ); |
262 | configWidgetList.append( widget ); | 262 | configWidgetList.append( widget ); |
263 | conf.TabWidget3->insertTab( widget, plugin.guiPart->appName() ); | 263 | conf.TabWidget3->addTab( widget, plugin.guiPart->pixmapNameConfig() |
264 | , plugin.guiPart->appName() ); | ||
264 | } | 265 | } |
265 | // set the order/activate tab | 266 | // set the order/activate tab |
266 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), | 267 | conf.pluginManagement( plugin.name, plugin.guiPart->pluginName(), |
267 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); | 268 | Resource::loadPixmap( plugin.guiPart->pixmapNameWidget() ) ); |
268 | } | 269 | } |
269 | 270 | ||
270 | if ( conf.exec() == QDialog::Accepted ) { | 271 | if ( conf.exec() == QDialog::Accepted ) { |
271 | conf.writeConfig(); | 272 | conf.writeConfig(); |
272 | ConfigWidget *confWidget; | 273 | ConfigWidget *confWidget; |
273 | for ( confWidget = configWidgetList.first(); confWidget != 0; | 274 | for ( confWidget = configWidgetList.first(); confWidget != 0; |
274 | confWidget = configWidgetList.next() ) { | 275 | confWidget = configWidgetList.next() ) { |
275 | confWidget->writeConfig(); | 276 | confWidget->writeConfig(); |
276 | } | 277 | } |
277 | refresh(); | 278 | refresh(); |
278 | } | 279 | } |
279 | } | 280 | } |
280 | 281 | ||
281 | 282 | ||
282 | /** | 283 | /** |
283 | * Refresh for the view. Reload all applets | 284 | * Refresh for the view. Reload all applets |
284 | * | 285 | * |
285 | */ | 286 | */ |
286 | void Today::refresh() { | 287 | void Today::refresh() { |
287 | init(); | 288 | init(); |
288 | 289 | ||
289 | // set the date in top label | 290 | // set the date in top label |
290 | QDate date = QDate::currentDate(); | 291 | QDate date = QDate::currentDate(); |
291 | QString time = ( tr( date.toString() ) ); | 292 | QString time = ( tr( date.toString() ) ); |
292 | 293 | ||
293 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); | 294 | DateLabel->setText( QString( "<font color=#FFFFFF>" + time + "</font>" ) ); |
294 | 295 | ||
295 | if ( layout ) { | 296 | if ( layout ) { |
296 | delete layout; | 297 | delete layout; |
297 | } | 298 | } |
298 | layout = new QVBoxLayout( this ); | 299 | layout = new QVBoxLayout( this ); |
299 | layout->addWidget( Frame ); | 300 | layout->addWidget( Frame ); |
300 | layout->addWidget( OwnerField ); | 301 | layout->addWidget( OwnerField ); |
301 | 302 | ||
302 | loadPlugins(); | 303 | loadPlugins(); |
303 | draw(); | 304 | draw(); |
304 | } | 305 | } |
305 | 306 | ||
306 | void Today::startAddressbook() { | 307 | void Today::startAddressbook() { |
307 | QCopEnvelope e( "QPE/System", "execute(QString)" ); | 308 | QCopEnvelope e( "QPE/System", "execute(QString)" ); |
308 | e << QString( "addressbook" ); | 309 | e << QString( "addressbook" ); |
309 | } | 310 | } |
310 | 311 | ||
311 | 312 | ||