author | eilers <eilers> | 2003-08-01 14:19:44 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-08-01 14:19:44 (UTC) |
commit | 34991bac7d96b1c17601be6a5607819342571e0c (patch) (unidiff) | |
tree | 65d0bc2db22bcc1dc1b5eafdafd53b9cb08a6395 | |
parent | 5346424fc26bde232a15aa34fbb720f86218b26f (diff) | |
download | opie-34991bac7d96b1c17601be6a5607819342571e0c.zip opie-34991bac7d96b1c17601be6a5607819342571e0c.tar.gz opie-34991bac7d96b1c17601be6a5607819342571e0c.tar.bz2 |
Merging changes from BRANCH_1_0 to HEAD..
-rw-r--r-- | core/pim/datebook/datebook.cpp | 50 | ||||
-rw-r--r-- | core/pim/datebook/datebook.pro | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.cpp | 127 | ||||
-rw-r--r-- | core/pim/datebook/datebookday.h | 6 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.cpp | 226 | ||||
-rw-r--r-- | core/pim/datebook/datebookdayallday.h | 80 | ||||
-rw-r--r-- | core/pim/datebook/datebooksettings.h | 5 | ||||
-rw-r--r-- | core/pim/datebook/datebookweek.cpp | 65 | ||||
-rw-r--r-- | core/pim/datebook/datebookweekheaderimpl.cpp | 12 | ||||
-rw-r--r-- | core/pim/datebook/datebookweeklst.cpp | 10 | ||||
-rw-r--r-- | core/pim/datebook/dateentryimpl.cpp | 2 | ||||
-rw-r--r-- | core/pim/datebook/opie-datebook.control | 6 | ||||
-rw-r--r-- | core/pim/datebook/repeatentry.cpp | 50 |
13 files changed, 564 insertions, 81 deletions
diff --git a/core/pim/datebook/datebook.cpp b/core/pim/datebook/datebook.cpp index b7e89b0..10a9b59 100644 --- a/core/pim/datebook/datebook.cpp +++ b/core/pim/datebook/datebook.cpp | |||
@@ -228,7 +228,11 @@ void DateBook::receive( const QCString &msg, const QByteArray &data ) | |||
228 | stream >> uid; | 228 | stream >> uid; |
229 | Event e=db->eventByUID(uid); | 229 | Event e=db->eventByUID(uid); |
230 | editEvent(e); | 230 | editEvent(e); |
231 | } | 231 | }else if (msg == "viewDefault(QDate)"){ |
232 | QDate day; | ||
233 | stream >> day; | ||
234 | viewDefault(day); | ||
235 | } | ||
232 | } | 236 | } |
233 | 237 | ||
234 | DateBook::~DateBook() | 238 | DateBook::~DateBook() |
@@ -436,9 +440,19 @@ void DateBook::duplicateEvent( const Event &e ) | |||
436 | Event newEv = entry->event(); | 440 | Event newEv = entry->event(); |
437 | QString error = checkEvent(newEv); | 441 | QString error = checkEvent(newEv); |
438 | if (!error.isNull()) { | 442 | if (!error.isNull()) { |
439 | if (QMessageBox::warning(this, "error box", error, "Fix it", "Continue", 0, 0, 1) == 0) | 443 | if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) |
440 | continue; | 444 | continue; |
441 | } | 445 | } |
446 | /* | ||
447 | * The problem: | ||
448 | * DateBookDB does remove repeating events not by uid but by the time | ||
449 | * the recurrence was created | ||
450 | * so we need to update that time as well | ||
451 | */ | ||
452 | Event::RepeatPattern rp = newEv.repeatPattern(); | ||
453 | rp.createTime = ::time( NULL ); | ||
454 | newEv.setRepeat( TRUE, rp ); // has repeat and repeatPattern... | ||
455 | |||
442 | db->addEvent(newEv); | 456 | db->addEvent(newEv); |
443 | emit newEvent(); | 457 | emit newEvent(); |
444 | break; | 458 | break; |
@@ -476,7 +490,7 @@ void DateBook::editEvent( const Event &e ) | |||
476 | newEv.setUid(e.uid()); // FIXME: Hack not to clear uid | 490 | newEv.setUid(e.uid()); // FIXME: Hack not to clear uid |
477 | QString error = checkEvent(newEv); | 491 | QString error = checkEvent(newEv); |
478 | if (!error.isNull()) { | 492 | if (!error.isNull()) { |
479 | if (QMessageBox::warning(this, "error box", error, "Fix it", "Continue", 0, 0, 1) == 0) continue; | 493 | if (QMessageBox::warning(this, tr("error box"), error, tr("Fix it"), tr("Continue"), 0, 0, 1) == 0) continue; |
480 | } | 494 | } |
481 | db->editEvent(e, newEv); | 495 | db->editEvent(e, newEv); |
482 | emit newEvent(); | 496 | emit newEvent(); |
@@ -519,8 +533,8 @@ void DateBook::initDay() | |||
519 | if ( !dayView ) { | 533 | if ( !dayView ) { |
520 | dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); | 534 | dayView = new DateBookDay( ampm, onMonday, db, views, "day view" ); |
521 | views->addWidget( dayView, DAY ); | 535 | views->addWidget( dayView, DAY ); |
536 | dayView->setJumpToCurTime( bJumpToCurTime ); | ||
522 | dayView->setStartViewTime( startTime ); | 537 | dayView->setStartViewTime( startTime ); |
523 | dayView->setJumpToCurTime( bJumpToCurTime ); | ||
524 | dayView->setRowStyle( rowStyle ); | 538 | dayView->setRowStyle( rowStyle ); |
525 | connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); | 539 | connect( this, SIGNAL( newEvent() ), dayView, SLOT( redraw() ) ); |
526 | connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); | 540 | connect( dayView, SIGNAL( newEvent() ), this, SLOT( fileNew() ) ); |
@@ -697,6 +711,7 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
697 | } | 711 | } |
698 | } | 712 | } |
699 | } else if ( msg == "nextView()" ) { | 713 | } else if ( msg == "nextView()" ) { |
714 | needShow = true; | ||
700 | if ( !qApp-> activeWindow ( )) { | 715 | if ( !qApp-> activeWindow ( )) { |
701 | needShow = TRUE; | 716 | needShow = TRUE; |
702 | } else { | 717 | } else { |
@@ -713,16 +728,31 @@ void DateBook::appMessage(const QCString& msg, const QByteArray& data) | |||
713 | needShow = TRUE; | 728 | needShow = TRUE; |
714 | } | 729 | } |
715 | } | 730 | } |
716 | } | 731 | } else if (msg == "editEvent(int)") { |
732 | /* simple copy from receive */ | ||
733 | QDataStream stream(data,IO_ReadOnly); | ||
734 | int uid; | ||
735 | stream >> uid; | ||
736 | Event e=db->eventByUID(uid); | ||
737 | editEvent(e); | ||
738 | } else if (msg == "viewDefault(QDate)"){ | ||
739 | /* simple copy from receive */ | ||
740 | QDataStream stream(data,IO_ReadOnly); | ||
741 | QDate day; | ||
742 | stream >> day; | ||
743 | viewDefault(day); | ||
744 | needShow = true; | ||
745 | } | ||
746 | |||
717 | if ( needShow ) { | 747 | if ( needShow ) { |
718 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) | 748 | #if defined(Q_WS_QWS) || defined(_WS_QWS_) |
719 | showMaximized(); | 749 | // showMaximized(); |
720 | #else | 750 | #else |
721 | show(); | 751 | // show(); |
722 | #endif | 752 | #endif |
723 | raise(); | 753 | // raise(); |
724 | QPEApplication::setKeepRunning(); | 754 | QPEApplication::setKeepRunning(); |
725 | setActiveWindow(); | 755 | // setActiveWindow(); |
726 | } | 756 | } |
727 | } | 757 | } |
728 | 758 | ||
@@ -917,7 +947,7 @@ void DateBook::slotFind() | |||
917 | { | 947 | { |
918 | // move it to the day view... | 948 | // move it to the day view... |
919 | viewDay(); | 949 | viewDay(); |
920 | FindDialog frmFind( "Calendar", this ); | 950 | FindDialog frmFind( "Calendar", this ); // no tr needed |
921 | frmFind.setUseDate( true ); | 951 | frmFind.setUseDate( true ); |
922 | frmFind.setDate( currentDate() ); | 952 | frmFind.setDate( currentDate() ); |
923 | QObject::connect( &frmFind, | 953 | QObject::connect( &frmFind, |
diff --git a/core/pim/datebook/datebook.pro b/core/pim/datebook/datebook.pro index e8e0a98..ae30c8d 100644 --- a/core/pim/datebook/datebook.pro +++ b/core/pim/datebook/datebook.pro | |||
@@ -11,7 +11,8 @@ HEADERS = datebookday.h \ | |||
11 | datebookweekheaderimpl.h \ | 11 | datebookweekheaderimpl.h \ |
12 | repeatentry.h \ | 12 | repeatentry.h \ |
13 | noteentryimpl.h \ | 13 | noteentryimpl.h \ |
14 | onoteedit.h | 14 | onoteedit.h \ |
15 | datebookdayallday.h | ||
15 | SOURCES= main.cpp \ | 16 | SOURCES= main.cpp \ |
16 | datebookday.cpp \ | 17 | datebookday.cpp \ |
17 | datebook.cpp \ | 18 | datebook.cpp \ |
@@ -23,7 +24,8 @@ SOURCES = main.cpp \ | |||
23 | datebookweekheaderimpl.cpp \ | 24 | datebookweekheaderimpl.cpp \ |
24 | repeatentry.cpp \ | 25 | repeatentry.cpp \ |
25 | noteentryimpl.cpp \ | 26 | noteentryimpl.cpp \ |
26 | onoteedit.cpp | 27 | onoteedit.cpp \ |
28 | datebookdayallday.cpp | ||
27 | INTERFACES= dateentry.ui \ | 29 | INTERFACES= dateentry.ui \ |
28 | datebookdayheader.ui \ | 30 | datebookdayheader.ui \ |
29 | datebookweekheader.ui \ | 31 | datebookweekheader.ui \ |
diff --git a/core/pim/datebook/datebookday.cpp b/core/pim/datebook/datebookday.cpp index 0b213e9..f4008e9 100644 --- a/core/pim/datebook/datebookday.cpp +++ b/core/pim/datebook/datebookday.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | 21 | ||
22 | #include "datebookday.h" | 22 | #include "datebookday.h" |
23 | #include "datebookdayheaderimpl.h" | 23 | #include "datebookdayheaderimpl.h" |
24 | #include "datebookdayallday.h" | ||
24 | 25 | ||
25 | #include <qpe/datebookdb.h> | 26 | #include <qpe/datebookdb.h> |
26 | #include <qpe/resource.h> | 27 | #include <qpe/resource.h> |
@@ -211,7 +212,11 @@ void DateBookDayViewQuickLineEdit::slotReturnPressed() | |||
211 | emit(insertEvent(quickEvent)); | 212 | emit(insertEvent(quickEvent)); |
212 | active=0; | 213 | active=0; |
213 | } | 214 | } |
214 | this->close(true);// Close and also delete this widget | 215 | /* we need to return to this object.. */ |
216 | QTimer::singleShot(500, this, SLOT(finallyCallClose()) );// Close and also delete this widget | ||
217 | } | ||
218 | void DateBookDayViewQuickLineEdit::finallyCallClose() { | ||
219 | close(true); // also deletes this widget... | ||
215 | } | 220 | } |
216 | 221 | ||
217 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent * e ) | 222 | void DateBookDayViewQuickLineEdit::focusOutEvent ( QFocusEvent * e ) |
@@ -227,6 +232,10 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWid | |||
227 | widgetList.setAutoDelete( true ); | 232 | widgetList.setAutoDelete( true ); |
228 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); | 233 | header = new DateBookDayHeader( startOnMonday, this, "day header" ); |
229 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); | 234 | header->setDate( currDate.year(), currDate.month(), currDate.day() ); |
235 | |||
236 | m_allDays = new DatebookdayAllday(newDb, this, "all day event list" ); | ||
237 | m_allDays->hide(); | ||
238 | |||
230 | view = new DateBookDayView( ampm, this, "day view" ); | 239 | view = new DateBookDayView( ampm, this, "day view" ); |
231 | 240 | ||
232 | connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); | 241 | connect( header, SIGNAL( dateChanged( int, int, int ) ), this, SLOT( dateChanged( int, int, int ) ) ); |
@@ -245,6 +254,7 @@ DateBookDay::DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, QWid | |||
245 | timeMarker = new DateBookDayTimeMarker( this ); | 254 | timeMarker = new DateBookDayTimeMarker( this ); |
246 | timeMarker->setTime( QTime::currentTime() ); | 255 | timeMarker->setTime( QTime::currentTime() ); |
247 | rowStyle = -1; // initialize with bogus values | 256 | rowStyle = -1; // initialize with bogus values |
257 | jumpToCurTime = false; | ||
248 | } | 258 | } |
249 | 259 | ||
250 | void DateBookDay::setJumpToCurTime( bool bJump ) | 260 | void DateBookDay::setJumpToCurTime( bool bJump ) |
@@ -343,17 +353,31 @@ void DateBookDay::getEvents() | |||
343 | { | 353 | { |
344 | widgetList.clear(); | 354 | widgetList.clear(); |
345 | 355 | ||
356 | /* clear the AllDay List */ | ||
357 | m_allDays->hide(); // just in case | ||
358 | m_allDays->removeAllEvents(); | ||
359 | |||
346 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); | 360 | QValueList<EffectiveEvent> eventList = db->getEffectiveEvents( currDate, currDate ); |
347 | QValueListIterator<EffectiveEvent> it; | 361 | QValueListIterator<EffectiveEvent> it; |
362 | QObject* object = 0; | ||
348 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { | 363 | for ( it = eventList.begin(); it != eventList.end(); ++it ) { |
349 | EffectiveEvent ev=*it; | 364 | EffectiveEvent ev=*it; |
350 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day. | 365 | if(!((ev.end().hour()==0) && (ev.end().minute()==0) && (ev.startDate()!=ev.date()))) {// Skip events ending at 00:00 starting at another day. |
366 | if (ev.event().type() == Event::AllDay ) { | ||
367 | object = m_allDays->addEvent( ev ); | ||
368 | if (!object) | ||
369 | continue; | ||
370 | }else { | ||
351 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); | 371 | DateBookDayWidget* w = new DateBookDayWidget( *it, this ); |
352 | connect( w, SIGNAL( deleteMe( const Event & ) ), this, SIGNAL( removeEvent( const Event & ) ) ); | 372 | widgetList.append( w ); |
353 | connect( w, SIGNAL( duplicateMe( const Event & ) ), this, SIGNAL( duplicateEvent( const Event & ) ) ); | 373 | object = w; |
354 | connect( w, SIGNAL( editMe( const Event & ) ), this, SIGNAL( editEvent( const Event & ) ) ); | 374 | } |
355 | connect( w, SIGNAL( beamMe( const Event & ) ), this, SIGNAL( beamEvent( const Event & ) ) ); | 375 | |
356 | widgetList.append( w ); | 376 | connect( object, SIGNAL( deleteMe( const Event & ) ), this, SIGNAL( removeEvent( const Event & ) ) ); |
377 | connect( object, SIGNAL( duplicateMe( const Event & ) ), this, SIGNAL( duplicateEvent( const Event & ) ) ); | ||
378 | connect( object, SIGNAL( editMe( const Event & ) ), this, SIGNAL( editEvent( const Event & ) ) ); | ||
379 | connect( object, SIGNAL( beamMe( const Event & ) ), this, SIGNAL( beamEvent( const Event & ) ) ); | ||
380 | |||
357 | } | 381 | } |
358 | } | 382 | } |
359 | } | 383 | } |
@@ -396,9 +420,16 @@ static int place( const DateBookDayWidget *item, bool *used, int maxn ) | |||
396 | void DateBookDay::relayoutPage( bool fromResize ) | 420 | void DateBookDay::relayoutPage( bool fromResize ) |
397 | { | 421 | { |
398 | setUpdatesEnabled( FALSE ); | 422 | setUpdatesEnabled( FALSE ); |
399 | if ( !fromResize ) | 423 | if ( !fromResize ) { |
400 | getEvents(); // no need we already have them! | 424 | getEvents(); // no need we already have them! |
401 | 425 | ||
426 | if (m_allDays->items() > 0 ) | ||
427 | m_allDays->show(); | ||
428 | /* | ||
429 | * else if ( m_allDays->items() == 0 ) already hide in getEvents | ||
430 | */ | ||
431 | } | ||
432 | |||
402 | widgetList.sort(); | 433 | widgetList.sort(); |
403 | //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning | 434 | //sorts the widgetList by the heights of the widget so that the tallest widgets are at the beginning |
404 | //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view | 435 | //this is needed for the simple algo below to work correctly, otherwise some widgets would be drawn outside the view |
@@ -730,6 +761,28 @@ void DateBookDayWidget::paintEvent( QPaintEvent *e ) | |||
730 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); | 761 | rt.draw( &p, 7, 0, e->region(), colorGroup() ); |
731 | } | 762 | } |
732 | 763 | ||
764 | /* | ||
765 | * we need to find the real start date for a uid | ||
766 | * we need to check from one day to another... | ||
767 | */ | ||
768 | QDate DateBookDay::findRealStart( int uid, const QDate& isIncluded , DateBookDB* db) { | ||
769 | QDate dt( isIncluded ); | ||
770 | QDate fnd = dt; | ||
771 | |||
772 | bool doAgain = true; | ||
773 | do{ | ||
774 | dt = dt.addDays( -1 ); | ||
775 | QValueList<EffectiveEvent> events = db->getEffectiveEvents( dt, dt ); | ||
776 | for (QValueList<EffectiveEvent>::Iterator it = events.begin(); it != events.end(); ++it ) { | ||
777 | EffectiveEvent ev = (*it); | ||
778 | if ( uid == ev.event().uid() && ev.start() != QTime(0, 0, 0 ) ) | ||
779 | return ev.date(); | ||
780 | } | ||
781 | }while (doAgain ); | ||
782 | |||
783 | return fnd; | ||
784 | } | ||
785 | |||
733 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | 786 | void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) |
734 | { | 787 | { |
735 | DateBookDayWidget *item; | 788 | DateBookDayWidget *item; |
@@ -747,6 +800,7 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | |||
747 | m.insertItem( tr( "Duplicate" ), 4 ); | 800 | m.insertItem( tr( "Duplicate" ), 4 ); |
748 | m.insertItem( tr( "Delete" ), 2 ); | 801 | m.insertItem( tr( "Delete" ), 2 ); |
749 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); | 802 | if(Ir::supported()) m.insertItem( tr( "Beam" ), 3 ); |
803 | if(Ir::supported() && ev.event().doRepeat() ) m.insertItem( tr( "Beam this occurence"), 5 ); | ||
750 | int r = m.exec( e->globalPos() ); | 804 | int r = m.exec( e->globalPos() ); |
751 | if ( r == 1 ) { | 805 | if ( r == 1 ) { |
752 | emit editMe( ev.event() ); | 806 | emit editMe( ev.event() ); |
@@ -756,7 +810,64 @@ void DateBookDayWidget::mousePressEvent( QMouseEvent *e ) | |||
756 | emit beamMe( ev.event() ); | 810 | emit beamMe( ev.event() ); |
757 | } else if ( r == 4 ) { | 811 | } else if ( r == 4 ) { |
758 | emit duplicateMe( ev.event() ); | 812 | emit duplicateMe( ev.event() ); |
759 | } | 813 | } else if ( r == 5 ) { |
814 | // create an Event and beam it... | ||
815 | /* | ||
816 | * Start with the easy stuff. If start and end date is the same we can just use | ||
817 | * the values of effective events | ||
818 | * If it is a multi day event we need to find the real start and end date... | ||
819 | */ | ||
820 | if ( ev.event().start().date() == ev.event().end().date() ) { | ||
821 | Event event( ev.event() ); | ||
822 | |||
823 | QDateTime dt( ev.date(), ev.start() ); | ||
824 | event.setStart( dt ); | ||
825 | |||
826 | dt.setTime( ev.end() ); | ||
827 | event.setEnd( dt ); | ||
828 | emit beamMe( event ); | ||
829 | }else { | ||
830 | /* | ||
831 | * at least the the Times are right now | ||
832 | */ | ||
833 | QDateTime start( ev.event().start() ); | ||
834 | QDateTime end ( ev.event().end () ); | ||
835 | |||
836 | |||
837 | /* | ||
838 | * ok we know the start date or we need to find it | ||
839 | */ | ||
840 | if ( ev.start() != QTime( 0, 0, 0 ) ) { | ||
841 | start.setDate( ev.date() ); | ||
842 | }else { | ||
843 | QDate dt = DateBookDay::findRealStart( ev.event().uid(), ev.date(), dateBook->db ); | ||
844 | start.setDate( dt ); | ||
845 | } | ||
846 | |||
847 | |||
848 | /* | ||
849 | * ok we know now the end date... | ||
850 | * else | ||
851 | * get to know the offset btw the real start and real end | ||
852 | * and then add it to the new start date... | ||
853 | */ | ||
854 | if ( ev.end() != QTime(23, 59, 59 ) ) { | ||
855 | end.setDate( ev.date() ); | ||
856 | }else{ | ||
857 | int days = ev.event().start().date().daysTo( ev.event().end().date() ); | ||
858 | end.setDate( start.date().addDays( days ) ); | ||
859 | } | ||
860 | |||
861 | |||
862 | |||
863 | Event event( ev.event() ); | ||
864 | event.setStart( start ); | ||
865 | event.setEnd ( end ); | ||
866 | |||
867 | |||
868 | emit beamMe( event ); | ||
869 | } | ||
870 | } | ||
760 | } | 871 | } |
761 | 872 | ||
762 | void DateBookDayWidget::setGeometry( const QRect &r ) | 873 | void DateBookDayWidget::setGeometry( const QRect &r ) |
diff --git a/core/pim/datebook/datebookday.h b/core/pim/datebook/datebookday.h index 961f60f..3898cbc 100644 --- a/core/pim/datebook/datebookday.h +++ b/core/pim/datebook/datebookday.h | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | class DateBookDayHeader; | 33 | class DateBookDayHeader; |
34 | class DateBookDB; | 34 | class DateBookDB; |
35 | class DatebookdayAllday; | ||
35 | class QDateTime; | 36 | class QDateTime; |
36 | class QMouseEvent; | 37 | class QMouseEvent; |
37 | class QPaintEvent; | 38 | class QPaintEvent; |
@@ -48,6 +49,7 @@ protected: | |||
48 | void focusOutEvent( QFocusEvent *e ); | 49 | void focusOutEvent( QFocusEvent *e ); |
49 | protected slots: | 50 | protected slots: |
50 | void slotReturnPressed(void); | 51 | void slotReturnPressed(void); |
52 | void finallyCallClose(); | ||
51 | signals: | 53 | signals: |
52 | void insertEvent(const Event &e); | 54 | void insertEvent(const Event &e); |
53 | }; | 55 | }; |
@@ -176,6 +178,7 @@ class DateBookDay : public QVBox | |||
176 | { | 178 | { |
177 | Q_OBJECT | 179 | Q_OBJECT |
178 | 180 | ||
181 | friend class DateBookDayWidget; // for beam this occurence and access to DateBookDB | ||
179 | public: | 182 | public: |
180 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, | 183 | DateBookDay( bool ampm, bool startOnMonday, DateBookDB *newDb, |
181 | QWidget *parent, const char *name ); | 184 | QWidget *parent, const char *name ); |
@@ -188,6 +191,8 @@ public: | |||
188 | DateBookDayWidget * getSelectedWidget( void ); | 191 | DateBookDayWidget * getSelectedWidget( void ); |
189 | void setJumpToCurTime( bool bJump ); | 192 | void setJumpToCurTime( bool bJump ); |
190 | void setRowStyle( int style ); | 193 | void setRowStyle( int style ); |
194 | static QDate findRealStart( int uid, const QDate& isIncluded, | ||
195 | DateBookDB* ); | ||
191 | 196 | ||
192 | public slots: | 197 | public slots: |
193 | void setDate( int y, int m, int d ); | 198 | void setDate( int y, int m, int d ); |
@@ -218,6 +223,7 @@ private: | |||
218 | QDate currDate; | 223 | QDate currDate; |
219 | DateBookDayView *view; | 224 | DateBookDayView *view; |
220 | DateBookDayHeader *header; | 225 | DateBookDayHeader *header; |
226 | DatebookdayAllday *m_allDays; | ||
221 | DateBookDB *db; | 227 | DateBookDB *db; |
222 | WidgetListClass widgetList;//reimplemented QList for sorting widgets by height | 228 | WidgetListClass widgetList;//reimplemented QList for sorting widgets by height |
223 | int startTime; | 229 | int startTime; |
diff --git a/core/pim/datebook/datebookdayallday.cpp b/core/pim/datebook/datebookdayallday.cpp new file mode 100644 index 0000000..985f31a --- a/dev/null +++ b/core/pim/datebook/datebookdayallday.cpp | |||
@@ -0,0 +1,226 @@ | |||
1 | /**************************************************************************** | ||
2 | ** GPL by Rajko Albrecht | ||
3 | ** | ||
4 | ** | ||
5 | ** | ||
6 | ** | ||
7 | ** | ||
8 | ****************************************************************************/ | ||
9 | #include "datebookdayallday.h" | ||
10 | |||
11 | #include <qpushbutton.h> | ||
12 | #include <qlayout.h> | ||
13 | #include <qvariant.h> | ||
14 | #include <qtooltip.h> | ||
15 | #include <qwhatsthis.h> | ||
16 | #include <qobjectlist.h> | ||
17 | #include <qpe/event.h> | ||
18 | #include <qpe/ir.h> | ||
19 | #include <qpe/datebookdb.h> | ||
20 | #include <qpe/resource.h> | ||
21 | #include <qpopupmenu.h> | ||
22 | #include <qtimer.h> | ||
23 | #include <qregexp.h> | ||
24 | #include <qdatetime.h> | ||
25 | |||
26 | #include "datebookday.h" | ||
27 | |||
28 | /* | ||
29 | * Constructs a DatebookdayAllday which is a child of 'parent', with the | ||
30 | * name 'name' and widget flags set to 'f' | ||
31 | */ | ||
32 | DatebookdayAllday::DatebookdayAllday(DateBookDB* db, QWidget* parent, const char* name, WFlags fl ) | ||
33 | : QWidget( parent, name,fl ),item_count(0),dateBook(db) | ||
34 | { | ||
35 | if ( !name ) | ||
36 | setName( "DatebookdayAllday" ); | ||
37 | setMinimumSize( QSize( 0, 0 ) ); | ||
38 | |||
39 | datebookdayalldayLayout = new QVBoxLayout( this ); | ||
40 | datebookdayalldayLayout->setSpacing( 0 ); | ||
41 | datebookdayalldayLayout->setMargin( 0 ); | ||
42 | |||
43 | lblDesc = new DatebookEventDesc(parent->parentWidget(),""); | ||
44 | lblDesc->setBackgroundColor(Qt::yellow); | ||
45 | lblDesc->hide(); | ||
46 | subWidgets.setAutoDelete(true); | ||
47 | } | ||
48 | |||
49 | /* | ||
50 | * Destroys the object and frees any allocated resources | ||
51 | */ | ||
52 | DatebookdayAllday::~DatebookdayAllday() | ||
53 | { | ||
54 | // no need to delete child widgets, Qt does it all for us | ||
55 | } | ||
56 | |||
57 | DatebookAlldayDisp* DatebookdayAllday::addEvent(const EffectiveEvent&ev) | ||
58 | { | ||
59 | DatebookAlldayDisp * lb; | ||
60 | lb = new DatebookAlldayDisp(dateBook,ev,this,NULL); | ||
61 | datebookdayalldayLayout->addWidget(lb); | ||
62 | subWidgets.append(lb); | ||
63 | |||
64 | connect(lb,SIGNAL(displayMe(const Event &)),lblDesc,SLOT(disp_event(const Event&))); | ||
65 | ++item_count; | ||
66 | |||
67 | return lb; | ||
68 | } | ||
69 | |||
70 | void DatebookdayAllday::removeAllEvents() | ||
71 | { | ||
72 | subWidgets.clear(); | ||
73 | item_count = 0; | ||
74 | } | ||
75 | |||
76 | DatebookAlldayDisp::DatebookAlldayDisp(DateBookDB *db,const EffectiveEvent& ev, | ||
77 | QWidget* parent,const char* name,WFlags f) | ||
78 | : QLabel(parent,name,f),m_Ev(ev),dateBook(db) | ||
79 | { | ||
80 | QString strDesc = m_Ev.description(); | ||
81 | strDesc = strDesc.replace(QRegExp("<"),"<"); | ||
82 | setBackgroundColor(yellow); | ||
83 | setText(strDesc); | ||
84 | setFrameStyle(QFrame::Raised|QFrame::Panel); | ||
85 | QSize s = sizeHint(); | ||
86 | setMaximumSize( QSize( 32767, s.height()-4 ) ); | ||
87 | setMinimumSize( QSize( 0, s.height()-4 ) ); | ||
88 | } | ||
89 | |||
90 | DatebookAlldayDisp::~DatebookAlldayDisp() | ||
91 | { | ||
92 | } | ||
93 | |||
94 | void DatebookAlldayDisp::beam_single_event() | ||
95 | { | ||
96 | // create an Event and beam it... | ||
97 | /* | ||
98 | * Start with the easy stuff. If start and end date is the same we can just use | ||
99 | * the values of effective m_Events | ||
100 | * If it is a multi day m_Event we need to find the real start and end date... | ||
101 | */ | ||
102 | if ( m_Ev.event().start().date() == m_Ev.event().end().date() ) { | ||
103 | Event m_Event( m_Ev.event() ); | ||
104 | |||
105 | QDateTime dt( m_Ev.date(), m_Ev.start() ); | ||
106 | m_Event.setStart( dt ); | ||
107 | |||
108 | dt.setTime( m_Ev.end() ); | ||
109 | m_Event.setEnd( dt ); | ||
110 | emit beamMe( m_Event ); | ||
111 | }else { | ||
112 | /* | ||
113 | * at least the the Times are right now | ||
114 | */ | ||
115 | QDateTime start( m_Ev.event().start() ); | ||
116 | QDateTime end ( m_Ev.event().end () ); | ||
117 | |||
118 | /* | ||
119 | * ok we know the start date or we need to find it | ||
120 | */ | ||
121 | if ( m_Ev.start() != QTime( 0, 0, 0 ) ) { | ||
122 | start.setDate( m_Ev.date() ); | ||
123 | }else { | ||
124 | QDate dt = DateBookDay::findRealStart( m_Ev.event().uid(), m_Ev.date(), dateBook ); | ||
125 | start.setDate( dt ); | ||
126 | } | ||
127 | |||
128 | /* | ||
129 | * ok we know now the end date... | ||
130 | * else | ||
131 | * get to know the offset btw the real start and real end | ||
132 | * and then add it to the new start date... | ||
133 | */ | ||
134 | if ( m_Ev.end() != QTime(23, 59, 59 ) ) { | ||
135 | end.setDate( m_Ev.date() ); | ||
136 | }else{ | ||
137 | int days = m_Ev.event().start().date().daysTo( m_Ev.event().end().date() ); | ||
138 | end.setDate( start.date().addDays( days ) ); | ||
139 | } | ||
140 | Event m_Event( m_Ev.event() ); | ||
141 | m_Event.setStart( start ); | ||
142 | m_Event.setEnd ( end ); | ||
143 | emit beamMe( m_Event ); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | void DatebookAlldayDisp::mousePressEvent(QMouseEvent*e) | ||
148 | { | ||
149 | QColor b = backgroundColor(); | ||
150 | setBackgroundColor(green); | ||
151 | update(); | ||
152 | QPopupMenu m; | ||
153 | m.insertItem( DateBookDayWidget::tr( "Edit" ), 1 ); | ||
154 | m.insertItem( DateBookDayWidget::tr( "Duplicate" ), 4 ); | ||
155 | m.insertItem( DateBookDayWidget::tr( "Delete" ), 2 ); | ||
156 | if(Ir::supported()) m.insertItem( DateBookDayWidget::tr( "Beam" ), 3 ); | ||
157 | if(Ir::supported() && m_Ev.event().doRepeat() ) m.insertItem( DateBookDayWidget::tr( "Beam this occurence"), 5 ); | ||
158 | m.insertItem( tr( "Info"),6); | ||
159 | int r = m.exec( e->globalPos() ); | ||
160 | setBackgroundColor(b); | ||
161 | update(); | ||
162 | switch (r) { | ||
163 | case 1: | ||
164 | emit editMe( m_Ev.event() ); | ||
165 | break; | ||
166 | case 2: | ||
167 | emit deleteMe( m_Ev.event() ); | ||
168 | break; | ||
169 | case 3: | ||
170 | emit beamMe( m_Ev.event() ); | ||
171 | break; | ||
172 | case 4: | ||
173 | emit duplicateMe( m_Ev.event() ); | ||
174 | break; | ||
175 | case 5: | ||
176 | beam_single_event(); | ||
177 | break; | ||
178 | case 6: | ||
179 | emit displayMe( m_Ev.event() ); | ||
180 | break; | ||
181 | default: | ||
182 | break; | ||
183 | } | ||
184 | } | ||
185 | |||
186 | DatebookEventDesc::DatebookEventDesc(QWidget*parent,const char*name) | ||
187 | :QLabel(parent,name) | ||
188 | { | ||
189 | m_Timer=new QTimer(this); | ||
190 | connect(m_Timer,SIGNAL(timeout()),this,SLOT(hide())); | ||
191 | setFrameStyle(QFrame::Sunken|QFrame::Panel); | ||
192 | setTextFormat(RichText); | ||
193 | } | ||
194 | |||
195 | DatebookEventDesc::~DatebookEventDesc() | ||
196 | { | ||
197 | } | ||
198 | |||
199 | void DatebookEventDesc::mousePressEvent(QMouseEvent*) | ||
200 | { | ||
201 | hide(); | ||
202 | if (m_Timer->isActive()) m_Timer->stop(); | ||
203 | } | ||
204 | |||
205 | void DatebookEventDesc::disp_event(const Event&e) | ||
206 | { | ||
207 | if (m_Timer->isActive()) m_Timer->stop(); | ||
208 | QString text; | ||
209 | text = "<b><i>"+e.description()+"</i></b><br>"; | ||
210 | if (e.notes().length()>0) { | ||
211 | text+="<b>"+e.notes()+"</b><br>"; | ||
212 | } | ||
213 | if (e.location().length()>0) { | ||
214 | text+="<i>"+e.location()+"</i><br>"; | ||
215 | } | ||
216 | text = text.replace(QRegExp("\n"),"<br>"); | ||
217 | setText(text); | ||
218 | QSize s = sizeHint(); | ||
219 | s+=QSize(10,10); | ||
220 | resize(s); | ||
221 | move( QMAX(0,(parentWidget()->width()-width()) / 2), | ||
222 | (parentWidget()->height()-height())/2 ); | ||
223 | show(); | ||
224 | m_Timer->start(2000,true); | ||
225 | } | ||
226 | |||
diff --git a/core/pim/datebook/datebookdayallday.h b/core/pim/datebook/datebookdayallday.h new file mode 100644 index 0000000..c781785 --- a/dev/null +++ b/core/pim/datebook/datebookdayallday.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #ifndef DATEBOOKDAYALLDAYBASE_H | ||
2 | #define DATEBOOKDAYALLDAYBASE_H | ||
3 | |||
4 | #include <qvariant.h> | ||
5 | #include <qframe.h> | ||
6 | #include <qlabel.h> | ||
7 | #include <qlist.h> | ||
8 | #include <qpe/event.h> | ||
9 | |||
10 | class QVBoxLayout; | ||
11 | class QHBoxLayout; | ||
12 | class QGridLayout; | ||
13 | class DatebookAlldayDisp; | ||
14 | class DatebookEventDesc; | ||
15 | class DateBookDB; | ||
16 | |||
17 | class DatebookdayAllday : public QWidget | ||
18 | { | ||
19 | Q_OBJECT | ||
20 | |||
21 | public: | ||
22 | DatebookdayAllday(DateBookDB* db, | ||
23 | QWidget* parent = 0, const char* name = 0, WFlags fl = 0); | ||
24 | ~DatebookdayAllday(); | ||
25 | DatebookAlldayDisp* addEvent(const EffectiveEvent&e); | ||
26 | const unsigned int items()const{return item_count;} | ||
27 | |||
28 | public slots: | ||
29 | void removeAllEvents(); | ||
30 | |||
31 | protected: | ||
32 | QVBoxLayout* datebookdayalldayLayout; | ||
33 | DatebookEventDesc * lblDesc; | ||
34 | unsigned int item_count; | ||
35 | QList<DatebookAlldayDisp> subWidgets; | ||
36 | DateBookDB *dateBook; | ||
37 | }; | ||
38 | |||
39 | class DatebookAlldayDisp : public QLabel | ||
40 | { | ||
41 | Q_OBJECT | ||
42 | |||
43 | public: | ||
44 | DatebookAlldayDisp(DateBookDB* db,const EffectiveEvent& e, | ||
45 | QWidget* parent=0,const char* name = 0, WFlags fl=0); | ||
46 | virtual ~DatebookAlldayDisp(); | ||
47 | |||
48 | signals: | ||
49 | void deleteMe( const Event &e ); | ||
50 | void duplicateMe( const Event &e ); | ||
51 | void editMe( const Event &e ); | ||
52 | void beamMe( const Event &e ); | ||
53 | void displayMe(const Event &e); | ||
54 | |||
55 | public slots: | ||
56 | |||
57 | protected: | ||
58 | EffectiveEvent m_Ev; | ||
59 | DateBookDB* dateBook; | ||
60 | void mousePressEvent( QMouseEvent *e ); | ||
61 | void beam_single_event(); | ||
62 | }; | ||
63 | |||
64 | class DatebookEventDesc: public QLabel | ||
65 | { | ||
66 | Q_OBJECT | ||
67 | |||
68 | public: | ||
69 | DatebookEventDesc(QWidget* Parent=0,const char* name = 0); | ||
70 | virtual ~DatebookEventDesc(); | ||
71 | |||
72 | public slots: | ||
73 | void disp_event(const Event&e); | ||
74 | |||
75 | protected: | ||
76 | void mousePressEvent(QMouseEvent*e); | ||
77 | QTimer* m_Timer; | ||
78 | }; | ||
79 | |||
80 | #endif // DATEBOOKDAYALLDAYBASE_H | ||
diff --git a/core/pim/datebook/datebooksettings.h b/core/pim/datebook/datebooksettings.h index c3036e1..cf8a0ff 100644 --- a/core/pim/datebook/datebooksettings.h +++ b/core/pim/datebook/datebooksettings.h | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | class DateBookSettings : public DateBookSettingsBase | 26 | class DateBookSettings : public DateBookSettingsBase |
27 | { | 27 | { |
28 | Q_OBJECT | ||
28 | public: | 29 | public: |
29 | DateBookSettings( bool whichClock, QWidget *parent = 0, | 30 | DateBookSettings( bool whichClock, QWidget *parent = 0, |
30 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); | 31 | const char *name = 0, bool modal = TRUE, WFlags = 0 ); |
@@ -36,12 +37,12 @@ public: | |||
36 | int presetTime() const; | 37 | int presetTime() const; |
37 | void setAlarmType( int alarmType ); | 38 | void setAlarmType( int alarmType ); |
38 | int alarmType() const; | 39 | int alarmType() const; |
39 | 40 | ||
40 | void setJumpToCurTime( bool bJump ); | 41 | void setJumpToCurTime( bool bJump ); |
41 | bool jumpToCurTime() const; | 42 | bool jumpToCurTime() const; |
42 | void setRowStyle( int style ); | 43 | void setRowStyle( int style ); |
43 | int rowStyle() const; | 44 | int rowStyle() const; |
44 | 45 | ||
45 | private slots: | 46 | private slots: |
46 | void slot12Hour( int ); | 47 | void slot12Hour( int ); |
47 | void slotChangeClock( bool ); | 48 | void slotChangeClock( bool ); |
diff --git a/core/pim/datebook/datebookweek.cpp b/core/pim/datebook/datebookweek.cpp index 2ad7aa9..ab7e963 100644 --- a/core/pim/datebook/datebookweek.cpp +++ b/core/pim/datebook/datebookweek.cpp | |||
@@ -20,21 +20,14 @@ | |||
20 | #include "datebookweek.h" | 20 | #include "datebookweek.h" |
21 | #include "datebookweekheaderimpl.h" | 21 | #include "datebookweekheaderimpl.h" |
22 | 22 | ||
23 | #include <qpe/calendar.h> | ||
24 | #include <qpe/datebookdb.h> | 23 | #include <qpe/datebookdb.h> |
25 | #include <qpe/event.h> | ||
26 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
27 | #include <qpe/timestring.h> | 25 | #include <qpe/calendar.h> |
28 | 26 | ||
29 | #include <qdatetime.h> | ||
30 | #include <qheader.h> | 27 | #include <qheader.h> |
31 | #include <qlabel.h> | 28 | #include <qlabel.h> |
32 | #include <qlayout.h> | 29 | #include <qlayout.h> |
33 | #include <qpainter.h> | ||
34 | #include <qpopupmenu.h> | ||
35 | #include <qtimer.h> | 30 | #include <qtimer.h> |
36 | #include <qspinbox.h> | ||
37 | #include <qstyle.h> | ||
38 | 31 | ||
39 | //----------------------------------------------------------------- | 32 | //----------------------------------------------------------------- |
40 | 33 | ||
@@ -89,44 +82,37 @@ DateBookWeekView::DateBookWeekView( bool ap, bool startOnMonday, | |||
89 | 82 | ||
90 | void DateBookWeekView::initNames() | 83 | void DateBookWeekView::initNames() |
91 | { | 84 | { |
85 | #warning Please review this ! (eilers) | ||
86 | |||
87 | // Ok, I am Mr. Pedantic, but shouldn't we count until 6 instead of 7, if bOnMonday is false ? (eilers) | ||
88 | |||
92 | static bool bFirst = true; | 89 | static bool bFirst = true; |
93 | if ( bFirst ) { | 90 | if ( bFirst ) { |
94 | if ( bOnMonday ) { | 91 | if ( bOnMonday ) { |
95 | header->addLabel( tr("Mo", "Monday" ) ); | 92 | for ( int i = 1; i<=7; i++ ) { |
96 | header->addLabel( tr("Tu", "Tuesday") ); | 93 | header->addLabel( Calendar::nameOfDay( i ) ); |
97 | header->addLabel( tr("We", "Wednesday" ) ); | 94 | } |
98 | header->addLabel( tr("Th", "Thursday" ) ); | 95 | |
99 | header->addLabel( tr("Fr", "Friday" ) ); | ||
100 | header->addLabel( tr("Sa", "Saturday" ) ); | ||
101 | header->addLabel( tr("Su", "Sunday" ) ); | ||
102 | } else { | 96 | } else { |
103 | header->addLabel( tr("Su", "Sunday" ) ); | 97 | header->addLabel( Calendar::nameOfDay( 7 ) ); |
104 | header->addLabel( tr("Mo", "Monday") ); | 98 | for ( int i = 1; i<7; i++ ) { |
105 | header->addLabel( tr("Tu", "Tuesday") ); | 99 | header->addLabel( Calendar::nameOfDay( i ) ); |
106 | header->addLabel( tr("We", "Wednesday" ) ); | 100 | } |
107 | header->addLabel( tr("Th", "Thursday" ) ); | 101 | } |
108 | header->addLabel( tr("Fr", "Friday" ) ); | ||
109 | header->addLabel( tr("Sa", "Saturday" ) ); | ||
110 | } | ||
111 | bFirst = false; | 102 | bFirst = false; |
112 | } else { | 103 | } else { |
113 | // we are change things... | 104 | // we are change things... |
114 | if ( bOnMonday ) { | 105 | if ( bOnMonday ) { |
115 | header->setLabel( 1, tr("Mo", "Monday") ); | 106 | for ( int i = 1; i<=7; i++ ) { |
116 | header->setLabel( 2, tr("Tu", "Tuesday") ); | 107 | header->setLabel( i, Calendar::nameOfDay( i ) ); |
117 | header->setLabel( 3, tr("We", "Wednesday" ) ); | 108 | } |
118 | header->setLabel( 4, tr("Th", "Thursday" ) ); | 109 | |
119 | header->setLabel( 5, tr("Fr", "Friday" ) ); | ||
120 | header->setLabel( 6, tr("Sa", "Saturday" ) ); | ||
121 | header->setLabel( 7, tr("Su", "Sunday" ) ); | ||
122 | } else { | 110 | } else { |
123 | header->setLabel( 1, tr("Su", "Sunday" ) ); | 111 | header->setLabel( 1, Calendar::nameOfDay( 7 ) ); |
124 | header->setLabel( 2, tr("Mo", "Monday") ); | 112 | for ( int i = 1; i<7; i++ ) { |
125 | header->setLabel( 3, tr("Tu", "Tuesday") ); | 113 | header->setLabel( i+1, Calendar::nameOfDay( i ) ); |
126 | header->setLabel( 4, tr("We", "Wednesday" ) ); | 114 | } |
127 | header->setLabel( 5, tr("Th", "Thursday" ) ); | 115 | |
128 | header->setLabel( 6, tr("Fr", "Friday" ) ); | ||
129 | header->setLabel( 7, tr("Sa", "Saturday" ) ); | ||
130 | } | 116 | } |
131 | } | 117 | } |
132 | } | 118 | } |
@@ -402,7 +388,8 @@ void DateBookWeek::showDay( int day ) | |||
402 | QDate d=bdate; | 388 | QDate d=bdate; |
403 | 389 | ||
404 | // Calculate offset to first day of week. | 390 | // Calculate offset to first day of week. |
405 | int dayoffset=d.dayOfWeek(); | 391 | int dayoffset=d.dayOfWeek() % 7; |
392 | |||
406 | if(bStartOnMonday) dayoffset--; | 393 | if(bStartOnMonday) dayoffset--; |
407 | 394 | ||
408 | day--; | 395 | day--; |
@@ -575,6 +562,8 @@ QDate DateBookWeek::weekDate() const | |||
575 | // Calculate offset to first day of week. | 562 | // Calculate offset to first day of week. |
576 | int dayoffset=d.dayOfWeek(); | 563 | int dayoffset=d.dayOfWeek(); |
577 | if(bStartOnMonday) dayoffset--; | 564 | if(bStartOnMonday) dayoffset--; |
565 | else if( dayoffset == 7 ) | ||
566 | dayoffset = 0; | ||
578 | 567 | ||
579 | return d.addDays(-dayoffset); | 568 | return d.addDays(-dayoffset); |
580 | } | 569 | } |
diff --git a/core/pim/datebook/datebookweekheaderimpl.cpp b/core/pim/datebook/datebookweekheaderimpl.cpp index ff7626f..770410e 100644 --- a/core/pim/datebook/datebookweekheaderimpl.cpp +++ b/core/pim/datebook/datebookweekheaderimpl.cpp | |||
@@ -70,18 +70,22 @@ void DateBookWeekHeader::pickDate() | |||
70 | 70 | ||
71 | void DateBookWeekHeader::nextMonth() | 71 | void DateBookWeekHeader::nextMonth() |
72 | { | 72 | { |
73 | qWarning("nextMonth() " ); | ||
73 | setDate(date.addDays(28)); | 74 | setDate(date.addDays(28)); |
74 | } | 75 | } |
75 | void DateBookWeekHeader::prevMonth() | 76 | void DateBookWeekHeader::prevMonth() |
76 | { | 77 | { |
78 | qWarning("prevMonth() " ); | ||
77 | setDate(date.addDays(-28)); | 79 | setDate(date.addDays(-28)); |
78 | } | 80 | } |
79 | void DateBookWeekHeader::nextWeek() | 81 | void DateBookWeekHeader::nextWeek() |
80 | { | 82 | { |
83 | qWarning("nextWeek() " ); | ||
81 | setDate(date.addDays(7)); | 84 | setDate(date.addDays(7)); |
82 | } | 85 | } |
83 | void DateBookWeekHeader::prevWeek() | 86 | void DateBookWeekHeader::prevWeek() |
84 | { | 87 | { |
88 | qWarning("prevWeek() "); | ||
85 | setDate(date.addDays(-7)); | 89 | setDate(date.addDays(-7)); |
86 | } | 90 | } |
87 | 91 | ||
@@ -94,9 +98,13 @@ void DateBookWeekHeader::setDate(const QDate &d) { | |||
94 | int year,week,dayofweek; | 98 | int year,week,dayofweek; |
95 | date=d; | 99 | date=d; |
96 | dayofweek=d.dayOfWeek(); | 100 | dayofweek=d.dayOfWeek(); |
97 | if(bStartOnMonday) dayofweek--; | 101 | if(bStartOnMonday) |
102 | dayofweek--; | ||
103 | else if( dayofweek == 7 ) | ||
104 | /* we already have the right day -7 would lead to the current week..*/ | ||
105 | dayofweek = 0; | ||
106 | |||
98 | date=date.addDays(-dayofweek); | 107 | date=date.addDays(-dayofweek); |
99 | |||
100 | calcWeek(date,week,year,bStartOnMonday); | 108 | calcWeek(date,week,year,bStartOnMonday); |
101 | QDate start=date; | 109 | QDate start=date; |
102 | QDate stop=start.addDays(6); | 110 | QDate stop=start.addDays(6); |
diff --git a/core/pim/datebook/datebookweeklst.cpp b/core/pim/datebook/datebookweeklst.cpp index 7817042..aad1f3a 100644 --- a/core/pim/datebook/datebookweeklst.cpp +++ b/core/pim/datebook/datebookweeklst.cpp | |||
@@ -61,7 +61,12 @@ void DateBookWeekLstHeader::setDate(const QDate &d) { | |||
61 | int year,week,dayofweek; | 61 | int year,week,dayofweek; |
62 | date=d; | 62 | date=d; |
63 | dayofweek=d.dayOfWeek(); | 63 | dayofweek=d.dayOfWeek(); |
64 | if(bStartOnMonday) dayofweek--; | 64 | if(bStartOnMonday) |
65 | dayofweek--; | ||
66 | else if( dayofweek == 7 ) | ||
67 | /* we already have the right day -7 would lead to the same week */ | ||
68 | dayofweek = 0; | ||
69 | |||
65 | date=date.addDays(-dayofweek); | 70 | date=date.addDays(-dayofweek); |
66 | 71 | ||
67 | calcWeek(date,week,year,bStartOnMonday); | 72 | calcWeek(date,week,year,bStartOnMonday); |
@@ -117,7 +122,7 @@ DateBookWeekLstDayHdr::DateBookWeekLstDayHdr(const QDate &d, bool /* onM */, | |||
117 | 122 | ||
118 | date=d; | 123 | date=d; |
119 | 124 | ||
120 | static const char *wdays={"MTWTFSSM"}; | 125 | static const QString wdays=tr("MTWTFSSM", "Week days"); |
121 | char day=wdays[d.dayOfWeek()-1]; | 126 | char day=wdays[d.dayOfWeek()-1]; |
122 | 127 | ||
123 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); | 128 | label->setText( QString(QObject::tr(QString(QChar(day)))) + " " +QString::number(d.day()) ); |
@@ -237,6 +242,7 @@ DateBookWeekLstView::DateBookWeekLstView(QValueList<EffectiveEvent> &ev, | |||
237 | // Calculate offset to first day of week. | 242 | // Calculate offset to first day of week. |
238 | int dayoffset=d.dayOfWeek(); | 243 | int dayoffset=d.dayOfWeek(); |
239 | if(bStartOnMonday) dayoffset--; | 244 | if(bStartOnMonday) dayoffset--; |
245 | else if( dayoffset == 7 ) dayoffset = 0; | ||
240 | 246 | ||
241 | for (int i=0; i<7; i++) { | 247 | for (int i=0; i<7; i++) { |
242 | // Header | 248 | // Header |
diff --git a/core/pim/datebook/dateentryimpl.cpp b/core/pim/datebook/dateentryimpl.cpp index 13d2ce2..d9e5225 100644 --- a/core/pim/datebook/dateentryimpl.cpp +++ b/core/pim/datebook/dateentryimpl.cpp | |||
@@ -402,6 +402,8 @@ void DateEntry::slotRepeat() | |||
402 | rp = e->repeatPattern(); | 402 | rp = e->repeatPattern(); |
403 | setRepeatLabel(); | 403 | setRepeatLabel(); |
404 | } | 404 | } |
405 | // deleting sounds like a nice idea... | ||
406 | delete e; | ||
405 | } | 407 | } |
406 | 408 | ||
407 | void DateEntry::slotChangeStartOfWeek( bool onMonday ) | 409 | void DateEntry::slotChangeStartOfWeek( bool onMonday ) |
diff --git a/core/pim/datebook/opie-datebook.control b/core/pim/datebook/opie-datebook.control index 1a28448..fe5a086 100644 --- a/core/pim/datebook/opie-datebook.control +++ b/core/pim/datebook/opie-datebook.control | |||
@@ -1,11 +1,11 @@ | |||
1 | Package: opie-datebook | 1 | Package: opie-datebook |
2 | Files: bin/datebook apps/1Pim/datebook.desktop pics/datebook | 2 | Files: bin/datebook apps/1Pim/datebook.desktop |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Conflicts: qpe-tkccalendar | 5 | Conflicts: qpe-tkccalendar |
6 | Maintainer: Warwick Allison <warwick@trolltech.com> | 6 | Maintainer: Warwick Allison <warwick@trolltech.com> |
7 | Architecture: arm | 7 | Architecture: arm |
8 | Version: $QPE_VERSION-$SUB_VERSION | 8 | Depends: task-opie-minimal, libopie1, opie-pics |
9 | Depends: task-opie-minimal, libopie1 | ||
10 | Description: A datebook/appointment manager | 9 | Description: A datebook/appointment manager |
11 | A datebook/appointment manager for the Opie environment. | 10 | A datebook/appointment manager for the Opie environment. |
11 | Version: $QPE_VERSION$EXTRAVERSION | ||
diff --git a/core/pim/datebook/repeatentry.cpp b/core/pim/datebook/repeatentry.cpp index 5637c4d..b1a162d 100644 --- a/core/pim/datebook/repeatentry.cpp +++ b/core/pim/datebook/repeatentry.cpp | |||
@@ -33,19 +33,36 @@ | |||
33 | #include <time.h> | 33 | #include <time.h> |
34 | 34 | ||
35 | // Global Templates for use in setting up the repeat label... | 35 | // Global Templates for use in setting up the repeat label... |
36 | const QString strDayTemplate = QObject::tr("Every"); | 36 | // the problem is these strings get initialized before QPEApplication can install the translator -zecke |
37 | const QString strYearTemplate = QObject::tr("%1 %2 every "); | 37 | namespace { |
38 | const QString strMonthDateTemplate = QObject::tr("The %1 every "); | 38 | QString strDayTemplate; |
39 | const QString strMonthDayTemplate = QObject::tr("The %1 %1 of every"); | 39 | QString strYearTemplate; |
40 | const QString strWeekTemplate = QObject::tr("Every "); | 40 | QString strMonthDateTemplate; |
41 | const QString dayLabel[] = { QObject::tr("Monday"), | 41 | QString strMonthDayTemplate; |
42 | QObject::tr("Tuesday"), | 42 | QString strWeekTemplate; |
43 | QObject::tr("Wednesday"), | 43 | QString dayLabel[7]; |
44 | QObject::tr("Thursday"), | 44 | } |
45 | QObject::tr("Friday"), | ||
46 | QObject::tr("Saturday"), | ||
47 | QObject::tr("Sunday") }; | ||
48 | 45 | ||
46 | /* | ||
47 | * static linkage to not polute the symbol table... | ||
48 | * The problem is that const and static linkage are resolved prior to installing a translator | ||
49 | * leading to that the above strings are translted but to the original we delay the init of these strings... | ||
50 | * -zecke | ||
51 | */ | ||
52 | static void fillStrings() { | ||
53 | strDayTemplate = QObject::tr("Every"); | ||
54 | strYearTemplate = QObject::tr("%1 %2 every "); | ||
55 | strMonthDateTemplate = QObject::tr("The %1 every "); | ||
56 | strMonthDayTemplate = QObject::tr("The %1 %1 of every"); | ||
57 | strWeekTemplate = QObject::tr("Every "); | ||
58 | dayLabel[0] = QObject::tr("Monday"); | ||
59 | dayLabel[1] = QObject::tr("Tuesday"); | ||
60 | dayLabel[2] = QObject::tr("Wednesday"); | ||
61 | dayLabel[3] = QObject::tr("Thursday"); | ||
62 | dayLabel[4] = QObject::tr("Friday"); | ||
63 | dayLabel[5] = QObject::tr("Saturday"); | ||
64 | dayLabel[6] = QObject::tr("Sunday"); | ||
65 | } | ||
49 | 66 | ||
50 | static QString numberPlacing( int x );// return the proper word format for | 67 | static QString numberPlacing( int x );// return the proper word format for |
51 | // x (1st, 2nd, etc) | 68 | // x (1st, 2nd, etc) |
@@ -59,6 +76,9 @@ RepeatEntry::RepeatEntry( bool startOnMonday, | |||
59 | currInterval( NONE ), | 76 | currInterval( NONE ), |
60 | startWeekOnMonday( startOnMonday ) | 77 | startWeekOnMonday( startOnMonday ) |
61 | { | 78 | { |
79 | if (strDayTemplate.isEmpty() ) | ||
80 | fillStrings(); | ||
81 | |||
62 | init(); | 82 | init(); |
63 | fraType->setButton( currInterval ); | 83 | fraType->setButton( currInterval ); |
64 | chkNoEnd->setChecked( TRUE ); | 84 | chkNoEnd->setChecked( TRUE ); |
@@ -74,6 +94,8 @@ RepeatEntry::RepeatEntry( bool startOnMonday, const Event::RepeatPattern &rp, | |||
74 | end( rp.endDate() ), | 94 | end( rp.endDate() ), |
75 | startWeekOnMonday( startOnMonday ) | 95 | startWeekOnMonday( startOnMonday ) |
76 | { | 96 | { |
97 | if (strDayTemplate.isEmpty() ) | ||
98 | fillStrings(); | ||
77 | // do some stuff with the repeat pattern | 99 | // do some stuff with the repeat pattern |
78 | init(); | 100 | init(); |
79 | switch ( rp.type ) { | 101 | switch ( rp.type ) { |
@@ -406,7 +428,7 @@ void RepeatEntry::setupRepeatLabel( int x ) | |||
406 | if ( x > 1 ) | 428 | if ( x > 1 ) |
407 | strVar2 = tr( "days" ); | 429 | strVar2 = tr( "days" ); |
408 | else | 430 | else |
409 | strVar2 = tr( "day" ); | 431 | strVar2 = tr( "day" ); |
410 | break; | 432 | break; |
411 | case WEEK: | 433 | case WEEK: |
412 | if ( x > 1 ) | 434 | if ( x > 1 ) |
@@ -500,7 +522,7 @@ void RepeatEntry::slotWeekLabel() | |||
500 | str += ", " + *itStr; | 522 | str += ", " + *itStr; |
501 | } | 523 | } |
502 | } | 524 | } |
503 | str = str.prepend( "on " ); | 525 | str = str.prepend( tr("on ") ); |
504 | lblWeekVar->setText( str ); | 526 | lblWeekVar->setText( str ); |
505 | } | 527 | } |
506 | 528 | ||