author | harlekin <harlekin> | 2002-04-10 16:51:46 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-10 16:51:46 (UTC) |
commit | 34e0e7af48992314d461be1a5a573dc0967fe260 (patch) (unidiff) | |
tree | e3e8bbf44ebf767f28de3fe89eced38e785a7b55 /core | |
parent | 1d32fda5b67e89321ecbd0c8700edb8292b9ca90 (diff) | |
download | opie-34e0e7af48992314d461be1a5a573dc0967fe260.zip opie-34e0e7af48992314d461be1a5a573dc0967fe260.tar.gz opie-34e0e7af48992314d461be1a5a573dc0967fe260.tar.bz2 |
am/pm support, ugly
-rw-r--r-- | core/pim/today/TODO | 2 | ||||
-rw-r--r-- | core/pim/today/changelog | 2 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 186 | ||||
-rw-r--r-- | core/pim/today/today.h | 42 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 24 |
5 files changed, 155 insertions, 101 deletions
diff --git a/core/pim/today/TODO b/core/pim/today/TODO index 48e8d20..6acbf5a 100644 --- a/core/pim/today/TODO +++ b/core/pim/today/TODO | |||
@@ -2,8 +2,6 @@ TODO for today: | |||
2 | 2 | ||
3 | * show alarm icons on alarm events (partly done) | 3 | * show alarm icons on alarm events (partly done) |
4 | 4 | ||
5 | * add am/pm mode instead of 24 h, take system default | ||
6 | |||
7 | * qcop integration for updating events? | 5 | * qcop integration for updating events? |
8 | 6 | ||
9 | * make Opiezilla a clickable label wich is allway on the far right side of | 7 | * make Opiezilla a clickable label wich is allway on the far right side of |
diff --git a/core/pim/today/changelog b/core/pim/today/changelog index b3da1fb..f04ff78 100644 --- a/core/pim/today/changelog +++ b/core/pim/today/changelog | |||
@@ -1,3 +1,5 @@ | |||
1 | * am/pm time optinal (autodetect) | ||
2 | |||
1 | 0.3.1 | 3 | 0.3.1 |
2 | 4 | ||
3 | * fixed the wrong color of the buttons | 5 | * fixed the wrong color of the buttons |
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 7cef035..028947d 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | #include <qpe/timestring.h> | 22 | #include <qpe/timestring.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/qprocess.h> | 25 | #include <qpe/qprocess.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | #include <qpe/contact.h> | 27 | #include <qpe/contact.h> |
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #include <qdir.h> | 31 | #include <qdir.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qdatetime.h> | 33 | #include <qdatetime.h> |
34 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
35 | #include <qcheckbox.h> | 35 | #include <qcheckbox.h> |
36 | #include <qspinbox.h> | 36 | #include <qspinbox.h> |
@@ -56,9 +56,9 @@ int ONLY_LATER; | |||
56 | int AUTOSTART; | 56 | int AUTOSTART; |
57 | int NEW_START=1; | 57 | int NEW_START=1; |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * Constructs a Example which is a child of 'parent', with the | 60 | * Constructs a Example which is a child of 'parent', with the |
61 | * name 'name' and widget flags set to 'f' | 61 | * name 'name' and widget flags set to 'f' |
62 | */ | 62 | */ |
63 | Today::Today( QWidget* parent, const char* name, WFlags fl ) | 63 | Today::Today( QWidget* parent, const char* name, WFlags fl ) |
64 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { | 64 | : TodayBase( parent, name, fl ), AllDateBookEvents(NULL) { |
@@ -66,15 +66,17 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
66 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); | 66 | QObject::connect( (QObject*)TodoButton, SIGNAL( clicked() ), this, SLOT(startTodo() ) ); |
67 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); | 67 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); |
68 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | 68 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); |
69 | 69 | ||
70 | #if defined(Q_WS_QWS) | 70 | #if defined(Q_WS_QWS) |
71 | #if !defined(QT_NO_COP) | 71 | #if !defined(QT_NO_COP) |
72 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); | 72 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); |
73 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 73 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
74 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); | 74 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); |
75 | #endif | 75 | #endif |
76 | #endif | 76 | #endif |
77 | 77 | ||
78 | |||
79 | |||
78 | db = NULL; | 80 | db = NULL; |
79 | setOwnerField(); | 81 | setOwnerField(); |
80 | todo = new ToDoDB; | 82 | todo = new ToDoDB; |
@@ -98,7 +100,7 @@ void Today::channelReceived(const QCString &msg, const QByteArray & data) { | |||
98 | 100 | ||
99 | /* | 101 | /* |
100 | * Initialises the owner field with the default value, the username | 102 | * Initialises the owner field with the default value, the username |
101 | */ | 103 | */ |
102 | void Today::setOwnerField() { | 104 | void Today::setOwnerField() { |
103 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); | 105 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); |
104 | if (QFile::exists(file)) { | 106 | if (QFile::exists(file)) { |
@@ -117,7 +119,7 @@ void Today::setOwnerField(QString &message) { | |||
117 | if (!message.isEmpty()) { | 119 | if (!message.isEmpty()) { |
118 | OwnerField->setText("<b>" + message + "</b>"); | 120 | OwnerField->setText("<b>" + message + "</b>"); |
119 | } | 121 | } |
120 | } | 122 | } |
121 | 123 | ||
122 | /* | 124 | /* |
123 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 125 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
@@ -125,7 +127,7 @@ void Today::setOwnerField(QString &message) { | |||
125 | */ | 127 | */ |
126 | void Today::autoStart() { | 128 | void Today::autoStart() { |
127 | Config cfg("today"); | 129 | Config cfg("today"); |
128 | cfg.setGroup("Autostart"); | 130 | cfg.setGroup("Autostart"); |
129 | AUTOSTART = cfg.readNumEntry("autostart",1); | 131 | AUTOSTART = cfg.readNumEntry("autostart",1); |
130 | if (AUTOSTART) { | 132 | if (AUTOSTART) { |
131 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | 133 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); |
@@ -145,7 +147,7 @@ void Today::draw() { | |||
145 | init(); | 147 | init(); |
146 | getDates(); | 148 | getDates(); |
147 | getMail(); | 149 | getMail(); |
148 | 150 | ||
149 | // if the todolist.xml file was not modified in between, do not parse it. | 151 | // if the todolist.xml file was not modified in between, do not parse it. |
150 | if (checkIfModified()) { | 152 | if (checkIfModified()) { |
151 | if (todo) delete todo; | 153 | if (todo) delete todo; |
@@ -221,10 +223,10 @@ void Today::startConfig() { | |||
221 | conf = new todayconfig ( this, "", true ); | 223 | conf = new todayconfig ( this, "", true ); |
222 | // read the config | 224 | // read the config |
223 | Config cfg("today"); | 225 | Config cfg("today"); |
224 | cfg.setGroup("BaseConfig"); | 226 | cfg.setGroup("BaseConfig"); |
225 | 227 | ||
226 | //init(); | 228 | //init(); |
227 | 229 | ||
228 | conf->SpinBox1->setValue(MAX_LINES_MEET); | 230 | conf->SpinBox1->setValue(MAX_LINES_MEET); |
229 | // location show box | 231 | // location show box |
230 | conf->CheckBox1->setChecked(SHOW_LOCATION); | 232 | conf->CheckBox1->setChecked(SHOW_LOCATION); |
@@ -240,7 +242,7 @@ void Today::startConfig() { | |||
240 | conf->CheckBoxAuto->setChecked(AUTOSTART); | 242 | conf->CheckBoxAuto->setChecked(AUTOSTART); |
241 | 243 | ||
242 | conf->exec(); | 244 | conf->exec(); |
243 | 245 | ||
244 | int maxlinestask = conf->SpinBox2->value(); | 246 | int maxlinestask = conf->SpinBox2->value(); |
245 | int maxmeet = conf->SpinBox1->value(); | 247 | int maxmeet = conf->SpinBox1->value(); |
246 | int location = conf->CheckBox1->isChecked(); | 248 | int location = conf->CheckBox1->isChecked(); |
@@ -248,18 +250,18 @@ void Today::startConfig() { | |||
248 | int maxcharclip = conf->SpinBox7->value(); | 250 | int maxcharclip = conf->SpinBox7->value(); |
249 | int onlylater = conf->CheckBox3->isChecked(); | 251 | int onlylater = conf->CheckBox3->isChecked(); |
250 | int autostart =conf->CheckBoxAuto->isChecked(); | 252 | int autostart =conf->CheckBoxAuto->isChecked(); |
251 | 253 | ||
252 | cfg.writeEntry("maxlinestask",maxlinestask); | 254 | cfg.writeEntry("maxlinestask",maxlinestask); |
253 | cfg.writeEntry("maxcharclip", maxcharclip); | 255 | cfg.writeEntry("maxcharclip", maxcharclip); |
254 | cfg.writeEntry("maxlinesmeet",maxmeet); | 256 | cfg.writeEntry("maxlinesmeet",maxmeet); |
255 | cfg.writeEntry("showlocation",location); | 257 | cfg.writeEntry("showlocation",location); |
256 | cfg.writeEntry("shownotes", notes); | 258 | cfg.writeEntry("shownotes", notes); |
257 | cfg.writeEntry("onlylater", onlylater); | 259 | cfg.writeEntry("onlylater", onlylater); |
258 | cfg.setGroup("Autostart"); | 260 | cfg.setGroup("Autostart"); |
259 | cfg.writeEntry("autostart", autostart); | 261 | cfg.writeEntry("autostart", autostart); |
260 | 262 | ||
261 | // sync it to "disk" | 263 | // sync it to "disk" |
262 | cfg.write(); | 264 | cfg.write(); |
263 | NEW_START=1; | 265 | NEW_START=1; |
264 | draw(); | 266 | draw(); |
265 | autoStart(); | 267 | autoStart(); |
@@ -279,7 +281,7 @@ void Today::getDates() { | |||
279 | if (db) { | 281 | if (db) { |
280 | delete db; | 282 | delete db; |
281 | } | 283 | } |
282 | db = new DateBookDB; | 284 | db = new DateBookDB; |
283 | 285 | ||
284 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); | 286 | QValueList<EffectiveEvent> list = db->getEffectiveEvents(date, date); |
285 | 287 | ||
@@ -289,19 +291,19 @@ void Today::getDates() { | |||
289 | Config config( "qpe" ); | 291 | Config config( "qpe" ); |
290 | // if 24 h format | 292 | // if 24 h format |
291 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); | 293 | //bool ampm = config.readBoolEntry( "AMPM", TRUE ); |
292 | 294 | ||
293 | int count=0; | 295 | int count=0; |
294 | 296 | ||
295 | if ( list.count() > 0 ) { | 297 | if ( list.count() > 0 ) { |
296 | 298 | ||
297 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); | 299 | for ( QValueList<EffectiveEvent>::ConstIterator it=list.begin(); |
298 | it!=list.end(); ++it ) { | 300 | it!=list.end(); ++it ) { |
299 | 301 | ||
300 | 302 | ||
301 | if ( count <= MAX_LINES_MEET ) { | 303 | if ( count <= MAX_LINES_MEET ) { |
302 | 304 | ||
303 | QTime time = QTime::currentTime(); | 305 | QTime time = QTime::currentTime(); |
304 | 306 | ||
305 | if (!ONLY_LATER) { | 307 | if (!ONLY_LATER) { |
306 | count++; | 308 | count++; |
307 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); | 309 | DateBookEvent *l=new DateBookEvent(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); |
@@ -310,42 +312,42 @@ void Today::getDates() { | |||
310 | this, SLOT(editEvent(const Event &))); | 312 | this, SLOT(editEvent(const Event &))); |
311 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { | 313 | } else if ((time.toString() <= TimeString::dateString((*it).event().end())) ) { |
312 | count++; | 314 | count++; |
313 | 315 | ||
314 | // show only later appointments | 316 | // show only later appointments |
315 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); | 317 | DateBookEventLater *l=new DateBookEventLater(*it, AllDateBookEvents, SHOW_LOCATION, SHOW_NOTES); |
316 | layoutDates->addWidget(l); | 318 | layoutDates->addWidget(l); |
317 | connect (l, SIGNAL(editEvent(const Event &)), | 319 | connect (l, SIGNAL(editEvent(const Event &)), |
318 | this, SLOT(editEvent(const Event &))); | 320 | this, SLOT(editEvent(const Event &))); |
319 | } | 321 | } |
320 | } | 322 | } |
321 | } | 323 | } |
322 | if (ONLY_LATER && count==0) { | 324 | if (ONLY_LATER && count==0) { |
323 | QLabel* noMoreEvents = new QLabel(AllDateBookEvents); | 325 | QLabel* noMoreEvents = new QLabel(AllDateBookEvents); |
324 | noMoreEvents->setText(tr("No more appointments today")); | 326 | noMoreEvents->setText(tr("No more appointments today")); |
325 | layoutDates->addWidget(noMoreEvents); | 327 | layoutDates->addWidget(noMoreEvents); |
326 | } | 328 | } |
327 | } else { | 329 | } else { |
328 | QLabel* noEvents = new QLabel(AllDateBookEvents); | 330 | QLabel* noEvents = new QLabel(AllDateBookEvents); |
329 | noEvents->setText(tr("No appointments today")); | 331 | noEvents->setText(tr("No appointments today")); |
330 | layoutDates->addWidget(noEvents); | 332 | layoutDates->addWidget(noEvents); |
331 | } | 333 | } |
332 | 334 | ||
333 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); | 335 | layoutDates->addItem(new QSpacerItem(1,1, QSizePolicy::Minimum, QSizePolicy::Expanding)); |
334 | sv1->addChild(AllDateBookEvents); | 336 | sv1->addChild(AllDateBookEvents); |
335 | AllDateBookEvents->show(); | 337 | AllDateBookEvents->show(); |
336 | } | 338 | } |
337 | 339 | ||
338 | 340 | ||
339 | void Today::getMail() { | 341 | void Today::getMail() { |
340 | Config cfg("opiemail"); | 342 | Config cfg("opiemail"); |
341 | cfg.setGroup("today"); | 343 | cfg.setGroup("today"); |
342 | 344 | ||
343 | // how many lines should be showed in the task section | 345 | // how many lines should be showed in the task section |
344 | int NEW_MAILS = cfg.readNumEntry("newmails",0); | 346 | int NEW_MAILS = cfg.readNumEntry("newmails",0); |
345 | int OUTGOING = cfg.readNumEntry("outgoing",0); | 347 | int OUTGOING = cfg.readNumEntry("outgoing",0); |
346 | 348 | ||
347 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); | 349 | QString output = tr("<b>%1</b> new mail(s), <b>%2</b> outgoing").arg(NEW_MAILS).arg(OUTGOING); |
348 | 350 | ||
349 | MailField->setText(output); | 351 | MailField->setText(output); |
350 | } | 352 | } |
351 | 353 | ||
@@ -354,7 +356,7 @@ void Today::getMail() { | |||
354 | * Get the todos | 356 | * Get the todos |
355 | */ | 357 | */ |
356 | void Today::getTodo() { | 358 | void Today::getTodo() { |
357 | 359 | ||
358 | QString output; | 360 | QString output; |
359 | QString tmpout; | 361 | QString tmpout; |
360 | int count = 0; | 362 | int count = 0; |
@@ -370,7 +372,7 @@ void Today::getTodo() { | |||
370 | ammount++; | 372 | ammount++; |
371 | } | 373 | } |
372 | } | 374 | } |
373 | 375 | ||
374 | // get total number of still open todos | 376 | // get total number of still open todos |
375 | QValueList<ToDoEvent> open = todo->rawToDos(); | 377 | QValueList<ToDoEvent> open = todo->rawToDos(); |
376 | qBubbleSort(open); | 378 | qBubbleSort(open); |
@@ -378,7 +380,7 @@ void Today::getTodo() { | |||
378 | it!=open.end(); ++it ) { | 380 | it!=open.end(); ++it ) { |
379 | if (!(*it).isCompleted()){ | 381 | if (!(*it).isCompleted()){ |
380 | count +=1; | 382 | count +=1; |
381 | // not the overdues, we allready got them, and not if we are | 383 | // not the overdues, we allready got them, and not if we are |
382 | // over the maxlines | 384 | // over the maxlines |
383 | if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { | 385 | if (!(*it).isOverdue() && ( ammount < MAX_LINES_TASK) ) { |
384 | tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>"; | 386 | tmpout += "<b>-</b>" + ((*it).description()).mid(0, MAX_CHAR_CLIP) + "<br>"; |
@@ -386,8 +388,8 @@ void Today::getTodo() { | |||
386 | } | 388 | } |
387 | } | 389 | } |
388 | } | 390 | } |
389 | 391 | ||
390 | 392 | ||
391 | if (count > 0) { | 393 | if (count > 0) { |
392 | if( count == 1 ) { | 394 | if( count == 1 ) { |
393 | output = tr("There is <b> 1</b> active task: <br>" ); | 395 | output = tr("There is <b> 1</b> active task: <br>" ); |
@@ -398,27 +400,27 @@ void Today::getTodo() { | |||
398 | } else { | 400 | } else { |
399 | output = tr("No active tasks"); | 401 | output = tr("No active tasks"); |
400 | } | 402 | } |
401 | 403 | ||
402 | TodoField->setText(tr(output)); | 404 | TodoField->setText(tr(output)); |
403 | } | 405 | } |
404 | 406 | ||
405 | /* | 407 | /* |
406 | * launches datebook | 408 | * launches datebook |
407 | */ | 409 | */ |
408 | void Today::startDatebook() { | 410 | void Today::startDatebook() { |
409 | QCopEnvelope e("QPE/System", "execute(QString)"); | 411 | QCopEnvelope e("QPE/System", "execute(QString)"); |
410 | e << QString("datebook"); | 412 | e << QString("datebook"); |
411 | } | 413 | } |
412 | 414 | ||
413 | /* | 415 | /* |
414 | * starts the edit dialog as known from datebook | 416 | * starts the edit dialog as known from datebook |
415 | */ | 417 | */ |
416 | 418 | ||
417 | extern QPEApplication *todayApp; | 419 | extern QPEApplication *todayApp; |
418 | 420 | ||
419 | void Today::editEvent(const Event &e) { | 421 | void Today::editEvent(const Event &e) { |
420 | startDatebook(); | 422 | startDatebook(); |
421 | 423 | ||
422 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); | 424 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); |
423 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); | 425 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); |
424 | env << e.uid(); | 426 | env << e.uid(); |
@@ -426,7 +428,7 @@ void Today::editEvent(const Event &e) { | |||
426 | 428 | ||
427 | /* | 429 | /* |
428 | * launches todolist | 430 | * launches todolist |
429 | */ | 431 | */ |
430 | void Today::startTodo() { | 432 | void Today::startTodo() { |
431 | QCopEnvelope e("QPE/System", "execute(QString)"); | 433 | QCopEnvelope e("QPE/System", "execute(QString)"); |
432 | e << QString("todolist"); | 434 | e << QString("todolist"); |
@@ -444,22 +446,25 @@ void Today::startMail() { | |||
444 | Today::~Today() { | 446 | Today::~Today() { |
445 | } | 447 | } |
446 | 448 | ||
447 | |||
448 | |||
449 | /* | 449 | /* |
450 | * Gets the events for the current day, if it should get all dates | 450 | * Gets the events for the current day, if it should get all dates |
451 | */ | 451 | */ |
452 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 452 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
453 | QWidget* parent = 0, | 453 | QWidget* parent = 0, |
454 | int SHOW_LOCATION = 0, | 454 | int SHOW_LOCATION = 0, |
455 | int SHOW_NOTES = 0, | 455 | int SHOW_NOTES = 0, |
456 | const char* name = 0, | 456 | const char* name = 0, |
457 | WFlags fl = 0) : | 457 | WFlags fl = 0) : |
458 | ClickableLabel(parent,name,fl), event(ev) { | 458 | ClickableLabel(parent,name,fl), event(ev) { |
459 | 459 | ||
460 | QString msg; | 460 | QString msg; |
461 | //QTime time = QTime::currentTime(); | 461 | //QTime time = QTime::currentTime(); |
462 | 462 | ||
463 | Config config( "qpe" ); | ||
464 | // if 24 h format | ||
465 | ampm = config.readBoolEntry( "AMPM", TRUE ); | ||
466 | |||
467 | |||
463 | if (!ONLY_LATER) { | 468 | if (!ONLY_LATER) { |
464 | msg += "<B>" + (ev).description() + "</B>"; | 469 | msg += "<B>" + (ev).description() + "</B>"; |
465 | if ( (ev).event().hasAlarm() ) { | 470 | if ( (ev).event().hasAlarm() ) { |
@@ -469,16 +474,16 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
469 | if (SHOW_LOCATION == 1) { | 474 | if (SHOW_LOCATION == 1) { |
470 | msg += "<BR><i>" + (ev).location() + "</i>"; | 475 | msg += "<BR><i>" + (ev).location() + "</i>"; |
471 | } | 476 | } |
472 | 477 | ||
473 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 478 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
474 | msg += "<br>All day"; | 479 | msg += "<br>All day"; |
475 | } else { | 480 | } else { |
476 | // start time of event | 481 | // start time of event |
477 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 482 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ); |
478 | // end time of event | 483 | // end time of event |
479 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 484 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
480 | } | 485 | } |
481 | 486 | ||
482 | // include possible note or not | 487 | // include possible note or not |
483 | if (SHOW_NOTES == 1) { | 488 | if (SHOW_NOTES == 1) { |
484 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | 489 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
@@ -490,17 +495,42 @@ DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | |||
490 | } | 495 | } |
491 | 496 | ||
492 | 497 | ||
493 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | 498 | QString DateBookEvent::ampmTime(QTime tm) { |
494 | QWidget* parent = 0, | 499 | |
500 | QString s; | ||
501 | if( ampm ) { | ||
502 | int hour = tm.hour(); | ||
503 | if (hour == 0) | ||
504 | hour = 12; | ||
505 | if (hour > 12) | ||
506 | hour -= 12; | ||
507 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | ||
508 | (tm.hour() >= 12) ? "PM" : "AM" ); | ||
509 | return s; | ||
510 | } else { | ||
511 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | ||
512 | return s; | ||
513 | } | ||
514 | |||
515 | } | ||
516 | |||
517 | |||
518 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | ||
519 | QWidget* parent = 0, | ||
495 | int SHOW_LOCATION = 0, | 520 | int SHOW_LOCATION = 0, |
496 | int SHOW_NOTES = 0, | 521 | int SHOW_NOTES = 0, |
497 | const char* name = 0, | 522 | const char* name = 0, |
498 | WFlags fl = 0) : | 523 | WFlags fl = 0) : |
499 | ClickableLabel(parent,name,fl), event(ev) { | 524 | ClickableLabel(parent,name,fl), event(ev) { |
500 | 525 | ||
501 | QString msg; | 526 | QString msg; |
502 | QTime time = QTime::currentTime(); | 527 | QTime time = QTime::currentTime(); |
503 | 528 | ||
529 | Config config( "qpe" ); | ||
530 | // if 24 h format | ||
531 | ampm = config.readBoolEntry( "AMPM", TRUE ); | ||
532 | |||
533 | |||
504 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | 534 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { |
505 | // show only later appointments | 535 | // show only later appointments |
506 | msg += "<B>" + (ev).description() + "</B>"; | 536 | msg += "<B>" + (ev).description() + "</B>"; |
@@ -511,27 +541,47 @@ DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | |||
511 | if (SHOW_LOCATION == 1) { | 541 | if (SHOW_LOCATION == 1) { |
512 | msg += "<BR><i>" + (ev).location() + "</i>"; | 542 | msg += "<BR><i>" + (ev).location() + "</i>"; |
513 | } | 543 | } |
514 | 544 | ||
515 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 545 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
516 | msg += "<br>All day"; | 546 | msg += "<br>All day"; |
517 | } else { | 547 | } else { |
518 | // start time of event | 548 | // start time of event |
519 | msg += "<br>" + TimeString::timeString(QTime((ev).event().start().time()) ) | 549 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) |
520 | // end time of event | 550 | // end time of event |
521 | + "<b> - </b>" + TimeString::timeString(QTime((ev).event().end().time()) ); | 551 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
522 | } | 552 | } |
523 | // include possible note or not | 553 | // include possible note or not |
524 | if (SHOW_NOTES == 1) { | 554 | if (SHOW_NOTES == 1) { |
525 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | 555 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
526 | } | 556 | } |
527 | } | 557 | } |
528 | 558 | ||
529 | setText(msg); | 559 | setText(msg); |
530 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 560 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
531 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 561 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
532 | } | 562 | } |
533 | 563 | ||
534 | 564 | ||
565 | QString DateBookEventLater::ampmTime(QTime tm) { | ||
566 | |||
567 | QString s; | ||
568 | if( ampm ) { | ||
569 | int hour = tm.hour(); | ||
570 | if (hour == 0) | ||
571 | hour = 12; | ||
572 | if (hour > 12) | ||
573 | hour -= 12; | ||
574 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | ||
575 | (tm.hour() >= 12) ? "PM" : "AM" ); | ||
576 | return s; | ||
577 | } else { | ||
578 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | ||
579 | return s; | ||
580 | } | ||
581 | |||
582 | } | ||
583 | |||
584 | |||
535 | void DateBookEvent::editMe() { | 585 | void DateBookEvent::editMe() { |
536 | emit editEvent(event.event()); | 586 | emit editEvent(event.event()); |
537 | } | 587 | } |
diff --git a/core/pim/today/today.h b/core/pim/today/today.h index 090e8f9..d265d67 100644 --- a/core/pim/today/today.h +++ b/core/pim/today/today.h | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <opie/tododb.h> | 27 | #include <opie/tododb.h> |
28 | 28 | ||
29 | #include <qdatetime.h> | 29 | #include <qdatetime.h> |
30 | #include <qlist.h> | 30 | #include <qlist.h> |
31 | 31 | ||
32 | #include "todayconfig.h" | 32 | #include "todayconfig.h" |
33 | #include "todaybase.h" | 33 | #include "todaybase.h" |
@@ -36,12 +36,12 @@ | |||
36 | class QVBoxLayout; | 36 | class QVBoxLayout; |
37 | 37 | ||
38 | class Today : public TodayBase { | 38 | class Today : public TodayBase { |
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | 40 | ||
41 | public: | 41 | public: |
42 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); | 42 | Today( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); |
43 | ~Today(); | 43 | ~Today(); |
44 | 44 | ||
45 | private slots: | 45 | private slots: |
46 | void startConfig(); | 46 | void startConfig(); |
47 | void startTodo(); | 47 | void startTodo(); |
@@ -58,9 +58,9 @@ class Today : public TodayBase { | |||
58 | bool checkIfModified(); | 58 | bool checkIfModified(); |
59 | void setOwnerField(); | 59 | void setOwnerField(); |
60 | void setOwnerField(QString &string); | 60 | void setOwnerField(QString &string); |
61 | private slots: | 61 | private slots: |
62 | void channelReceived(const QCString &msg, const QByteArray & data); | 62 | void channelReceived(const QCString &msg, const QByteArray & data); |
63 | 63 | ||
64 | private: | 64 | private: |
65 | DateBookDB *db; | 65 | DateBookDB *db; |
66 | ToDoDB *todo; | 66 | ToDoDB *todo; |
@@ -70,42 +70,46 @@ class Today : public TodayBase { | |||
70 | int MAX_LINES_TASK; | 70 | int MAX_LINES_TASK; |
71 | int MAX_CHAR_CLIP; | 71 | int MAX_CHAR_CLIP; |
72 | int MAX_LINES_MEET; | 72 | int MAX_LINES_MEET; |
73 | int SHOW_LOCATION; | 73 | int SHOW_LOCATION; |
74 | int SHOW_NOTES; | 74 | int SHOW_NOTES; |
75 | }; | 75 | }; |
76 | 76 | ||
77 | class DateBookEvent: public ClickableLabel { | 77 | class DateBookEvent: public ClickableLabel { |
78 | Q_OBJECT | 78 | Q_OBJECT |
79 | public: | 79 | public: |
80 | DateBookEvent(const EffectiveEvent &ev, | 80 | DateBookEvent(const EffectiveEvent &ev, |
81 | QWidget* parent = 0, | 81 | QWidget* parent = 0, |
82 | int SHOW_LOCATION = 0, | 82 | int SHOW_LOCATION = 0, |
83 | int SHOW_NOTES = 0, | 83 | int SHOW_NOTES = 0, |
84 | const char* name = 0, | 84 | const char* name = 0, |
85 | WFlags fl = 0); | 85 | WFlags fl = 0); |
86 | signals: | 86 | signals: |
87 | void editEvent(const Event &e); | 87 | void editEvent(const Event &e); |
88 | private slots: | 88 | private slots: |
89 | void editMe(); | 89 | void editMe(); |
90 | private: | 90 | private: |
91 | QString ampmTime(QTime); | ||
91 | const EffectiveEvent event; | 92 | const EffectiveEvent event; |
93 | bool ampm; | ||
92 | }; | 94 | }; |
93 | 95 | ||
94 | class DateBookEventLater: public ClickableLabel { | 96 | class DateBookEventLater: public ClickableLabel { |
95 | Q_OBJECT | 97 | Q_OBJECT |
96 | public: | 98 | public: |
97 | DateBookEventLater(const EffectiveEvent &ev, | 99 | DateBookEventLater(const EffectiveEvent &ev, |
98 | QWidget* parent = 0, | 100 | QWidget* parent = 0, |
99 | int SHOW_LOCATION = 0, | 101 | int SHOW_LOCATION = 0, |
100 | int SHOW_NOTES = 0, | 102 | int SHOW_NOTES = 0, |
101 | const char* name = 0, | 103 | const char* name = 0, |
102 | WFlags fl = 0); | 104 | WFlags fl = 0); |
103 | signals: | 105 | signals: |
104 | void editEvent(const Event &e); | 106 | void editEvent(const Event &e); |
105 | private slots: | 107 | private slots: |
106 | void editMe(); | 108 | void editMe(); |
107 | private: | 109 | private: |
110 | QString ampmTime(QTime); | ||
108 | const EffectiveEvent event; | 111 | const EffectiveEvent event; |
112 | bool ampm; | ||
109 | }; | 113 | }; |
110 | 114 | ||
111 | #endif // TODAY_H | 115 | #endif // TODAY_H |
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index 755c860..ae8763b 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -45,13 +45,13 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
45 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon | 45 | QPixmap config = Resource::loadPixmap( "today/config" ); // config icon |
46 | QPixmap mail = Resource::loadPixmap( "today/mail" ); // mail icon | 46 | QPixmap mail = Resource::loadPixmap( "today/mail" ); // mail icon |
47 | 47 | ||
48 | QPalette pal = this->palette(); | 48 | //QPalette pal = this->palette(); |
49 | QColor col = pal.color(QPalette::Active, QColorGroup::Background); | 49 | // QColor col = pal.color(QPalette::Active, QColorGroup::Background); |
50 | pal.setColor(QPalette::Active, QColorGroup::Button, col); | 50 | //pal.setColor(QPalette::Active, QColorGroup::Button, col); |
51 | pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | 51 | //pal.setColor(QPalette::Inactive, QColorGroup::Button, col); |
52 | pal.setColor(QPalette::Normal, QColorGroup::Button, col); | 52 | //pal.setColor(QPalette::Normal, QColorGroup::Button, col); |
53 | pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | 53 | //pal.setColor(QPalette::Disabled, QColorGroup::Button, col); |
54 | this->setPalette(pal); | 54 | //this->setPalette(pal); |
55 | 55 | ||
56 | 56 | ||
57 | QWidget *d = QApplication::desktop(); | 57 | QWidget *d = QApplication::desktop(); |
@@ -95,7 +95,7 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
95 | 95 | ||
96 | // --- dates section --- | 96 | // --- dates section --- |
97 | Frame4 = new QFrame( this, "Frame4" ); | 97 | Frame4 = new QFrame( this, "Frame4" ); |
98 | Frame4->setPalette( pal ); | 98 | // Frame4->setPalette( pal ); |
99 | Frame4->setFrameShape( QScrollView::StyledPanel ); | 99 | Frame4->setFrameShape( QScrollView::StyledPanel ); |
100 | Frame4->setFrameShadow( QScrollView::Sunken ); | 100 | Frame4->setFrameShadow( QScrollView::Sunken ); |
101 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); | 101 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); |
@@ -112,7 +112,7 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
112 | DatesButton = new QPushButton (Frame4, "DatesButton" ); | 112 | DatesButton = new QPushButton (Frame4, "DatesButton" ); |
113 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | 113 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); |
114 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); | 114 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); |
115 | DatesButton->setPalette( pal ); | 115 | // DatesButton->setPalette( pal ); |
116 | DatesButton->setPixmap( datebook ); | 116 | DatesButton->setPixmap( datebook ); |
117 | DatesButton->setFlat( TRUE ); | 117 | DatesButton->setFlat( TRUE ); |
118 | 118 | ||
@@ -128,7 +128,7 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
128 | 128 | ||
129 | MailButton = new QPushButton (MailFrame, "MailButton" ); | 129 | MailButton = new QPushButton (MailFrame, "MailButton" ); |
130 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); | 130 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); |
131 | MailButton->setPalette( pal ); | 131 | // MailButton->setPalette( pal ); |
132 | MailButton->setPixmap( mail ); | 132 | MailButton->setPixmap( mail ); |
133 | MailButton->setFlat( TRUE ); | 133 | MailButton->setFlat( TRUE ); |
134 | 134 | ||
@@ -150,7 +150,7 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
150 | 150 | ||
151 | TodoButton = new QPushButton (Frame15, "TodoButton" ); | 151 | TodoButton = new QPushButton (Frame15, "TodoButton" ); |
152 | TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | 152 | TodoButton->setGeometry( QRect( 2, 4, 36, 32 ) ); |
153 | TodoButton->setPalette( pal ); | 153 | // TodoButton->setPalette( pal ); |
154 | TodoButton->setPixmap( todo ); | 154 | TodoButton->setPixmap( todo ); |
155 | TodoButton->setFlat( TRUE ); | 155 | TodoButton->setFlat( TRUE ); |
156 | 156 | ||
@@ -169,7 +169,7 @@ TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | |||
169 | PushButton1 = new QPushButton (Frame15, "PushButton1" ); | 169 | PushButton1 = new QPushButton (Frame15, "PushButton1" ); |
170 | PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) ); | 170 | PushButton1->setGeometry( QRect( 2, 68, 25, 21 ) ); |
171 | PushButton1->setPixmap( config ); | 171 | PushButton1->setPixmap( config ); |
172 | PushButton1->setPalette( pal ); | 172 | // PushButton1->setPalette( pal ); |
173 | PushButton1->setAutoDefault( TRUE ); | 173 | PushButton1->setAutoDefault( TRUE ); |
174 | PushButton1->setFlat( TRUE ); | 174 | PushButton1->setFlat( TRUE ); |
175 | 175 | ||