author | harlekin <harlekin> | 2002-04-27 17:06:35 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-27 17:06:35 (UTC) |
commit | 32f808191e255c82044f281f6032f336b75f2fc6 (patch) (unidiff) | |
tree | 26edc161e8c646325eef15a4b50a14baad6594c4 | |
parent | 0fb2ea5d51271cfad323b69c4c191c946f45a5a0 (diff) | |
download | opie-32f808191e255c82044f281f6032f336b75f2fc6.zip opie-32f808191e255c82044f281f6032f336b75f2fc6.tar.gz opie-32f808191e255c82044f281f6032f336b75f2fc6.tar.bz2 |
fixes for the logo part, looks better now on screen > 240 pixel width. Also now all the i18n guys can finally translate the Today string .-)
-rw-r--r-- | core/pim/today/today.cpp | 4 | ||||
-rw-r--r-- | core/pim/today/todaybase.cpp | 27 |
2 files changed, 21 insertions, 10 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 0ab7a2a..01d1a13 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -70,129 +70,129 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
70 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | 70 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); |
71 | 71 | ||
72 | #if defined(Q_WS_QWS) | 72 | #if defined(Q_WS_QWS) |
73 | #if !defined(QT_NO_COP) | 73 | #if !defined(QT_NO_COP) |
74 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); | 74 | QCopChannel *todayChannel = new QCopChannel("QPE/Today" , this ); |
75 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), | 75 | connect (todayChannel, SIGNAL( received(const QCString &, const QByteArray &)), |
76 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); | 76 | this, SLOT ( channelReceived(const QCString &, const QByteArray &)) ); |
77 | #endif | 77 | #endif |
78 | #endif | 78 | #endif |
79 | 79 | ||
80 | 80 | ||
81 | 81 | ||
82 | db = NULL; | 82 | db = NULL; |
83 | setOwnerField(); | 83 | setOwnerField(); |
84 | todo = new ToDoDB; | 84 | todo = new ToDoDB; |
85 | getTodo(); | 85 | getTodo(); |
86 | draw(); | 86 | draw(); |
87 | autoStart(); | 87 | autoStart(); |
88 | } | 88 | } |
89 | 89 | ||
90 | /* | 90 | /* |
91 | * Qcop receive method. | 91 | * Qcop receive method. |
92 | */ | 92 | */ |
93 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { | 93 | void Today::channelReceived(const QCString &msg, const QByteArray & data) { |
94 | QDataStream stream(data, IO_ReadOnly ); | 94 | QDataStream stream(data, IO_ReadOnly ); |
95 | if ( msg == "message(QString)" ) { | 95 | if ( msg == "message(QString)" ) { |
96 | QString message; | 96 | QString message; |
97 | stream >> message; | 97 | stream >> message; |
98 | setOwnerField(message); | 98 | setOwnerField(message); |
99 | } | 99 | } |
100 | 100 | ||
101 | } | 101 | } |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Initialises the owner field with the default value, the username | 104 | * Initialises the owner field with the default value, the username |
105 | */ | 105 | */ |
106 | void Today::setOwnerField() { | 106 | void Today::setOwnerField() { |
107 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); | 107 | QString file = Global::applicationFileName("addressbook", "businesscard.vcf"); |
108 | if (QFile::exists(file)) { | 108 | if (QFile::exists(file)) { |
109 | Contact cont = Contact::readVCard(file)[0]; | 109 | Contact cont = Contact::readVCard(file)[0]; |
110 | QString returnString = cont.fullName(); | 110 | QString returnString = cont.fullName(); |
111 | OwnerField->setText( "<b>" +tr ("Owned by ") + returnString + "</b>"); | 111 | OwnerField->setText( "<b>" +tr ("Owned by ") + returnString + "</b>"); |
112 | } else { | 112 | } else { |
113 | OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>"); | 113 | OwnerField->setText( "<b>" + tr ("Please fill out the business card")+" </b>"); |
114 | } | 114 | } |
115 | } | 115 | } |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * Set the owner field with a given QString, for example per qcop. | 118 | * Set the owner field with a given QString, for example per qcop. |
119 | */ | 119 | */ |
120 | void Today::setOwnerField(QString &message) { | 120 | void Today::setOwnerField(QString &message) { |
121 | if (!message.isEmpty()) { | 121 | if (!message.isEmpty()) { |
122 | OwnerField->setText("<b>" + message + "</b>"); | 122 | OwnerField->setText("<b>" + message + "</b>"); |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | /* | 126 | /* |
127 | * Autostart, uses the new (opie only) autostart method in the launcher code. | 127 | * Autostart, uses the new (opie only) autostart method in the launcher code. |
128 | * If registered against that today ist started on each resume. | 128 | * If registered against that today ist started on each resume. |
129 | */ | 129 | */ |
130 | void Today::autoStart() { | 130 | void Today::autoStart() { |
131 | Config cfg("today"); | 131 | Config cfg("today"); |
132 | cfg.setGroup("Autostart"); | 132 | cfg.setGroup("Autostart"); |
133 | int AUTOSTART = cfg.readNumEntry("autostart",1); | 133 | int AUTOSTART = cfg.readNumEntry("autostart",1); |
134 | qDebug(QString("%1").arg(AUTOSTART)); | 134 | // qDebug(QString("%1").arg(AUTOSTART)); |
135 | if (AUTOSTART) { | 135 | if (AUTOSTART) { |
136 | QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)"); | 136 | QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)"); |
137 | e << QString("add"); | 137 | e << QString("add"); |
138 | e << QString("today"); | 138 | e << QString("today"); |
139 | e << AUTOSTART_TIMER; | 139 | e << AUTOSTART_TIMER; |
140 | } else { | 140 | } else { |
141 | qDebug("Nun in else bei autostart"); | 141 | qDebug("Nun in else bei autostart"); |
142 | QCopEnvelope e("QPE/System", "autoStart(QString, QString)"); | 142 | QCopEnvelope e("QPE/System", "autoStart(QString, QString)"); |
143 | e << QString("remove"); | 143 | e << QString("remove"); |
144 | e << QString("today"); | 144 | e << QString("today"); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * Repaint method. Reread all fields. | 149 | * Repaint method. Reread all fields. |
150 | */ | 150 | */ |
151 | void Today::draw() { | 151 | void Today::draw() { |
152 | init(); | 152 | init(); |
153 | getDates(); | 153 | getDates(); |
154 | getMail(); | 154 | getMail(); |
155 | 155 | ||
156 | // if the todolist.xml file was not modified in between, do not parse it. | 156 | // if the todolist.xml file was not modified in between, do not parse it. |
157 | if (checkIfModified()) { | 157 | if (checkIfModified()) { |
158 | if (todo) delete todo; | 158 | if (todo) delete todo; |
159 | todo = new ToDoDB; | 159 | todo = new ToDoDB; |
160 | getTodo(); | 160 | getTodo(); |
161 | } | 161 | } |
162 | 162 | ||
163 | // how often refresh | 163 | // how often refresh |
164 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); | 164 | QTimer::singleShot( 20*1000, this, SLOT(draw() ) ); |
165 | } | 165 | } |
166 | 166 | ||
167 | /* | 167 | /* |
168 | * Check if the todolist.xml was modified (if there are new entries. | 168 | * Check if the todolist.xml was modified (if there are new entries. |
169 | * Returns true if it was modified. | 169 | * Returns true if it was modified. |
170 | */ | 170 | */ |
171 | bool Today::checkIfModified() { | 171 | bool Today::checkIfModified() { |
172 | 172 | ||
173 | QDir dir; | 173 | QDir dir; |
174 | QString homedir = dir.homeDirPath (); | 174 | QString homedir = dir.homeDirPath (); |
175 | QString time; | 175 | QString time; |
176 | 176 | ||
177 | Config cfg("today"); | 177 | Config cfg("today"); |
178 | cfg.setGroup("Files"); | 178 | cfg.setGroup("Files"); |
179 | time = cfg.readEntry("todolisttimestamp", ""); | 179 | time = cfg.readEntry("todolisttimestamp", ""); |
180 | 180 | ||
181 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); | 181 | QFileInfo file = (homedir +"/Applications/todolist/todolist.xml"); |
182 | QDateTime fileTime = file.lastModified(); | 182 | QDateTime fileTime = file.lastModified(); |
183 | if (time.compare(fileTime.toString()) == 0) { | 183 | if (time.compare(fileTime.toString()) == 0) { |
184 | return false; | 184 | return false; |
185 | } else { | 185 | } else { |
186 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); | 186 | cfg.writeEntry("todolisttimestamp", fileTime.toString() ); |
187 | cfg.write(); | 187 | cfg.write(); |
188 | return true; | 188 | return true; |
189 | } | 189 | } |
190 | } | 190 | } |
191 | 191 | ||
192 | 192 | ||
193 | /* | 193 | /* |
194 | * Init stuff needed for today. Reads the config file. | 194 | * Init stuff needed for today. Reads the config file. |
195 | */ | 195 | */ |
196 | void Today::init() { | 196 | void Today::init() { |
197 | QDate date = QDate::currentDate(); | 197 | QDate date = QDate::currentDate(); |
198 | QString time = (tr( date.toString()) ); | 198 | QString time = (tr( date.toString()) ); |
@@ -418,194 +418,196 @@ void Today::getTodo() { | |||
418 | 418 | ||
419 | TodoField->setText(tr(output)); | 419 | TodoField->setText(tr(output)); |
420 | } | 420 | } |
421 | 421 | ||
422 | /* | 422 | /* |
423 | * launches datebook | 423 | * launches datebook |
424 | */ | 424 | */ |
425 | void Today::startDatebook() { | 425 | void Today::startDatebook() { |
426 | QCopEnvelope e("QPE/System", "execute(QString)"); | 426 | QCopEnvelope e("QPE/System", "execute(QString)"); |
427 | e << QString("datebook"); | 427 | e << QString("datebook"); |
428 | } | 428 | } |
429 | 429 | ||
430 | /* | 430 | /* |
431 | * starts the edit dialog as known from datebook | 431 | * starts the edit dialog as known from datebook |
432 | */ | 432 | */ |
433 | 433 | ||
434 | extern QPEApplication *todayApp; | 434 | extern QPEApplication *todayApp; |
435 | 435 | ||
436 | void Today::editEvent(const Event &e) { | 436 | void Today::editEvent(const Event &e) { |
437 | startDatebook(); | 437 | startDatebook(); |
438 | 438 | ||
439 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); | 439 | while(!QCopChannel::isRegistered("QPE/Datebook")) todayApp->processEvents(); |
440 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); | 440 | QCopEnvelope env("QPE/Datebook", "editEvent(int)"); |
441 | env << e.uid(); | 441 | env << e.uid(); |
442 | } | 442 | } |
443 | 443 | ||
444 | /* | 444 | /* |
445 | * launches todolist | 445 | * launches todolist |
446 | */ | 446 | */ |
447 | void Today::startTodo() { | 447 | void Today::startTodo() { |
448 | QCopEnvelope e("QPE/System", "execute(QString)"); | 448 | QCopEnvelope e("QPE/System", "execute(QString)"); |
449 | e << QString("todolist"); | 449 | e << QString("todolist"); |
450 | } | 450 | } |
451 | 451 | ||
452 | /* | 452 | /* |
453 | * launch opiemail | 453 | * launch opiemail |
454 | */ | 454 | */ |
455 | void Today::startMail() { | 455 | void Today::startMail() { |
456 | QCopEnvelope e("QPE/System", "execute(QString)"); | 456 | QCopEnvelope e("QPE/System", "execute(QString)"); |
457 | e << QString("opiemail"); | 457 | e << QString("opiemail"); |
458 | //Right now start both, maybe decide which to rum via config file .. | 458 | //Right now start both, maybe decide which to rum via config file .. |
459 | QCopEnvelope f("QPE/System", "execute(QString)"); | 459 | QCopEnvelope f("QPE/System", "execute(QString)"); |
460 | f << QString("qtmail"); | 460 | f << QString("qtmail"); |
461 | } | 461 | } |
462 | 462 | ||
463 | 463 | ||
464 | Today::~Today() { | 464 | Today::~Today() { |
465 | } | 465 | } |
466 | 466 | ||
467 | /* | 467 | /* |
468 | * Gets the events for the current day, if it should get all dates | 468 | * Gets the events for the current day, if it should get all dates |
469 | */ | 469 | */ |
470 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, | 470 | DateBookEvent::DateBookEvent(const EffectiveEvent &ev, |
471 | QWidget* parent = 0, | 471 | QWidget* parent = 0, |
472 | int SHOW_LOCATION = 0, | 472 | int SHOW_LOCATION = 0, |
473 | int SHOW_NOTES = 0, | 473 | int SHOW_NOTES = 0, |
474 | const char* name = 0, | 474 | const char* name = 0, |
475 | WFlags fl = 0) : | 475 | WFlags fl = 0) : |
476 | ClickableLabel(parent,name,fl), event(ev) { | 476 | ClickableLabel(parent,name,fl), event(ev) { |
477 | 477 | ||
478 | QString msg; | 478 | QString msg; |
479 | //QTime time = QTime::currentTime(); | 479 | //QTime time = QTime::currentTime(); |
480 | 480 | ||
481 | Config config( "qpe" ); | 481 | Config config( "qpe" ); |
482 | config.setGroup( "Time" ); | ||
482 | // if 24 h format | 483 | // if 24 h format |
483 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 484 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
484 | 485 | ||
485 | 486 | ||
486 | if (!ONLY_LATER) { | 487 | if (!ONLY_LATER) { |
487 | msg += "<B>" + (ev).description() + "</B>"; | 488 | msg += "<B>" + (ev).description() + "</B>"; |
488 | if ( (ev).event().hasAlarm() ) { | 489 | if ( (ev).event().hasAlarm() ) { |
489 | msg += " <b>[with alarm]</b>"; | 490 | msg += " <b>[with alarm]</b>"; |
490 | } | 491 | } |
491 | // include location or not | 492 | // include location or not |
492 | if (SHOW_LOCATION == 1) { | 493 | if (SHOW_LOCATION == 1) { |
493 | msg += "<BR><i>" + (ev).location() + "</i>"; | 494 | msg += "<BR><i>" + (ev).location() + "</i>"; |
494 | } | 495 | } |
495 | 496 | ||
496 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 497 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
497 | msg += "<br>All day"; | 498 | msg += "<br>All day"; |
498 | } else { | 499 | } else { |
499 | // start time of event | 500 | // start time of event |
500 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | 501 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) |
501 | // end time of event | 502 | // end time of event |
502 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | 503 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
503 | } | 504 | } |
504 | 505 | ||
505 | // include possible note or not | 506 | // include possible note or not |
506 | if (SHOW_NOTES == 1) { | 507 | if (SHOW_NOTES == 1) { |
507 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | 508 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
508 | } | 509 | } |
509 | } | 510 | } |
510 | setText(msg); | 511 | setText(msg); |
511 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 512 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
512 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 513 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
513 | } | 514 | } |
514 | 515 | ||
515 | 516 | ||
516 | QString DateBookEvent::ampmTime(QTime tm) { | 517 | QString DateBookEvent::ampmTime(QTime tm) { |
517 | 518 | ||
518 | QString s; | 519 | QString s; |
519 | if( ampm ) { | 520 | if( ampm ) { |
520 | int hour = tm.hour(); | 521 | int hour = tm.hour(); |
521 | if (hour == 0) | 522 | if (hour == 0) |
522 | hour = 12; | 523 | hour = 12; |
523 | if (hour > 12) | 524 | if (hour > 12) |
524 | hour -= 12; | 525 | hour -= 12; |
525 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 526 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
526 | (tm.hour() >= 12) ? "PM" : "AM" ); | 527 | (tm.hour() >= 12) ? "PM" : "AM" ); |
527 | return s; | 528 | return s; |
528 | } else { | 529 | } else { |
529 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 530 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
530 | return s; | 531 | return s; |
531 | } | 532 | } |
532 | 533 | ||
533 | } | 534 | } |
534 | 535 | ||
535 | 536 | ||
536 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, | 537 | DateBookEventLater::DateBookEventLater(const EffectiveEvent &ev, |
537 | QWidget* parent = 0, | 538 | QWidget* parent = 0, |
538 | int SHOW_LOCATION = 0, | 539 | int SHOW_LOCATION = 0, |
539 | int SHOW_NOTES = 0, | 540 | int SHOW_NOTES = 0, |
540 | const char* name = 0, | 541 | const char* name = 0, |
541 | WFlags fl = 0) : | 542 | WFlags fl = 0) : |
542 | ClickableLabel(parent,name,fl), event(ev) { | 543 | ClickableLabel(parent,name,fl), event(ev) { |
543 | 544 | ||
544 | QString msg; | 545 | QString msg; |
545 | QTime time = QTime::currentTime(); | 546 | QTime time = QTime::currentTime(); |
546 | 547 | ||
547 | Config config( "qpe" ); | 548 | Config config( "qpe" ); |
549 | config.setGroup( "Time" ); | ||
548 | // if 24 h format | 550 | // if 24 h format |
549 | ampm = config.readBoolEntry( "AMPM", TRUE ); | 551 | ampm = config.readBoolEntry( "AMPM", TRUE ); |
550 | 552 | ||
551 | 553 | ||
552 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { | 554 | if ((time.toString() <= TimeString::dateString((ev).event().end())) ) { |
553 | // show only later appointments | 555 | // show only later appointments |
554 | msg += "<B>" + (ev).description() + "</B>"; | 556 | msg += "<B>" + (ev).description() + "</B>"; |
555 | if ( (ev).event().hasAlarm() ) { | 557 | if ( (ev).event().hasAlarm() ) { |
556 | msg += " <b>[with alarm]</b>"; | 558 | msg += " <b>[with alarm]</b>"; |
557 | } | 559 | } |
558 | // include location or not | 560 | // include location or not |
559 | if (SHOW_LOCATION == 1) { | 561 | if (SHOW_LOCATION == 1) { |
560 | msg += "<BR><i>" + (ev).location() + "</i>"; | 562 | msg += "<BR><i>" + (ev).location() + "</i>"; |
561 | } | 563 | } |
562 | 564 | ||
563 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { | 565 | if ( (TimeString::timeString(QTime((ev).event().start().time()) ) == "00:00") && (TimeString::timeString(QTime((ev).event().end().time()) ) == "23:59") ) { |
564 | msg += "<br>All day"; | 566 | msg += "<br>All day"; |
565 | } else { | 567 | } else { |
566 | // start time of event | 568 | // start time of event |
567 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) | 569 | msg += "<br>" + ampmTime(QTime((ev).event().start().time()) ) |
568 | // end time of event | 570 | // end time of event |
569 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); | 571 | + "<b> - </b>" + ampmTime(QTime((ev).event().end().time()) ); |
570 | } | 572 | } |
571 | // include possible note or not | 573 | // include possible note or not |
572 | if (SHOW_NOTES == 1) { | 574 | if (SHOW_NOTES == 1) { |
573 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); | 575 | msg += "<br> <i>note</i>:" +((ev).notes()).mid(0, MAX_CHAR_CLIP); |
574 | } | 576 | } |
575 | } | 577 | } |
576 | 578 | ||
577 | setText(msg); | 579 | setText(msg); |
578 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); | 580 | connect(this, SIGNAL(clicked()), this, SLOT(editMe())); |
579 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); | 581 | setAlignment( int( QLabel::WordBreak | QLabel::AlignLeft ) ); |
580 | } | 582 | } |
581 | 583 | ||
582 | 584 | ||
583 | QString DateBookEventLater::ampmTime(QTime tm) { | 585 | QString DateBookEventLater::ampmTime(QTime tm) { |
584 | 586 | ||
585 | QString s; | 587 | QString s; |
586 | if( ampm ) { | 588 | if( ampm ) { |
587 | int hour = tm.hour(); | 589 | int hour = tm.hour(); |
588 | if (hour == 0) | 590 | if (hour == 0) |
589 | hour = 12; | 591 | hour = 12; |
590 | if (hour > 12) | 592 | if (hour > 12) |
591 | hour -= 12; | 593 | hour -= 12; |
592 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), | 594 | s.sprintf( "%2d:%02d %s", hour, tm.minute(), |
593 | (tm.hour() >= 12) ? "PM" : "AM" ); | 595 | (tm.hour() >= 12) ? "PM" : "AM" ); |
594 | return s; | 596 | return s; |
595 | } else { | 597 | } else { |
596 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); | 598 | s.sprintf( "%2d:%02d", tm.hour(), tm.minute() ); |
597 | return s; | 599 | return s; |
598 | } | 600 | } |
599 | 601 | ||
600 | } | 602 | } |
601 | 603 | ||
602 | 604 | ||
603 | void DateBookEvent::editMe() { | 605 | void DateBookEvent::editMe() { |
604 | emit editEvent(event.event()); | 606 | emit editEvent(event.event()); |
605 | } | 607 | } |
606 | 608 | ||
607 | void DateBookEventLater::editMe() { | 609 | void DateBookEventLater::editMe() { |
608 | emit editEvent(event.event()); | 610 | emit editEvent(event.event()); |
609 | } | 611 | } |
610 | 612 | ||
611 | 613 | ||
diff --git a/core/pim/today/todaybase.cpp b/core/pim/today/todaybase.cpp index ae8763b..c6ea11f 100644 --- a/core/pim/today/todaybase.cpp +++ b/core/pim/today/todaybase.cpp | |||
@@ -1,145 +1,154 @@ | |||
1 | /* | 1 | /* |
2 | * todaybase.cpp * | 2 | * todaybase.cpp * |
3 | * --------------------- | 3 | * --------------------- |
4 | * | 4 | * |
5 | * begin : Sun 10 17:20:00 CEST 2002 | 5 | * begin : Sun 10 17:20:00 CEST 2002 |
6 | * copyright : (c) 2002 by Maximilian Reiß | 6 | * copyright : (c) 2002 by Maximilian Reiß |
7 | * email : max.reiss@gmx.de | 7 | * email : max.reiss@gmx.de |
8 | * | 8 | * |
9 | */ | 9 | */ |
10 | /*************************************************************************** | 10 | /*************************************************************************** |
11 | * * | 11 | * * |
12 | * This program is free software; you can redistribute it and/or modify * | 12 | * This program is free software; you can redistribute it and/or modify * |
13 | * it under the terms of the GNU General Public License as published by * | 13 | * it under the terms of the GNU General Public License as published by * |
14 | * the Free Software Foundation; either version 2 of the License, or * | 14 | * the Free Software Foundation; either version 2 of the License, or * |
15 | * (at your option) any later version. * | 15 | * (at your option) any later version. * |
16 | * * | 16 | * * |
17 | ***************************************************************************/ | 17 | ***************************************************************************/ |
18 | 18 | ||
19 | #include "todaybase.h" | 19 | #include "todaybase.h" |
20 | 20 | ||
21 | #include <qframe.h> | 21 | #include <qframe.h> |
22 | #include <qlabel.h> | 22 | #include <qlabel.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qvariant.h> | 25 | #include <qvariant.h> |
26 | #include <qwhatsthis.h> | 26 | #include <qwhatsthis.h> |
27 | #include <qimage.h> | 27 | #include <qimage.h> |
28 | #include <qpixmap.h> | 28 | #include <qpixmap.h> |
29 | #include <qscrollview.h> | 29 | #include <qscrollview.h> |
30 | #include <qvbox.h> | 30 | #include <qvbox.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | 32 | ||
33 | #include <qpe/resource.h> | 33 | #include <qpe/resource.h> |
34 | 34 | ||
35 | /* | 35 | /* |
36 | * Constructs a TodayBase which is a child of 'parent', with the | 36 | * Constructs a TodayBase which is a child of 'parent', with the |
37 | * name 'name' and widget flags set to 'f' | 37 | * name 'name' and widget flags set to 'f' |
38 | */ | 38 | */ |
39 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) | 39 | TodayBase::TodayBase( QWidget* parent, const char* name, WFlags fl ) |
40 | : QWidget( parent, name, fl ) | 40 | : QWidget( parent, name, fl ) |
41 | { | 41 | { |
42 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo | 42 | QPixmap logo = Resource::loadPixmap( "today/today_logo"); // logo |
43 | QPixmap datebook = Resource::loadPixmap("DateBook"); // datebook | 43 | QPixmap datebook = Resource::loadPixmap("DateBook"); // datebook |
44 | QPixmap todo = Resource::loadPixmap( "TodoList" ); // todo | 44 | QPixmap todo = Resource::loadPixmap( "TodoList" ); // todo |
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 | QPixmap opiezilla = Resource::loadPixmap("today/opiezilla" ); //the opiezilla | |
48 | //QPalette pal = this->palette(); | ||
49 | // QColor col = pal.color(QPalette::Active, QColorGroup::Background); | ||
50 | //pal.setColor(QPalette::Active, QColorGroup::Button, col); | ||
51 | //pal.setColor(QPalette::Inactive, QColorGroup::Button, col); | ||
52 | //pal.setColor(QPalette::Normal, QColorGroup::Button, col); | ||
53 | //pal.setColor(QPalette::Disabled, QColorGroup::Button, col); | ||
54 | //this->setPalette(pal); | ||
55 | |||
56 | 48 | ||
57 | QWidget *d = QApplication::desktop(); | 49 | QWidget *d = QApplication::desktop(); |
58 | int w=d->width(); | 50 | int w=d->width(); |
59 | int h=d->height(); | 51 | int h=d->height(); |
60 | resize( w , h ); | 52 | resize( w , h ); |
61 | 53 | ||
62 | // hehe, qt is ... | 54 | // hehe, qt is ... |
63 | getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" ); | 55 | getridoffuckingstrippeldlinesbutton = new QPushButton (this, "asdfsad" ); |
64 | getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); | 56 | getridoffuckingstrippeldlinesbutton->setGeometry( QRect( -5, 10, 0, 0 ) ); |
65 | 57 | ||
66 | QVBoxLayout * layout = new QVBoxLayout(this); | 58 | QVBoxLayout * layout = new QVBoxLayout(this); |
67 | 59 | ||
68 | // --- logo Section --- | 60 | // --- logo Section --- |
69 | QPalette pal2; | 61 | QPalette pal2; |
70 | QColorGroup cg; | 62 | QColorGroup cg; |
71 | cg.setColor( QColorGroup::Text, white ); | 63 | cg.setColor( QColorGroup::Text, white ); |
72 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) ); | 64 | cg.setBrush( QColorGroup::Background, QBrush( QColor( 238, 238, 230), logo ) ); |
73 | pal2.setActive( cg ); | 65 | pal2.setActive( cg ); |
74 | // today logo | 66 | // today logo |
75 | Frame = new QLabel( this, "Frame" ); | 67 | Frame = new QLabel( this, "Frame" ); |
76 | Frame->setPalette( pal2 ); | 68 | Frame->setPalette( pal2 ); |
77 | Frame->setFrameShape( QFrame::StyledPanel ); | 69 | Frame->setFrameShape( QFrame::StyledPanel ); |
78 | Frame->setFrameShadow( QFrame::Raised ); | 70 | Frame->setFrameShadow( QFrame::Raised ); |
79 | Frame->setLineWidth( 0 ); | 71 | Frame->setLineWidth( 0 ); |
80 | Frame->setMaximumHeight(50); | 72 | Frame->setMaximumHeight(50); |
81 | Frame->setMinimumHeight(50); | 73 | Frame->setMinimumHeight(50); |
74 | |||
75 | // Today text | ||
76 | QLabel* TodayLabel = new QLabel( Frame, "TodayText" ); | ||
77 | TodayLabel->setGeometry( QRect( 10, 0, 168, 40 ) ); | ||
78 | QFont TodayLabel_font( TodayLabel->font() ); | ||
79 | TodayLabel_font.setBold( TRUE ); | ||
80 | TodayLabel_font.setPointSize(40); | ||
81 | TodayLabel->setFont( TodayLabel_font ); | ||
82 | TodayLabel->setBackgroundOrigin( QLabel::ParentOrigin ); | ||
83 | TodayLabel->setText("<font color=#FFFFFF>" + tr("Today") +"</font>"); | ||
84 | |||
85 | // Opiezilla | ||
86 | QLabel* Opiezilla = new QLabel( Frame, "OpieZilla"); | ||
87 | Opiezilla->setPixmap( opiezilla ); | ||
88 | Opiezilla->setGeometry( this->width()-50 ,1, 45, 47); | ||
89 | Opiezilla->setBackgroundOrigin( QLabel::ParentOrigin ); | ||
90 | |||
82 | // date | 91 | // date |
83 | TextLabel1 = new QLabel( Frame, "TextLabel1" ); | 92 | TextLabel1 = new QLabel( Frame, "TextLabel1" ); |
84 | TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); | 93 | TextLabel1->setGeometry( QRect( 10, 35, 168, 12 ) ); |
85 | QFont TextLabel1_font( TextLabel1->font() ); | 94 | QFont TextLabel1_font( TextLabel1->font() ); |
86 | TextLabel1_font.setBold( TRUE ); | 95 | TextLabel1_font.setBold( TRUE ); |
87 | TextLabel1->setFont( TextLabel1_font ); | 96 | TextLabel1->setFont( TextLabel1_font ); |
88 | TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); | 97 | TextLabel1->setBackgroundOrigin( QLabel::ParentOrigin ); |
89 | TextLabel1->setTextFormat( RichText ); | 98 | TextLabel1->setTextFormat( RichText ); |
90 | 99 | ||
91 | OwnerField = new QLabel(this , "Owner" ); | 100 | OwnerField = new QLabel(this , "Owner" ); |
92 | OwnerField->setGeometry(QRect(0,0, this->width(), 12 )); | 101 | OwnerField->setGeometry(QRect(0,0, this->width(), 12 )); |
93 | OwnerField->setAlignment(int (QLabel::AlignTop | QLabel::AlignLeft ) ); | 102 | OwnerField->setAlignment(int (QLabel::AlignTop | QLabel::AlignLeft ) ); |
94 | OwnerField->setMaximumHeight(12); | 103 | OwnerField->setMaximumHeight(12); |
95 | 104 | ||
96 | // --- dates section --- | 105 | // --- dates section --- |
97 | Frame4 = new QFrame( this, "Frame4" ); | 106 | Frame4 = new QFrame( this, "Frame4" ); |
98 | // Frame4->setPalette( pal ); | 107 | // Frame4->setPalette( pal ); |
99 | Frame4->setFrameShape( QScrollView::StyledPanel ); | 108 | Frame4->setFrameShape( QScrollView::StyledPanel ); |
100 | Frame4->setFrameShadow( QScrollView::Sunken ); | 109 | Frame4->setFrameShadow( QScrollView::Sunken ); |
101 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); | 110 | Frame4->setBackgroundOrigin( QScrollView::ParentOrigin ); |
102 | Frame4->setFrameStyle( QFrame::NoFrame ); | 111 | Frame4->setFrameStyle( QFrame::NoFrame ); |
103 | Frame4->setGeometry (QRect( 0, 8, this->width() , this->height()) ); | 112 | Frame4->setGeometry (QRect( 0, 8, this->width() , this->height()) ); |
104 | 113 | ||
105 | sv1 = new QScrollView( Frame4 ); | 114 | sv1 = new QScrollView( Frame4 ); |
106 | sv1->setResizePolicy(QScrollView::AutoOneFit); | 115 | sv1->setResizePolicy(QScrollView::AutoOneFit); |
107 | sv1->setHScrollBarMode( QScrollView::AlwaysOff ); | 116 | sv1->setHScrollBarMode( QScrollView::AlwaysOff ); |
108 | // need to find a better way!!! | 117 | // need to find a better way!!! |
109 | sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) ); | 118 | sv1->setGeometry (QRect( 40, 2, Frame4->width()-40 , (Frame4->height()/3)+20 ) ); |
110 | sv1->setFrameShape(QFrame::NoFrame); | 119 | sv1->setFrameShape(QFrame::NoFrame); |
111 | 120 | ||
112 | DatesButton = new QPushButton (Frame4, "DatesButton" ); | 121 | DatesButton = new QPushButton (Frame4, "DatesButton" ); |
113 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); | 122 | DatesButton->setGeometry( QRect( 2, 4, 36, 32 ) ); |
114 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); | 123 | DatesButton->setBackgroundOrigin( QPushButton::WidgetOrigin ); |
115 | // DatesButton->setPalette( pal ); | 124 | // DatesButton->setPalette( pal ); |
116 | DatesButton->setPixmap( datebook ); | 125 | DatesButton->setPixmap( datebook ); |
117 | DatesButton->setFlat( TRUE ); | 126 | DatesButton->setFlat( TRUE ); |
118 | 127 | ||
119 | // --- mail section ---) | 128 | // --- mail section ---) |
120 | MailFrame = new QFrame( this ,"MailFrame" ); | 129 | MailFrame = new QFrame( this ,"MailFrame" ); |
121 | MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); | 130 | MailFrame->setBackgroundOrigin( QScrollView::ParentOrigin ); |
122 | MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); | 131 | MailFrame->setGeometry (QRect( 0, 0, this->width() , 15) ); |
123 | MailFrame->setFrameStyle( QFrame::NoFrame ); | 132 | MailFrame->setFrameStyle( QFrame::NoFrame ); |
124 | 133 | ||
125 | QFrame* Line1 = new QFrame( MailFrame); | 134 | QFrame* Line1 = new QFrame( MailFrame); |
126 | Line1->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) ); | 135 | Line1->setGeometry( QRect( -5, 0, MailFrame->width()+5, 5 ) ); |
127 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); | 136 | Line1->setFrameStyle( QFrame::HLine | QFrame::Sunken ); |
128 | 137 | ||
129 | MailButton = new QPushButton (MailFrame, "MailButton" ); | 138 | MailButton = new QPushButton (MailFrame, "MailButton" ); |
130 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); | 139 | MailButton->setGeometry( QRect( 2, 3, 36, 19 ) ); |
131 | // MailButton->setPalette( pal ); | 140 | // MailButton->setPalette( pal ); |
132 | MailButton->setPixmap( mail ); | 141 | MailButton->setPixmap( mail ); |
133 | MailButton->setFlat( TRUE ); | 142 | MailButton->setFlat( TRUE ); |
134 | 143 | ||
135 | MailField = new QLabel( MailFrame, "MailField" ); | 144 | MailField = new QLabel( MailFrame, "MailField" ); |
136 | MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) ); | 145 | MailField->setGeometry( QRect( 40, 4, MailFrame->width(), 12) ); |
137 | MailField->setText( tr( "Opiemail not installed" ) ); | 146 | MailField->setText( tr( "Opiemail not installed" ) ); |
138 | MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); | 147 | MailField->setAlignment( int( QLabel::AlignTop | QLabel::AlignLeft ) ); |
139 | MailField->setMaximumHeight(40); | 148 | MailField->setMaximumHeight(40); |
140 | MailField->setMinimumHeight(15); | 149 | MailField->setMinimumHeight(15); |
141 | 150 | ||
142 | // --- todo section -- | 151 | // --- todo section -- |
143 | Frame15 = new QFrame( this, "Frame15" ); | 152 | Frame15 = new QFrame( this, "Frame15" ); |
144 | Frame15->setFrameStyle( QFrame::NoFrame ); | 153 | Frame15->setFrameStyle( QFrame::NoFrame ); |
145 | Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) ); | 154 | Frame15->setGeometry (QRect( 40, 3, this->width() , this->height()) ); |