author | zautrix <zautrix> | 2005-07-27 22:26:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-27 22:26:08 (UTC) |
commit | 0e38cffd7ba745f237c659e1c48080fcb25b126c (patch) (unidiff) | |
tree | 6069600e18bae5300c6ce427735457dbfed93141 | |
parent | 136f9082862e7a56abb3a201e96f5e7386c4f1b9 (diff) | |
download | kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.zip kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.gz kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.bz2 |
rec changes
-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagenda.cpp | 4 | ||||
-rw-r--r-- | korganizer/koagendaitem.cpp | 2 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 2 | ||||
-rw-r--r-- | korganizer/koeditorrecurrence.cpp | 172 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 6 | ||||
-rw-r--r-- | korganizer/kolistview.cpp | 4 | ||||
-rw-r--r-- | korganizer/komonthview.cpp | 6 | ||||
-rw-r--r-- | korganizer/kotodoeditor.cpp | 3 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 4 | ||||
-rw-r--r-- | libkcal/event.cpp | 1 | ||||
-rw-r--r-- | libkcal/icalformatimpl.cpp | 24 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 63 | ||||
-rw-r--r-- | libkcal/incidence.h | 5 | ||||
-rw-r--r-- | libkcal/kincidenceformatter.cpp | 4 | ||||
-rw-r--r-- | libkcal/vcalformat.cpp | 4 | ||||
-rw-r--r-- | libkcal/vcalformat.h | 2 |
18 files changed, 175 insertions, 135 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a76f2ed..a9d42f0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp | |||
@@ -3698,129 +3698,129 @@ void CalendarView::deleteTodo(Todo *todo) | |||
3698 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); | 3698 | text += i18n("\nhas sub-todos.\nAll completed sub-todos\nwill be deleted as well!"); |
3699 | 3699 | ||
3700 | } | 3700 | } |
3701 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { | 3701 | switch (msgItemDelete(i18n("Todo:") +"\n"+text)) { |
3702 | case KMessageBox::Continue: // OK | 3702 | case KMessageBox::Continue: // OK |
3703 | bool deleteT = false; | 3703 | bool deleteT = false; |
3704 | if (!todo->relations().isEmpty()) { | 3704 | if (!todo->relations().isEmpty()) { |
3705 | deleteT = removeCompletedSubTodos( todo ); | 3705 | deleteT = removeCompletedSubTodos( todo ); |
3706 | } | 3706 | } |
3707 | // deleteT == true: todo already deleted in removeCompletedSubTodos | 3707 | // deleteT == true: todo already deleted in removeCompletedSubTodos |
3708 | if ( !deleteT ) { | 3708 | if ( !deleteT ) { |
3709 | checkExternalId( todo ); | 3709 | checkExternalId( todo ); |
3710 | calendar()->deleteTodo(todo); | 3710 | calendar()->deleteTodo(todo); |
3711 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3711 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3712 | updateView(); | 3712 | updateView(); |
3713 | } | 3713 | } |
3714 | break; | 3714 | break; |
3715 | } // switch | 3715 | } // switch |
3716 | } else { | 3716 | } else { |
3717 | checkExternalId( todo ); | 3717 | checkExternalId( todo ); |
3718 | mCalendar->deleteTodo(todo); | 3718 | mCalendar->deleteTodo(todo); |
3719 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); | 3719 | changeTodoDisplay( todo,KOGlobals::EVENTDELETED ); |
3720 | updateView(); | 3720 | updateView(); |
3721 | } | 3721 | } |
3722 | 3722 | ||
3723 | emit updateSearchDialog(); | 3723 | emit updateSearchDialog(); |
3724 | } | 3724 | } |
3725 | void CalendarView::deleteJournal(Journal *jour) | 3725 | void CalendarView::deleteJournal(Journal *jour) |
3726 | { | 3726 | { |
3727 | if (!jour) { | 3727 | if (!jour) { |
3728 | KNotifyClient::beep(); | 3728 | KNotifyClient::beep(); |
3729 | return; | 3729 | return; |
3730 | } | 3730 | } |
3731 | if (KOPrefs::instance()->mConfirm) { | 3731 | if (KOPrefs::instance()->mConfirm) { |
3732 | 3732 | ||
3733 | QString des; | 3733 | QString des; |
3734 | if ( !jour->summary().isEmpty() ) { | 3734 | if ( !jour->summary().isEmpty() ) { |
3735 | des = jour->summary(); | 3735 | des = jour->summary(); |
3736 | } else { | 3736 | } else { |
3737 | des = jour->description().left(30); | 3737 | des = jour->description().left(30); |
3738 | des = des.simplifyWhiteSpace (); | 3738 | des = des.simplifyWhiteSpace (); |
3739 | des.replace (QRegExp ("\\n"),"" ); | 3739 | des.replace (QRegExp ("\\n"),"" ); |
3740 | des.replace (QRegExp ("\\r"),"" ); | 3740 | des.replace (QRegExp ("\\r"),"" ); |
3741 | } | 3741 | } |
3742 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { | 3742 | switch (msgItemDelete( i18n("Journal:") +"\n"+KGlobal::formatMessage ( des,0 ))) { |
3743 | case KMessageBox::Continue: // OK | 3743 | case KMessageBox::Continue: // OK |
3744 | calendar()->deleteJournal(jour); | 3744 | calendar()->deleteJournal(jour); |
3745 | updateView(); | 3745 | updateView(); |
3746 | break; | 3746 | break; |
3747 | } // switch | 3747 | } // switch |
3748 | } else { | 3748 | } else { |
3749 | calendar()->deleteJournal(jour);; | 3749 | calendar()->deleteJournal(jour);; |
3750 | updateView(); | 3750 | updateView(); |
3751 | } | 3751 | } |
3752 | emit updateSearchDialog(); | 3752 | emit updateSearchDialog(); |
3753 | } | 3753 | } |
3754 | 3754 | ||
3755 | void CalendarView::deleteEvent(Event *anEvent) | 3755 | void CalendarView::deleteEvent(Event *anEvent) |
3756 | { | 3756 | { |
3757 | if (!anEvent) { | 3757 | if (!anEvent) { |
3758 | KNotifyClient::beep(); | 3758 | KNotifyClient::beep(); |
3759 | return; | 3759 | return; |
3760 | } | 3760 | } |
3761 | 3761 | ||
3762 | if (anEvent->recurrence()->doesRecur()) { | 3762 | if (anEvent->doesRecur()) { |
3763 | QDate itemDate = mViewManager->currentSelectionDate(); | 3763 | QDate itemDate = mViewManager->currentSelectionDate(); |
3764 | int km; | 3764 | int km; |
3765 | if (!itemDate.isValid()) { | 3765 | if (!itemDate.isValid()) { |
3766 | //kdDebug() << "Date Not Valid" << endl; | 3766 | //kdDebug() << "Date Not Valid" << endl; |
3767 | if (KOPrefs::instance()->mConfirm) { | 3767 | if (KOPrefs::instance()->mConfirm) { |
3768 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3768 | km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3769 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), | 3769 | i18n("\nThis event recurs\nover multiple dates.\nAre you sure you want\nto delete this event\nand all its recurrences?"), |
3770 | i18n("KO/Pi Confirmation"),i18n("Delete All")); | 3770 | i18n("KO/Pi Confirmation"),i18n("Delete All")); |
3771 | if ( km == KMessageBox::Continue ) | 3771 | if ( km == KMessageBox::Continue ) |
3772 | km = KMessageBox::No; // No = all below | 3772 | km = KMessageBox::No; // No = all below |
3773 | } else | 3773 | } else |
3774 | km = KMessageBox::No; | 3774 | km = KMessageBox::No; |
3775 | } else { | 3775 | } else { |
3776 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3776 | km = KMessageBox::warningYesNoCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3777 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ | 3777 | i18n("\nThis event recurs\nover multiple dates.\nDo you want to delete\nall it's recurrences,\nor only the current one on:\n")+ |
3778 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), | 3778 | KGlobal::locale()->formatDate(itemDate)+i18n(" ?\n\nDelete:\n"), |
3779 | i18n("KO/Pi Confirmation"),i18n("Current"), | 3779 | i18n("KO/Pi Confirmation"),i18n("Current"), |
3780 | i18n("All")); | 3780 | i18n("All")); |
3781 | } | 3781 | } |
3782 | switch(km) { | 3782 | switch(km) { |
3783 | 3783 | ||
3784 | case KMessageBox::No: // Continue // all | 3784 | case KMessageBox::No: // Continue // all |
3785 | //qDebug("KMessageBox::No "); | 3785 | //qDebug("KMessageBox::No "); |
3786 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3786 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3787 | schedule(Scheduler::Cancel,anEvent); | 3787 | schedule(Scheduler::Cancel,anEvent); |
3788 | 3788 | ||
3789 | checkExternalId( anEvent); | 3789 | checkExternalId( anEvent); |
3790 | mCalendar->deleteEvent(anEvent); | 3790 | mCalendar->deleteEvent(anEvent); |
3791 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); | 3791 | changeEventDisplay(anEvent,KOGlobals::EVENTDELETED); |
3792 | break; | 3792 | break; |
3793 | 3793 | ||
3794 | // Disabled because it does not work | 3794 | // Disabled because it does not work |
3795 | //#if 0 | 3795 | //#if 0 |
3796 | case KMessageBox::Yes: // just this one | 3796 | case KMessageBox::Yes: // just this one |
3797 | //QDate qd = mNavigator->selectedDates().first(); | 3797 | //QDate qd = mNavigator->selectedDates().first(); |
3798 | //if (!qd.isValid()) { | 3798 | //if (!qd.isValid()) { |
3799 | // kdDebug() << "no date selected, or invalid date" << endl; | 3799 | // kdDebug() << "no date selected, or invalid date" << endl; |
3800 | // KNotifyClient::beep(); | 3800 | // KNotifyClient::beep(); |
3801 | // return; | 3801 | // return; |
3802 | //} | 3802 | //} |
3803 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); | 3803 | //while (!anEvent->recursOn(qd)) qd = qd.addDays(1); |
3804 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { | 3804 | if (itemDate!=QDate(1,1,1) || itemDate.isValid()) { |
3805 | anEvent->addExDate(itemDate); | 3805 | anEvent->addExDate(itemDate); |
3806 | int duration = anEvent->recurrence()->duration(); | 3806 | int duration = anEvent->recurrence()->duration(); |
3807 | if ( duration > 0 ) { | 3807 | if ( duration > 0 ) { |
3808 | anEvent->recurrence()->setDuration( duration - 1 ); | 3808 | anEvent->recurrence()->setDuration( duration - 1 ); |
3809 | } | 3809 | } |
3810 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); | 3810 | changeEventDisplay(anEvent, KOGlobals::EVENTEDITED); |
3811 | } | 3811 | } |
3812 | break; | 3812 | break; |
3813 | //#endif | 3813 | //#endif |
3814 | } // switch | 3814 | } // switch |
3815 | } else { | 3815 | } else { |
3816 | if (KOPrefs::instance()->mConfirm) { | 3816 | if (KOPrefs::instance()->mConfirm) { |
3817 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + | 3817 | switch (KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + |
3818 | i18n("\nAre you sure you want\nto delete this event?"), | 3818 | i18n("\nAre you sure you want\nto delete this event?"), |
3819 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { | 3819 | i18n("KO/Pi Confirmation"),i18n("Delete"))) { |
3820 | case KMessageBox::Continue: // OK | 3820 | case KMessageBox::Continue: // OK |
3821 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) | 3821 | if (anEvent->organizer()==KOPrefs::instance()->email() && anEvent->attendeeCount()>0) |
3822 | schedule(Scheduler::Cancel,anEvent); | 3822 | schedule(Scheduler::Cancel,anEvent); |
3823 | checkExternalId( anEvent); | 3823 | checkExternalId( anEvent); |
3824 | mCalendar->deleteEvent(anEvent); | 3824 | mCalendar->deleteEvent(anEvent); |
3825 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); | 3825 | changeEventDisplay(anEvent, KOGlobals::EVENTDELETED); |
3826 | break; | 3826 | break; |
diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 0dd5ef5..c738f7e 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp | |||
@@ -518,129 +518,129 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) | |||
518 | minV = blockmoveDist; | 518 | minV = blockmoveDist; |
519 | else | 519 | else |
520 | minV = (blockmoveDist/2); | 520 | minV = (blockmoveDist/2); |
521 | } | 521 | } |
522 | bool border = false; | 522 | bool border = false; |
523 | int diff = tempItem->y() - viewportPos.y(); | 523 | int diff = tempItem->y() - viewportPos.y(); |
524 | if ( diff < 0 ) | 524 | if ( diff < 0 ) |
525 | diff *= -1; | 525 | diff *= -1; |
526 | if ( diff < minV ) { | 526 | if ( diff < minV ) { |
527 | border = true; | 527 | border = true; |
528 | objIsNotViewport = false; | 528 | objIsNotViewport = false; |
529 | } | 529 | } |
530 | if ( ! border ) { | 530 | if ( ! border ) { |
531 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); | 531 | diff = tempItem->y() + tempItem->height()- viewportPos.y(); |
532 | if ( diff < 0 ) | 532 | if ( diff < 0 ) |
533 | diff *= -1; | 533 | diff *= -1; |
534 | if ( diff < minV ) { | 534 | if ( diff < minV ) { |
535 | border = true; | 535 | border = true; |
536 | objIsNotViewport = false; | 536 | objIsNotViewport = false; |
537 | } | 537 | } |
538 | } | 538 | } |
539 | } | 539 | } |
540 | } else { // not allday | 540 | } else { // not allday |
541 | if ( tempItem->width() > 10 ) { | 541 | if ( tempItem->width() > 10 ) { |
542 | int minH = tempItem->width()/4; | 542 | int minH = tempItem->width()/4; |
543 | if ( minH > (blockmoveDist/2)-2 ) { | 543 | if ( minH > (blockmoveDist/2)-2 ) { |
544 | if ( minH > blockmoveDist ) | 544 | if ( minH > blockmoveDist ) |
545 | minH = blockmoveDist; | 545 | minH = blockmoveDist; |
546 | else | 546 | else |
547 | minH = (blockmoveDist/2); | 547 | minH = (blockmoveDist/2); |
548 | } | 548 | } |
549 | bool border = false; | 549 | bool border = false; |
550 | int diff = tempItem->x() - viewportPos.x(); | 550 | int diff = tempItem->x() - viewportPos.x(); |
551 | if ( diff < 0 ) | 551 | if ( diff < 0 ) |
552 | diff *= -1; | 552 | diff *= -1; |
553 | if ( diff < minH ) { | 553 | if ( diff < minH ) { |
554 | border = true; | 554 | border = true; |
555 | objIsNotViewport = false; | 555 | objIsNotViewport = false; |
556 | } | 556 | } |
557 | if ( ! border ) { | 557 | if ( ! border ) { |
558 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); | 558 | diff = tempItem->x() + tempItem->width() - viewportPos.x(); |
559 | if ( diff < 0 ) | 559 | if ( diff < 0 ) |
560 | diff *= -1; | 560 | diff *= -1; |
561 | if ( diff < minH ) { | 561 | if ( diff < minH ) { |
562 | border = true; | 562 | border = true; |
563 | objIsNotViewport = false; | 563 | objIsNotViewport = false; |
564 | } | 564 | } |
565 | } | 565 | } |
566 | } | 566 | } |
567 | } | 567 | } |
568 | } | 568 | } |
569 | if ( objIsNotViewport ) { | 569 | if ( objIsNotViewport ) { |
570 | mPopupItem = (KOAgendaItem *)object; | 570 | mPopupItem = (KOAgendaItem *)object; |
571 | mPopupKind = 1; | 571 | mPopupKind = 1; |
572 | if (me->button() == RightButton) { | 572 | if (me->button() == RightButton) { |
573 | mPopupKind = 3; | 573 | mPopupKind = 3; |
574 | popupMenu(); | 574 | popupMenu(); |
575 | } else if (me->button() == LeftButton) { | 575 | } else if (me->button() == LeftButton) { |
576 | mActionItem = (KOAgendaItem *)object; | 576 | mActionItem = (KOAgendaItem *)object; |
577 | if (mActionItem) { | 577 | if (mActionItem) { |
578 | emit signalClearSelection(); | 578 | emit signalClearSelection(); |
579 | slotClearSelection(); | 579 | slotClearSelection(); |
580 | selectItem(mActionItem); | 580 | selectItem(mActionItem); |
581 | Incidence *incidence = mActionItem->incidence(); | 581 | Incidence *incidence = mActionItem->incidence(); |
582 | if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { | 582 | if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) { |
583 | mActionItem = 0; | 583 | mActionItem = 0; |
584 | } else { | 584 | } else { |
585 | startItemAction(viewportPos); | 585 | startItemAction(viewportPos); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | } | 588 | } |
589 | } else { // ---------- viewport() | 589 | } else { // ---------- viewport() |
590 | mPopupItem = 0; | 590 | mPopupItem = 0; |
591 | mPopupKind = 2; | 591 | mPopupKind = 2; |
592 | selectItem(0); | 592 | selectItem(0); |
593 | mActionItem = 0; | 593 | mActionItem = 0; |
594 | if (me->button() == RightButton) { | 594 | if (me->button() == RightButton) { |
595 | int x,y; | 595 | int x,y; |
596 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); | 596 | viewportToContents(viewportPos.x(),viewportPos.y(),x,y); |
597 | int gx,gy; | 597 | int gx,gy; |
598 | contentsToGrid(x,y,gx,gy); | 598 | contentsToGrid(x,y,gx,gy); |
599 | mCurrentCellX = gx; | 599 | mCurrentCellX = gx; |
600 | mCurrentCellY = gy; | 600 | mCurrentCellY = gy; |
601 | mStartCellX = gx; | 601 | mStartCellX = gx; |
602 | mStartCellY = gy; | 602 | mStartCellY = gy; |
603 | mPopupKind = 4; | 603 | mPopupKind = 4; |
604 | popupMenu(); | 604 | popupMenu(); |
605 | } else if (me->button() == LeftButton) { | 605 | } else if (me->button() == LeftButton) { |
606 | setCursor(arrowCursor); | 606 | setCursor(arrowCursor); |
607 | startSelectAction(viewportPos); | 607 | startSelectAction(viewportPos); |
608 | } | 608 | } |
609 | } | 609 | } |
610 | break; | 610 | break; |
611 | 611 | ||
612 | case QEvent::MouseButtonRelease: | 612 | case QEvent::MouseButtonRelease: |
613 | if (me->button() == LeftButton ) { | 613 | if (me->button() == LeftButton ) { |
614 | mPopupTimer->stop(); | 614 | mPopupTimer->stop(); |
615 | } | 615 | } |
616 | if (object != viewport()) { | 616 | if (object != viewport()) { |
617 | if (me->button() == LeftButton && mLeftMouseDown) { | 617 | if (me->button() == LeftButton && mLeftMouseDown) { |
618 | if (mActionItem) { | 618 | if (mActionItem) { |
619 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); | 619 | QPoint clipperPos = clipper()->mapFromGlobal(viewport()->mapToGlobal(viewportPos)); |
620 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); | 620 | //qDebug(" %d %d %d ",clipperPos.y(),visibleHeight() , 9 ); |
621 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { | 621 | if ( mActionType == MOVE && (clipperPos.y() > visibleHeight()-2 ||clipperPos.y() < 0 ) ) { |
622 | mScrollUpTimer.stop(); | 622 | mScrollUpTimer.stop(); |
623 | mScrollDownTimer.stop(); | 623 | mScrollDownTimer.stop(); |
624 | mActionItem->resetMove(); | 624 | mActionItem->resetMove(); |
625 | placeSubCells( mActionItem ); | 625 | placeSubCells( mActionItem ); |
626 | // emit startDragSignal( mActionItem->incidence() ); | 626 | // emit startDragSignal( mActionItem->incidence() ); |
627 | setCursor( arrowCursor ); | 627 | setCursor( arrowCursor ); |
628 | mActionItem = 0; | 628 | mActionItem = 0; |
629 | mActionType = NOP; | 629 | mActionType = NOP; |
630 | mItemMoved = 0; | 630 | mItemMoved = 0; |
631 | mLeftMouseDown = false; | 631 | mLeftMouseDown = false; |
632 | return true; | 632 | return true; |
633 | } | 633 | } |
634 | endItemAction(); | 634 | endItemAction(); |
635 | } | 635 | } |
636 | } | 636 | } |
637 | 637 | ||
638 | } else { // ---------- viewport() | 638 | } else { // ---------- viewport() |
639 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click | 639 | if (me->button() == LeftButton && mLeftMouseDown ) { //left click |
640 | endSelectAction( true ); // emit new event signal | 640 | endSelectAction( true ); // emit new event signal |
641 | } | 641 | } |
642 | } | 642 | } |
643 | if (me->button() == LeftButton) | 643 | if (me->button() == LeftButton) |
644 | mLeftMouseDown = false; | 644 | mLeftMouseDown = false; |
645 | 645 | ||
646 | break; | 646 | break; |
@@ -938,129 +938,129 @@ void KOAgenda::performItemAction(QPoint viewportPos) | |||
938 | mActionItem->raise(); | 938 | mActionItem->raise(); |
939 | if (mActionType == MOVE) { | 939 | if (mActionType == MOVE) { |
940 | // Move all items belonging to a multi item | 940 | // Move all items belonging to a multi item |
941 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); | 941 | KOAgendaItem *moveItem = mActionItem->firstMultiItem(); |
942 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); | 942 | bool isMultiItem = (moveItem || mActionItem->lastMultiItem()); |
943 | if (!moveItem) moveItem = mActionItem; | 943 | if (!moveItem) moveItem = mActionItem; |
944 | while (moveItem) { | 944 | while (moveItem) { |
945 | int dy; | 945 | int dy; |
946 | if (isMultiItem) dy = 0; | 946 | if (isMultiItem) dy = 0; |
947 | else dy = gy - mCurrentCellY; | 947 | else dy = gy - mCurrentCellY; |
948 | moveItem->moveRelative(gx - mCurrentCellX,dy); | 948 | moveItem->moveRelative(gx - mCurrentCellX,dy); |
949 | int x,y; | 949 | int x,y; |
950 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); | 950 | gridToContents(moveItem->cellX(),moveItem->cellYTop(),x,y); |
951 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), | 951 | moveItem->resize(mGridSpacingX * moveItem->cellWidth(), |
952 | mGridSpacingY * moveItem->cellHeight()); | 952 | mGridSpacingY * moveItem->cellHeight()); |
953 | moveItem->raise(); | 953 | moveItem->raise(); |
954 | moveChild(moveItem,x,y); | 954 | moveChild(moveItem,x,y); |
955 | moveItem = moveItem->nextMultiItem(); | 955 | moveItem = moveItem->nextMultiItem(); |
956 | } | 956 | } |
957 | } else if (mActionType == RESIZETOP) { | 957 | } else if (mActionType == RESIZETOP) { |
958 | if (mCurrentCellY <= mActionItem->cellYBottom()) { | 958 | if (mCurrentCellY <= mActionItem->cellYBottom()) { |
959 | mActionItem->expandTop(gy - mCurrentCellY); | 959 | mActionItem->expandTop(gy - mCurrentCellY); |
960 | mActionItem->resize(mActionItem->width(), | 960 | mActionItem->resize(mActionItem->width(), |
961 | mGridSpacingY * mActionItem->cellHeight()); | 961 | mGridSpacingY * mActionItem->cellHeight()); |
962 | int x,y; | 962 | int x,y; |
963 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); | 963 | gridToContents(mCurrentCellX,mActionItem->cellYTop(),x,y); |
964 | //moveChild(mActionItem,childX(mActionItem),y); | 964 | //moveChild(mActionItem,childX(mActionItem),y); |
965 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); | 965 | QScrollView::moveChild( mActionItem,childX(mActionItem),y ); |
966 | } | 966 | } |
967 | } else if (mActionType == RESIZEBOTTOM) { | 967 | } else if (mActionType == RESIZEBOTTOM) { |
968 | if (mCurrentCellY >= mActionItem->cellYTop()) { | 968 | if (mCurrentCellY >= mActionItem->cellYTop()) { |
969 | mActionItem->expandBottom(gy - mCurrentCellY); | 969 | mActionItem->expandBottom(gy - mCurrentCellY); |
970 | mActionItem->resize(mActionItem->width(), | 970 | mActionItem->resize(mActionItem->width(), |
971 | mGridSpacingY * mActionItem->cellHeight()); | 971 | mGridSpacingY * mActionItem->cellHeight()); |
972 | } | 972 | } |
973 | } else if (mActionType == RESIZELEFT) { | 973 | } else if (mActionType == RESIZELEFT) { |
974 | if (mCurrentCellX <= mActionItem->cellXWidth()) { | 974 | if (mCurrentCellX <= mActionItem->cellXWidth()) { |
975 | mActionItem->expandLeft(gx - mCurrentCellX); | 975 | mActionItem->expandLeft(gx - mCurrentCellX); |
976 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 976 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
977 | mActionItem->height()); | 977 | mActionItem->height()); |
978 | int x,y; | 978 | int x,y; |
979 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); | 979 | gridToContents(mActionItem->cellX(),mActionItem->cellYTop(),x,y); |
980 | moveChild(mActionItem,x,childY(mActionItem)); | 980 | moveChild(mActionItem,x,childY(mActionItem)); |
981 | } | 981 | } |
982 | } else if (mActionType == RESIZERIGHT) { | 982 | } else if (mActionType == RESIZERIGHT) { |
983 | if (mCurrentCellX >= mActionItem->cellX()) { | 983 | if (mCurrentCellX >= mActionItem->cellX()) { |
984 | mActionItem->expandRight(gx - mCurrentCellX); | 984 | mActionItem->expandRight(gx - mCurrentCellX); |
985 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), | 985 | mActionItem->resize(mGridSpacingX * mActionItem->cellWidth(), |
986 | mActionItem->height()); | 986 | mActionItem->height()); |
987 | } | 987 | } |
988 | } | 988 | } |
989 | mCurrentCellX = gx; | 989 | mCurrentCellX = gx; |
990 | mCurrentCellY = gy; | 990 | mCurrentCellY = gy; |
991 | } | 991 | } |
992 | } | 992 | } |
993 | 993 | ||
994 | void KOAgenda::endItemAction() | 994 | void KOAgenda::endItemAction() |
995 | { | 995 | { |
996 | 996 | ||
997 | if ( mItemMoved ) { | 997 | if ( mItemMoved ) { |
998 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); | 998 | KOAgendaItem *placeItem = mActionItem->firstMultiItem(); |
999 | if ( !placeItem ) { | 999 | if ( !placeItem ) { |
1000 | placeItem = mActionItem; | 1000 | placeItem = mActionItem; |
1001 | } | 1001 | } |
1002 | if ( placeItem->incidence()->recurrence()->doesRecur() ) { | 1002 | if ( placeItem->incidence()->doesRecur() ) { |
1003 | Incidence* oldInc = placeItem->incidence(); | 1003 | Incidence* oldInc = placeItem->incidence(); |
1004 | placeItem->recreateIncidence(); | 1004 | placeItem->recreateIncidence(); |
1005 | emit addToCalSignal(placeItem->incidence(), oldInc ); | 1005 | emit addToCalSignal(placeItem->incidence(), oldInc ); |
1006 | } | 1006 | } |
1007 | int type = mActionType; | 1007 | int type = mActionType; |
1008 | if ( mAllDayMode ) | 1008 | if ( mAllDayMode ) |
1009 | type = -1; | 1009 | type = -1; |
1010 | KOAgendaItem *modifiedItem = placeItem; | 1010 | KOAgendaItem *modifiedItem = placeItem; |
1011 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); | 1011 | //emit itemModified( placeItem, mActionType /*KOGlobals::EVENTEDITED */); |
1012 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); | 1012 | QPtrList<KOAgendaItem> oldconflictItems ;//= placeItem->conflictItems(); |
1013 | KOAgendaItem *item; | 1013 | KOAgendaItem *item; |
1014 | 1014 | ||
1015 | if ( placeItem->incidence()->typeID() == todoID ) { | 1015 | if ( placeItem->incidence()->typeID() == todoID ) { |
1016 | mSelectedItem = 0; | 1016 | mSelectedItem = 0; |
1017 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); | 1017 | //qDebug("todo %d %d %d ", mCurrentCellX, modifiedItem->cellX() ,modifiedItem->cellXWidth()); |
1018 | modifiedItem->mLastMoveXPos = mCurrentCellX; | 1018 | modifiedItem->mLastMoveXPos = mCurrentCellX; |
1019 | emit itemModified( modifiedItem, mActionType ); | 1019 | emit itemModified( modifiedItem, mActionType ); |
1020 | } | 1020 | } |
1021 | else { | 1021 | else { |
1022 | 1022 | ||
1023 | 1023 | ||
1024 | globalFlagBlockAgendaItemPaint = 1; | 1024 | globalFlagBlockAgendaItemPaint = 1; |
1025 | for ( item=oldconflictItems.first(); item != 0; | 1025 | for ( item=oldconflictItems.first(); item != 0; |
1026 | item=oldconflictItems.next() ) { | 1026 | item=oldconflictItems.next() ) { |
1027 | placeSubCells(item); | 1027 | placeSubCells(item); |
1028 | } | 1028 | } |
1029 | while ( placeItem ) { | 1029 | while ( placeItem ) { |
1030 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1030 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1031 | oldconflictItems = placeItem->conflictItems(); | 1031 | oldconflictItems = placeItem->conflictItems(); |
1032 | for ( item=oldconflictItems.first(); item != 0; | 1032 | for ( item=oldconflictItems.first(); item != 0; |
1033 | item=oldconflictItems.next() ) { | 1033 | item=oldconflictItems.next() ) { |
1034 | placeSubCells(item); | 1034 | placeSubCells(item); |
1035 | } | 1035 | } |
1036 | placeSubCells( placeItem ); | 1036 | placeSubCells( placeItem ); |
1037 | placeItem = placeItem->nextMultiItem(); | 1037 | placeItem = placeItem->nextMultiItem(); |
1038 | } | 1038 | } |
1039 | globalFlagBlockAgendaItemPaint = 0; | 1039 | globalFlagBlockAgendaItemPaint = 0; |
1040 | for ( item=oldconflictItems.first(); item != 0; | 1040 | for ( item=oldconflictItems.first(); item != 0; |
1041 | item=oldconflictItems.next() ) { | 1041 | item=oldconflictItems.next() ) { |
1042 | globalFlagBlockAgendaItemUpdate = 0; | 1042 | globalFlagBlockAgendaItemUpdate = 0; |
1043 | item->repaintMe(); | 1043 | item->repaintMe(); |
1044 | globalFlagBlockAgendaItemUpdate = 1; | 1044 | globalFlagBlockAgendaItemUpdate = 1; |
1045 | item->repaint( false ); | 1045 | item->repaint( false ); |
1046 | } | 1046 | } |
1047 | placeItem = modifiedItem; | 1047 | placeItem = modifiedItem; |
1048 | 1048 | ||
1049 | while ( placeItem ) { | 1049 | while ( placeItem ) { |
1050 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); | 1050 | //qDebug("placeItem %s ", placeItem->incidence()->summary().latin1()); |
1051 | globalFlagBlockAgendaItemUpdate = 0; | 1051 | globalFlagBlockAgendaItemUpdate = 0; |
1052 | placeItem->repaintMe(); | 1052 | placeItem->repaintMe(); |
1053 | globalFlagBlockAgendaItemUpdate = 1; | 1053 | globalFlagBlockAgendaItemUpdate = 1; |
1054 | placeItem->repaint(false); | 1054 | placeItem->repaint(false); |
1055 | placeItem = placeItem->nextMultiItem(); | 1055 | placeItem = placeItem->nextMultiItem(); |
1056 | } | 1056 | } |
1057 | emit itemModified( modifiedItem, mActionType ); | 1057 | emit itemModified( modifiedItem, mActionType ); |
1058 | 1058 | ||
1059 | 1059 | ||
1060 | placeItem = modifiedItem; | 1060 | placeItem = modifiedItem; |
1061 | while ( placeItem ) { | 1061 | while ( placeItem ) { |
1062 | oldconflictItems = placeItem->conflictItems(); | 1062 | oldconflictItems = placeItem->conflictItems(); |
1063 | for ( item=oldconflictItems.first(); item != 0; | 1063 | for ( item=oldconflictItems.first(); item != 0; |
1064 | item=oldconflictItems.next() ) { | 1064 | item=oldconflictItems.next() ) { |
1065 | placeSubCells(item); | 1065 | placeSubCells(item); |
1066 | } | 1066 | } |
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 303a92a..49ad9b8 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp | |||
@@ -173,129 +173,129 @@ KOAgendaItem::~KOAgendaItem() | |||
173 | } | 173 | } |
174 | 174 | ||
175 | void KOAgendaItem::recreateIncidence() | 175 | void KOAgendaItem::recreateIncidence() |
176 | { | 176 | { |
177 | #if 0 | 177 | #if 0 |
178 | Incidence* newInc = mIncidence->clone(); | 178 | Incidence* newInc = mIncidence->clone(); |
179 | newInc->recreate(); | 179 | newInc->recreate(); |
180 | if ( mIncidence->doesRecur() ) { | 180 | if ( mIncidence->doesRecur() ) { |
181 | mIncidence->addExDate( mDate ); | 181 | mIncidence->addExDate( mDate ); |
182 | newInc->recurrence()->unsetRecurs(); | 182 | newInc->recurrence()->unsetRecurs(); |
183 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); | 183 | int len = mIncidence->dtStart().secsTo( ((Event*)mIncidence)->dtEnd()); |
184 | QTime tim = mIncidence->dtStart().time(); | 184 | QTime tim = mIncidence->dtStart().time(); |
185 | newInc->setDtStart( QDateTime(mDate, tim) ); | 185 | newInc->setDtStart( QDateTime(mDate, tim) ); |
186 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 186 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
187 | } | 187 | } |
188 | #endif | 188 | #endif |
189 | mIncidence = mIncidence->recreateCloneException( mDate ); | 189 | mIncidence = mIncidence->recreateCloneException( mDate ); |
190 | } | 190 | } |
191 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) | 191 | bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) |
192 | { | 192 | { |
193 | int size = AGENDA_ICON_SIZE; | 193 | int size = AGENDA_ICON_SIZE; |
194 | 194 | ||
195 | int yOff = 0; | 195 | int yOff = 0; |
196 | int xOff = 0; | 196 | int xOff = 0; |
197 | int x = pos().x(); | 197 | int x = pos().x(); |
198 | 198 | ||
199 | if ( x < 0 ) x = 0; | 199 | if ( x < 0 ) x = 0; |
200 | x += 3; | 200 | x += 3; |
201 | int y; | 201 | int y; |
202 | if ( mAllDay ) | 202 | if ( mAllDay ) |
203 | y = pos().y()+3; | 203 | y = pos().y()+3; |
204 | else | 204 | else |
205 | y = mCellYTop * ( height() / cellHeight() ) +3; | 205 | y = mCellYTop * ( height() / cellHeight() ) +3; |
206 | 206 | ||
207 | 207 | ||
208 | if ( mIncidence->calID() > 1 ) { | 208 | if ( mIncidence->calID() > 1 ) { |
209 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); | 209 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, KOPrefs::instance()->defaultColor( mIncidence->calID() ) ); |
210 | p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 ); | 210 | p->drawRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x-1, yOff*( 1 +AGENDA_ICON_SIZE)+y-1, AGENDA_ICON_SIZE+2, AGENDA_ICON_SIZE+2 ); |
211 | if ( horLayout ){ | 211 | if ( horLayout ){ |
212 | ++xOff; | 212 | ++xOff; |
213 | ++x; | 213 | ++x; |
214 | } | 214 | } |
215 | else { | 215 | else { |
216 | ++yOff; | 216 | ++yOff; |
217 | ++y; | 217 | ++y; |
218 | } | 218 | } |
219 | } | 219 | } |
220 | if (mIncidence->cancelled() && height() < 20 ) { | 220 | if (mIncidence->cancelled() && height() < 20 ) { |
221 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; | 221 | int xpos = xOff*( 1 +AGENDA_ICON_SIZE )+x; |
222 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; | 222 | int ypos = yOff*( 1 +AGENDA_ICON_SIZE)+y; |
223 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); | 223 | p->drawLine( xpos, ypos, xpos+AGENDA_ICON_SIZE-1, ypos+AGENDA_ICON_SIZE-1 ); |
224 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); | 224 | p->drawLine( xpos, ypos+AGENDA_ICON_SIZE-1, xpos+AGENDA_ICON_SIZE-1, ypos ); |
225 | if ( horLayout ) | 225 | if ( horLayout ) |
226 | ++xOff; | 226 | ++xOff; |
227 | else | 227 | else |
228 | ++yOff; | 228 | ++yOff; |
229 | } | 229 | } |
230 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { | 230 | if (mIncidence->isAlarmEnabled() && mIncidence->alarmEnabled()) { |
231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); | 231 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); |
232 | if ( horLayout ) | 232 | if ( horLayout ) |
233 | ++xOff; | 233 | ++xOff; |
234 | else | 234 | else |
235 | ++yOff; | 235 | ++yOff; |
236 | } | 236 | } |
237 | if (mIncidence->recurrence()->doesRecur()) { | 237 | if (mIncidence->doesRecur()) { |
238 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); | 238 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); |
239 | if ( horLayout ) | 239 | if ( horLayout ) |
240 | ++xOff; | 240 | ++xOff; |
241 | else | 241 | else |
242 | ++yOff; | 242 | ++yOff; |
243 | } | 243 | } |
244 | if (mIncidence->description().length() > 0) { | 244 | if (mIncidence->description().length() > 0) { |
245 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); | 245 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkGreen ); |
246 | if ( horLayout ) | 246 | if ( horLayout ) |
247 | ++xOff; | 247 | ++xOff; |
248 | else | 248 | else |
249 | ++yOff; | 249 | ++yOff; |
250 | } | 250 | } |
251 | if (mIncidence->isReadOnly()) { | 251 | if (mIncidence->isReadOnly()) { |
252 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); | 252 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, white ); |
253 | if ( horLayout ) | 253 | if ( horLayout ) |
254 | ++xOff; | 254 | ++xOff; |
255 | else | 255 | else |
256 | ++yOff; | 256 | ++yOff; |
257 | } | 257 | } |
258 | 258 | ||
259 | if (mIncidence->attendeeCount()>0) { | 259 | if (mIncidence->attendeeCount()>0) { |
260 | 260 | ||
261 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { | 261 | if (mIncidence->organizer() == KOPrefs::instance()->email()) { |
262 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); | 262 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, black ); |
263 | if ( horLayout ) | 263 | if ( horLayout ) |
264 | ++xOff; | 264 | ++xOff; |
265 | else | 265 | else |
266 | ++yOff; | 266 | ++yOff; |
267 | } else { | 267 | } else { |
268 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 268 | Attendee *me = mIncidence->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
269 | if (me!=0) { | 269 | if (me!=0) { |
270 | 270 | ||
271 | 271 | ||
272 | } else { | 272 | } else { |
273 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); | 273 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, yellow ); |
274 | if ( horLayout ) | 274 | if ( horLayout ) |
275 | ++xOff; | 275 | ++xOff; |
276 | else | 276 | else |
277 | ++yOff; | 277 | ++yOff; |
278 | 278 | ||
279 | } | 279 | } |
280 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); | 280 | p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, darkYellow ); |
281 | if ( horLayout ) | 281 | if ( horLayout ) |
282 | ++xOff; | 282 | ++xOff; |
283 | else | 283 | else |
284 | ++yOff; | 284 | ++yOff; |
285 | 285 | ||
286 | } | 286 | } |
287 | 287 | ||
288 | } | 288 | } |
289 | return ( yOff || xOff ); | 289 | return ( yOff || xOff ); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | void KOAgendaItem::select(bool selected) | 293 | void KOAgendaItem::select(bool selected) |
294 | { | 294 | { |
295 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); | 295 | //qDebug("select %d %d",firstMultiItem(), nextMultiItem() ); |
296 | if (mSelected == selected) return; | 296 | if (mSelected == selected) return; |
297 | mSelected = selected; | 297 | mSelected = selected; |
298 | if ( ! isVisible() ) | 298 | if ( ! isVisible() ) |
299 | return; | 299 | return; |
300 | if ( firstMultiItem() ) | 300 | if ( firstMultiItem() ) |
301 | firstMultiItem()->select( selected ); | 301 | firstMultiItem()->select( selected ); |
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index a01323a..04f30bb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -1140,129 +1140,129 @@ void KOAgendaView::fillAgenda() | |||
1140 | if ( globalFlagBlockAgenda == 1 ) | 1140 | if ( globalFlagBlockAgenda == 1 ) |
1141 | return; | 1141 | return; |
1142 | static bool onlyOne = false; | 1142 | static bool onlyOne = false; |
1143 | if ( onlyOne ) | 1143 | if ( onlyOne ) |
1144 | return; | 1144 | return; |
1145 | onlyOne = true; | 1145 | onlyOne = true; |
1146 | //if ( globalFlagBlockAgenda == 2 ) | 1146 | //if ( globalFlagBlockAgenda == 2 ) |
1147 | //globalFlagBlockAgenda = 0; | 1147 | //globalFlagBlockAgenda = 0; |
1148 | // globalFlagBlockPainting = false; | 1148 | // globalFlagBlockPainting = false; |
1149 | if ( globalFlagBlockAgenda == 0 ) | 1149 | if ( globalFlagBlockAgenda == 0 ) |
1150 | globalFlagBlockAgenda = 1; | 1150 | globalFlagBlockAgenda = 1; |
1151 | // clearView(); | 1151 | // clearView(); |
1152 | //qDebug("fillAgenda()++++ "); | 1152 | //qDebug("fillAgenda()++++ "); |
1153 | globalFlagBlockAgendaItemPaint = 1; | 1153 | globalFlagBlockAgendaItemPaint = 1; |
1154 | 1154 | ||
1155 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1155 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1156 | mAgenda->changeColumns(mSelectedDates.count()); | 1156 | mAgenda->changeColumns(mSelectedDates.count()); |
1157 | qApp->processEvents(); | 1157 | qApp->processEvents(); |
1158 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1158 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1159 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1159 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1160 | setHolidayMasks(); | 1160 | setHolidayMasks(); |
1161 | 1161 | ||
1162 | mMinY.resize(mSelectedDates.count()); | 1162 | mMinY.resize(mSelectedDates.count()); |
1163 | mMaxY.resize(mSelectedDates.count()); | 1163 | mMaxY.resize(mSelectedDates.count()); |
1164 | 1164 | ||
1165 | QPtrList<Event> dayEvents; | 1165 | QPtrList<Event> dayEvents; |
1166 | 1166 | ||
1167 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1167 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1168 | // Therefore, gtodoset all of them. | 1168 | // Therefore, gtodoset all of them. |
1169 | QPtrList<Todo> todos = calendar()->todos(); | 1169 | QPtrList<Todo> todos = calendar()->todos(); |
1170 | 1170 | ||
1171 | mAgenda->setDateList(mSelectedDates); | 1171 | mAgenda->setDateList(mSelectedDates); |
1172 | 1172 | ||
1173 | QDate today = QDate::currentDate(); | 1173 | QDate today = QDate::currentDate(); |
1174 | 1174 | ||
1175 | DateList::ConstIterator dit; | 1175 | DateList::ConstIterator dit; |
1176 | int curCol = 0; | 1176 | int curCol = 0; |
1177 | int maxCol = mSelectedDates.count()-1; | 1177 | int maxCol = mSelectedDates.count()-1; |
1178 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1178 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1179 | QDate currentDate = *dit; | 1179 | QDate currentDate = *dit; |
1180 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1180 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1181 | // << endl; | 1181 | // << endl; |
1182 | 1182 | ||
1183 | dayEvents = calendar()->events(currentDate,false); | 1183 | dayEvents = calendar()->events(currentDate,false); |
1184 | 1184 | ||
1185 | // Default values, which can never be reached | 1185 | // Default values, which can never be reached |
1186 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1186 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1187 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1187 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1188 | 1188 | ||
1189 | unsigned int numEvent; | 1189 | unsigned int numEvent; |
1190 | //qDebug("+++++NUMEVENT %d", dayEvents.count()); | 1190 | //qDebug("+++++NUMEVENT %d", dayEvents.count()); |
1191 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1191 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1192 | Event *event = dayEvents.at(numEvent); | 1192 | Event *event = dayEvents.at(numEvent); |
1193 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1193 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1194 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1194 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1195 | continue; | 1195 | continue; |
1196 | // kdDebug() << " Event: " << event->summary() << endl; | 1196 | // kdDebug() << " Event: " << event->summary() << endl; |
1197 | 1197 | ||
1198 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1198 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1199 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1199 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1200 | 1200 | ||
1201 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1201 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1202 | 1202 | ||
1203 | if (event->doesFloat()) { | 1203 | if (event->doesFloat()) { |
1204 | if (event->recurrence()->doesRecur()) { | 1204 | if (event->doesRecur()) { |
1205 | if (event->isMultiDay() ) { | 1205 | if (event->isMultiDay() ) { |
1206 | endX = endX - beginX;// endX is now number of days | 1206 | endX = endX - beginX;// endX is now number of days |
1207 | if ( event->recursOn( currentDate ) ) { | 1207 | if ( event->recursOn( currentDate ) ) { |
1208 | endX += curCol; | 1208 | endX += curCol; |
1209 | beginX = curCol; | 1209 | beginX = curCol; |
1210 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1210 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1211 | } else { | 1211 | } else { |
1212 | //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1()); | 1212 | //qDebug("days endX %d curCol %d max Col %d %s",endX ,curCol, maxCol, currentDate.toString().latin1()); |
1213 | if ( curCol == maxCol && maxCol+1 < endX ) { | 1213 | if ( curCol == maxCol && maxCol+1 < endX ) { |
1214 | int i; | 1214 | int i; |
1215 | for ( i = 1; i< endX; ++i ) { | 1215 | for ( i = 1; i< endX; ++i ) { |
1216 | if ( event->recursOn( currentDate.addDays( -i ) ) ) | 1216 | if ( event->recursOn( currentDate.addDays( -i ) ) ) |
1217 | break; | 1217 | break; |
1218 | } | 1218 | } |
1219 | if ( i > maxCol ) { | 1219 | if ( i > maxCol ) { |
1220 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1220 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1221 | //qDebug("BINGO "); | 1221 | //qDebug("BINGO "); |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | } else { | 1224 | } else { |
1225 | QDate dateit = currentDate.addDays( -endX ); | 1225 | QDate dateit = currentDate.addDays( -endX ); |
1226 | if ( event->recursOn( dateit ) ) { | 1226 | if ( event->recursOn( dateit ) ) { |
1227 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); | 1227 | //qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); |
1228 | if ( curCol-endX < 0 ) { | 1228 | if ( curCol-endX < 0 ) { |
1229 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1229 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1230 | } | 1230 | } |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | } | 1233 | } |
1234 | } else { | 1234 | } else { |
1235 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1235 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1236 | } | 1236 | } |
1237 | 1237 | ||
1238 | } else { | 1238 | } else { |
1239 | if (beginX <= 0 && curCol == 0) { | 1239 | if (beginX <= 0 && curCol == 0) { |
1240 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1240 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1241 | } else if (beginX == curCol) { | 1241 | } else if (beginX == curCol) { |
1242 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1242 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1243 | } | 1243 | } |
1244 | } | 1244 | } |
1245 | } else if (event->isMultiDay()) { | 1245 | } else if (event->isMultiDay()) { |
1246 | if ( event->doesRecur () ) { | 1246 | if ( event->doesRecur () ) { |
1247 | QDate dateit = currentDate; | 1247 | QDate dateit = currentDate; |
1248 | int count = 0; | 1248 | int count = 0; |
1249 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1249 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1250 | while (! event->recursOn( dateit ) && count <= max ) { | 1250 | while (! event->recursOn( dateit ) && count <= max ) { |
1251 | ++count; | 1251 | ++count; |
1252 | dateit = dateit.addDays( -1 ); | 1252 | dateit = dateit.addDays( -1 ); |
1253 | } | 1253 | } |
1254 | bool ok; | 1254 | bool ok; |
1255 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1255 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1256 | if ( ok ) | 1256 | if ( ok ) |
1257 | { | 1257 | { |
1258 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1258 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1259 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1259 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1260 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1260 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1261 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1261 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1262 | 1262 | ||
1263 | } | 1263 | } |
1264 | } | 1264 | } |
1265 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1265 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1266 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1266 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1267 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1267 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1268 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1268 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ec1154a..057df0d 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp | |||
@@ -392,129 +392,129 @@ void KODayMatrix::repaintViewTimed() | |||
392 | //eDays.fill( false); | 392 | //eDays.fill( false); |
393 | mRepaintTimer->stop(); | 393 | mRepaintTimer->stop(); |
394 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday | 394 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday |
395 | int i; | 395 | int i; |
396 | for(i = 0; i < NUMDAYS; i++) { | 396 | for(i = 0; i < NUMDAYS; i++) { |
397 | if ( ( (i+startDay) % 7 == 0 ) ) { | 397 | if ( ( (i+startDay) % 7 == 0 ) ) { |
398 | pDays.setBit(i); | 398 | pDays.setBit(i); |
399 | } | 399 | } |
400 | } | 400 | } |
401 | repaint(false); | 401 | repaint(false); |
402 | } | 402 | } |
403 | void KODayMatrix::computeEvent(Event *event, int i ) | 403 | void KODayMatrix::computeEvent(Event *event, int i ) |
404 | { | 404 | { |
405 | QString holiStr = mHolidays[i]; | 405 | QString holiStr = mHolidays[i]; |
406 | if ( event->isHoliday()) { | 406 | if ( event->isHoliday()) { |
407 | pDays.setBit(i); | 407 | pDays.setBit(i); |
408 | hDays.setBit(i); | 408 | hDays.setBit(i); |
409 | if ( !holiStr.isEmpty() ) | 409 | if ( !holiStr.isEmpty() ) |
410 | holiStr += "\n"; | 410 | holiStr += "\n"; |
411 | holiStr += event->summary(); | 411 | holiStr += event->summary(); |
412 | if ( !event->location().isEmpty() ) | 412 | if ( !event->location().isEmpty() ) |
413 | holiStr += " (" + event->location() + ")"; | 413 | holiStr += " (" + event->location() + ")"; |
414 | mHolidays[i] =holiStr ; | 414 | mHolidays[i] =holiStr ; |
415 | eDays.setBit(i); | 415 | eDays.setBit(i); |
416 | } | 416 | } |
417 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) { | 417 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_T_VIEW && KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) { |
418 | if ( event->isBirthday()) { | 418 | if ( event->isBirthday()) { |
419 | pDays.setBit(i); | 419 | pDays.setBit(i); |
420 | if ( !holiStr.isEmpty() ) | 420 | if ( !holiStr.isEmpty() ) |
421 | holiStr += "\n"; | 421 | holiStr += "\n"; |
422 | holiStr += i18n("Birthday") + ": "+event->summary(); | 422 | holiStr += i18n("Birthday") + ": "+event->summary(); |
423 | if ( !event->location().isEmpty() ) | 423 | if ( !event->location().isEmpty() ) |
424 | holiStr += " (" + event->location() + ")"; | 424 | holiStr += " (" + event->location() + ")"; |
425 | bDays.setBit(i); | 425 | bDays.setBit(i); |
426 | mHolidays[i] =holiStr ; | 426 | mHolidays[i] =holiStr ; |
427 | } | 427 | } |
428 | } | 428 | } |
429 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) | 429 | if ( KOPrefs::instance()->mCurrentDisplayedView != VIEW_J_VIEW ) |
430 | eDays.setBit(i); | 430 | eDays.setBit(i); |
431 | } | 431 | } |
432 | void KODayMatrix::updateViewTimed() | 432 | void KODayMatrix::updateViewTimed() |
433 | { | 433 | { |
434 | mUpdateTimer->stop(); | 434 | mUpdateTimer->stop(); |
435 | if ( !mCalendar ) { | 435 | if ( !mCalendar ) { |
436 | qDebug("NOT CAL "); | 436 | qDebug("NOT CAL "); |
437 | return; | 437 | return; |
438 | } | 438 | } |
439 | #if 1 | 439 | #if 1 |
440 | 440 | ||
441 | 441 | ||
442 | int i; | 442 | int i; |
443 | int timeSpan = NUMDAYS-1; | 443 | int timeSpan = NUMDAYS-1; |
444 | QPtrList<Event> events = mCalendar->events(); | 444 | QPtrList<Event> events = mCalendar->events(); |
445 | Event *event; | 445 | Event *event; |
446 | QDateTime dt; | 446 | QDateTime dt; |
447 | bool ok; | 447 | bool ok; |
448 | bDays.fill( false); | 448 | bDays.fill( false); |
449 | pDays.fill( false); | 449 | pDays.fill( false); |
450 | hDays.fill( false); | 450 | hDays.fill( false); |
451 | eDays.fill( false); | 451 | eDays.fill( false); |
452 | mHolidays.clear(); | 452 | mHolidays.clear(); |
453 | QDate mStartDate = days[0]; | 453 | QDate mStartDate = days[0]; |
454 | QDate endDate = mStartDate.addDays( timeSpan ); | 454 | QDate endDate = mStartDate.addDays( timeSpan ); |
455 | for( event = events.first(); event; event = events.next() ) { // for event | 455 | for( event = events.first(); event; event = events.next() ) { // for event |
456 | ushort recurType = event->recurrence()->doesRecur(); | 456 | ushort recurType = event->doesRecur(); |
457 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || | 457 | if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || |
458 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { | 458 | (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { |
459 | continue; | 459 | continue; |
460 | } | 460 | } |
461 | if ( event->doesRecur() ) { | 461 | if ( event->doesRecur() ) { |
462 | bool last; | 462 | bool last; |
463 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); | 463 | QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); |
464 | QDateTime incidenceEnd; | 464 | QDateTime incidenceEnd; |
465 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); | 465 | int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); |
466 | bool invalid = false; | 466 | bool invalid = false; |
467 | while( true ) { | 467 | while( true ) { |
468 | if ( incidenceStart.isValid() ) { | 468 | if ( incidenceStart.isValid() ) { |
469 | incidenceEnd = incidenceStart.addDays( eventlen ); | 469 | incidenceEnd = incidenceStart.addDays( eventlen ); |
470 | int st = incidenceStart.date().daysTo( endDate ); | 470 | int st = incidenceStart.date().daysTo( endDate ); |
471 | if ( st >= 0 ) { // start before timeend | 471 | if ( st >= 0 ) { // start before timeend |
472 | int end = mStartDate.daysTo( incidenceEnd.date() ); | 472 | int end = mStartDate.daysTo( incidenceEnd.date() ); |
473 | if ( end >= 0 ) { // end after timestart --- got one! | 473 | if ( end >= 0 ) { // end after timestart --- got one! |
474 | //normalize | 474 | //normalize |
475 | st = timeSpan - st; | 475 | st = timeSpan - st; |
476 | if ( st < 0 ) st = 0; | 476 | if ( st < 0 ) st = 0; |
477 | if ( end > timeSpan ) end = timeSpan; | 477 | if ( end > timeSpan ) end = timeSpan; |
478 | int iii; | 478 | int iii; |
479 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); | 479 | //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); |
480 | for ( iii = st;iii<= end;++iii) { | 480 | for ( iii = st;iii<= end;++iii) { |
481 | computeEvent( event, iii ); | 481 | computeEvent( event, iii ); |
482 | } | 482 | } |
483 | } | 483 | } |
484 | } | 484 | } |
485 | } else { | 485 | } else { |
486 | if ( invalid ) | 486 | if ( invalid ) |
487 | break; | 487 | break; |
488 | invalid = true; | 488 | invalid = true; |
489 | //qDebug("invalid %s", event->summary().latin1()); | 489 | //qDebug("invalid %s", event->summary().latin1()); |
490 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; | 490 | incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; |
491 | } | 491 | } |
492 | if ( last ) | 492 | if ( last ) |
493 | break; | 493 | break; |
494 | bool ok; | 494 | bool ok; |
495 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); | 495 | incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); |
496 | if ( ! ok ) | 496 | if ( ! ok ) |
497 | break; | 497 | break; |
498 | if ( incidenceStart.date() > endDate ) | 498 | if ( incidenceStart.date() > endDate ) |
499 | break; | 499 | break; |
500 | } | 500 | } |
501 | } else { // no recur | 501 | } else { // no recur |
502 | int st = event->dtStart().date().daysTo( endDate ); | 502 | int st = event->dtStart().date().daysTo( endDate ); |
503 | if ( st >= 0 ) { // start before timeend | 503 | if ( st >= 0 ) { // start before timeend |
504 | int end = mStartDate.daysTo( event->dtEnd().date() ); | 504 | int end = mStartDate.daysTo( event->dtEnd().date() ); |
505 | if ( end >= 0 ) { // end after timestart --- got one! | 505 | if ( end >= 0 ) { // end after timestart --- got one! |
506 | //normalize | 506 | //normalize |
507 | st = timeSpan - st; | 507 | st = timeSpan - st; |
508 | if ( st < 0 ) st = 0; | 508 | if ( st < 0 ) st = 0; |
509 | if ( end > timeSpan ) end = timeSpan; | 509 | if ( end > timeSpan ) end = timeSpan; |
510 | int iii; | 510 | int iii; |
511 | for ( iii = st;iii<= end;++iii) | 511 | for ( iii = st;iii<= end;++iii) |
512 | computeEvent( event, iii ); | 512 | computeEvent( event, iii ); |
513 | } | 513 | } |
514 | } | 514 | } |
515 | } | 515 | } |
516 | } | 516 | } |
517 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday | 517 | int startDay = days[0].dayOfWeek(); // 1...7 7 = sunday |
518 | for(i = 0; i < NUMDAYS; i++) { | 518 | for(i = 0; i < NUMDAYS; i++) { |
519 | if ( ( (i+startDay) % 7 == 0 ) ) { | 519 | if ( ( (i+startDay) % 7 == 0 ) ) { |
520 | pDays.setBit(i); | 520 | pDays.setBit(i); |
diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index de4e4f7..89504db 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp | |||
@@ -836,244 +836,250 @@ void KOEditorRecurrence::setDateTimes( QDateTime start, QDateTime end ) | |||
836 | 836 | ||
837 | } | 837 | } |
838 | void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to ) | 838 | void KOEditorRecurrence::setDefaultsDates( QDateTime from, QDateTime to ) |
839 | { | 839 | { |
840 | setDateTimes( from, to ); | 840 | setDateTimes( from, to ); |
841 | QBitArray days( 7 ); | 841 | QBitArray days( 7 ); |
842 | days.fill( 0 ); | 842 | days.fill( 0 ); |
843 | days.setBit( from.date().dayOfWeek()- 1); | 843 | days.setBit( from.date().dayOfWeek()- 1); |
844 | mWeekly->setDays( days ); | 844 | mWeekly->setDays( days ); |
845 | bool byPos = mMonthly->byPos(); | 845 | bool byPos = mMonthly->byPos(); |
846 | if ( byPos ) | 846 | if ( byPos ) |
847 | mMonthly->setByDay( from.date().day()-1 ); | 847 | mMonthly->setByDay( from.date().day()-1 ); |
848 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); | 848 | mMonthly->setByPos((from.date().day()/7), from.date().dayOfWeek()-1 ); |
849 | if ( ! byPos) | 849 | if ( ! byPos) |
850 | mMonthly->setByDay( from.date().day()-1 ); | 850 | mMonthly->setByDay( from.date().day()-1 ); |
851 | 851 | ||
852 | bool byDay = mYearly->byDay(); | 852 | bool byDay = mYearly->byDay(); |
853 | if ( ! byDay ) | 853 | if ( ! byDay ) |
854 | mYearly->setByDay( from.date().dayOfYear() ); | 854 | mYearly->setByDay( from.date().dayOfYear() ); |
855 | mYearly->setByMonth( from.date().month(), from.date().day() ); | 855 | mYearly->setByMonth( from.date().month(), from.date().day() ); |
856 | if ( byDay ) | 856 | if ( byDay ) |
857 | mYearly->setByDay( from.date().dayOfYear() ); | 857 | mYearly->setByDay( from.date().dayOfYear() ); |
858 | } | 858 | } |
859 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to ) | 859 | void KOEditorRecurrence::setDefaults( QDateTime from, QDateTime to ) |
860 | { | 860 | { |
861 | 861 | ||
862 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); | 862 | // qDebug("KOEditorRecurrence::setDefaults %s %s ",from.toString().latin1(),to.toString().latin1() ); |
863 | //setDateTimes( from, to ); | 863 | //setDateTimes( from, to ); |
864 | 864 | ||
865 | bool enabled = false; | 865 | bool enabled = false; |
866 | mEnabledCheck->setChecked( enabled ); | 866 | mEnabledCheck->setChecked( enabled ); |
867 | setEnabled( enabled ); | 867 | setEnabled( enabled ); |
868 | 868 | ||
869 | mExceptions->setDefaults( to ); | 869 | mExceptions->setDefaults( to ); |
870 | mRecurrenceRange->setDefaults( to ); | 870 | mRecurrenceRange->setDefaults( to ); |
871 | 871 | ||
872 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); | 872 | mRecurrenceChooser->setType( RecurrenceChooser::Weekly ); |
873 | showCurrentRule( mRecurrenceChooser->type() ); | 873 | showCurrentRule( mRecurrenceChooser->type() ); |
874 | 874 | ||
875 | mDaily->setFrequency( 1 ); | 875 | mDaily->setFrequency( 1 ); |
876 | mWeekly->setFrequency( 1 ); | 876 | mWeekly->setFrequency( 1 ); |
877 | mMonthly->setFrequency( 1 ); | 877 | mMonthly->setFrequency( 1 ); |
878 | mYearly->setFrequency( 1 ); | 878 | mYearly->setFrequency( 1 ); |
879 | setDefaultsDates( from, to ); | 879 | setDefaultsDates( from, to ); |
880 | } | 880 | } |
881 | 881 | ||
882 | void KOEditorRecurrence::readEvent(Incidence *event) | 882 | void KOEditorRecurrence::readEvent(Incidence *event) |
883 | { | 883 | { |
884 | 884 | ||
885 | QDateTime dtEnd; | 885 | QDateTime dtEnd; |
886 | if ( event->typeID() == eventID ) | 886 | if ( event->typeID() == eventID ) |
887 | dtEnd = ((Event*)event)->dtEnd(); | 887 | dtEnd = ((Event*)event)->dtEnd(); |
888 | else | 888 | else |
889 | dtEnd = ((Todo*)event)->dtDue(); | 889 | dtEnd = ((Todo*)event)->dtDue(); |
890 | 890 | ||
891 | setDefaults( event->dtStart(), dtEnd ); | 891 | setDefaults( event->dtStart(), dtEnd ); |
892 | QBitArray rDays( 7 ); | 892 | QBitArray rDays( 7 ); |
893 | QPtrList<Recurrence::rMonthPos> rmp; | 893 | QPtrList<Recurrence::rMonthPos> rmp; |
894 | QPtrList<int> rmd; | 894 | QPtrList<int> rmd; |
895 | int day = 0; | 895 | int day = 0; |
896 | int count = 0; | 896 | int count = 0; |
897 | int month = 0; | 897 | int month = 0; |
898 | setDateTimes( event->dtStart(), dtEnd ); | 898 | setDateTimes( event->dtStart(), dtEnd ); |
899 | 899 | ||
900 | Recurrence *r = event->recurrence(); | 900 | |
901 | int f = r->frequency(); | ||
902 | 901 | ||
903 | int recurs = r->doesRecur(); | 902 | int recurs = event->doesRecur(); |
904 | 903 | ||
905 | mEnabledCheck->setChecked( recurs ); | 904 | mEnabledCheck->setChecked( recurs ); |
906 | setEnabled( recurs ); | 905 | setEnabled( recurs ); |
907 | 906 | ||
908 | int recurrenceType = RecurrenceChooser::Weekly; | 907 | int recurrenceType = RecurrenceChooser::Weekly; |
909 | 908 | if ( recurs ) { | |
910 | switch ( recurs ) { | 909 | Recurrence *r = event->recurrence(); |
911 | case Recurrence::rNone: | 910 | int f = r->frequency(); |
912 | setDefaults( event->dtStart(), dtEnd ); | 911 | switch ( recurs ) { |
913 | break; | 912 | case Recurrence::rNone: |
914 | case Recurrence::rDaily: | 913 | setDefaults( event->dtStart(), dtEnd ); |
915 | recurrenceType = RecurrenceChooser::Daily; | 914 | break; |
916 | mDaily->setFrequency( f ); | 915 | case Recurrence::rDaily: |
917 | break; | 916 | recurrenceType = RecurrenceChooser::Daily; |
918 | case Recurrence::rWeekly: | 917 | mDaily->setFrequency( f ); |
919 | recurrenceType = RecurrenceChooser::Weekly; | 918 | break; |
920 | mWeekly->setFrequency( f ); | 919 | case Recurrence::rWeekly: |
921 | mWeekly->setDays( r->days() ); | 920 | recurrenceType = RecurrenceChooser::Weekly; |
922 | break; | 921 | mWeekly->setFrequency( f ); |
923 | case Recurrence::rMonthlyPos: | 922 | mWeekly->setDays( r->days() ); |
924 | // we only handle one possibility in the list right now, | 923 | break; |
925 | // so I have hardcoded calls with first(). If we make the GUI | 924 | case Recurrence::rMonthlyPos: |
926 | // more extended, this can be changed. | 925 | // we only handle one possibility in the list right now, |
927 | recurrenceType = RecurrenceChooser::Monthly; | 926 | // so I have hardcoded calls with first(). If we make the GUI |
928 | 927 | // more extended, this can be changed. | |
929 | rmp = r->monthPositions(); | 928 | recurrenceType = RecurrenceChooser::Monthly; |
930 | if ( rmp.first()->negative ) | 929 | |
931 | count = 5 - rmp.first()->rPos - 1; | 930 | rmp = r->monthPositions(); |
932 | else | 931 | if ( rmp.first()->negative ) |
933 | count = rmp.first()->rPos - 1; | 932 | count = 5 - rmp.first()->rPos - 1; |
934 | day = 0; | 933 | else |
935 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | 934 | count = rmp.first()->rPos - 1; |
936 | mMonthly->setByPos( count, day ); | 935 | day = 0; |
937 | 936 | while ( !rmp.first()->rDays.testBit( day ) ) ++day; | |
938 | mMonthly->setFrequency( f ); | 937 | mMonthly->setByPos( count, day ); |
939 | 938 | ||
940 | break; | 939 | mMonthly->setFrequency( f ); |
941 | case Recurrence::rMonthlyDay: | 940 | |
942 | recurrenceType = RecurrenceChooser::Monthly; | 941 | break; |
943 | 942 | case Recurrence::rMonthlyDay: | |
944 | rmd = r->monthDays(); | 943 | recurrenceType = RecurrenceChooser::Monthly; |
945 | day = *rmd.first() - 1; | 944 | |
946 | mMonthly->setByDay( day ); | 945 | rmd = r->monthDays(); |
947 | 946 | day = *rmd.first() - 1; | |
948 | mMonthly->setFrequency( f ); | 947 | mMonthly->setByDay( day ); |
949 | 948 | ||
950 | break; | 949 | mMonthly->setFrequency( f ); |
951 | case Recurrence::rYearlyMonth: | 950 | |
952 | { | 951 | break; |
953 | recurrenceType = RecurrenceChooser::Yearly; | 952 | case Recurrence::rYearlyMonth: |
954 | //qDebug("Recurrence::rYearlyMonth: "); | 953 | { |
955 | day = event->dtStart().date().day(); | 954 | recurrenceType = RecurrenceChooser::Yearly; |
956 | rmd = r->yearNums(); | 955 | //qDebug("Recurrence::rYearlyMonth: "); |
957 | if ( rmd.count() > 0 ) | 956 | day = event->dtStart().date().day(); |
958 | month = *rmd.first(); | 957 | rmd = r->yearNums(); |
959 | else | 958 | if ( rmd.count() > 0 ) |
960 | month = event->dtStart().date().month() ; | 959 | month = *rmd.first(); |
961 | mYearly->setByMonth( month, day ); | 960 | else |
961 | month = event->dtStart().date().month() ; | ||
962 | mYearly->setByMonth( month, day ); | ||
962 | #if 0 | 963 | #if 0 |
963 | //qDebug("2day = %d ",day ); | 964 | //qDebug("2day = %d ",day ); |
964 | QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); | 965 | QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); |
965 | int month; | 966 | int month; |
966 | if ( !monthlist.isEmpty() ) { | 967 | if ( !monthlist.isEmpty() ) { |
967 | month = monthlist.first()->rPos ; | 968 | month = monthlist.first()->rPos ; |
968 | } else { | 969 | } else { |
969 | month = event->dtStart().date().month() ; | 970 | month = event->dtStart().date().month() ; |
970 | } | 971 | } |
971 | mYearly->setByMonth( day, month ); | 972 | mYearly->setByMonth( day, month ); |
972 | #endif | 973 | #endif |
973 | mYearly->setFrequency( f ); | 974 | mYearly->setFrequency( f ); |
974 | } | 975 | } |
975 | 976 | ||
976 | break; | 977 | break; |
977 | case Recurrence::rYearlyDay: | 978 | case Recurrence::rYearlyDay: |
978 | //qDebug("Recurrence::rYearlyDay: "); | 979 | //qDebug("Recurrence::rYearlyDay: "); |
979 | recurrenceType = RecurrenceChooser::Yearly; | 980 | recurrenceType = RecurrenceChooser::Yearly; |
980 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); | 981 | mYearly->setByDay( event->dtStart().date().dayOfYear() ); |
981 | mYearly->setFrequency( f ); | 982 | mYearly->setFrequency( f ); |
982 | break; | 983 | break; |
983 | default: | 984 | default: |
984 | setDefaults( event->dtStart(), dtEnd ); | 985 | setDefaults( event->dtStart(), dtEnd ); |
985 | break; | 986 | break; |
987 | } | ||
986 | } | 988 | } |
987 | |||
988 | mRecurrenceChooser->setType( recurrenceType ); | 989 | mRecurrenceChooser->setType( recurrenceType ); |
989 | showCurrentRule( recurrenceType ); | 990 | showCurrentRule( recurrenceType ); |
990 | 991 | ||
991 | mRecurrenceRange->setDateTimes( event->dtStart() ); | 992 | mRecurrenceRange->setDateTimes( event->dtStart() ); |
992 | 993 | ||
993 | if ( r->doesRecur() ) { | 994 | if ( event->doesRecur() ) { |
995 | Recurrence *r = event->recurrence(); | ||
994 | mRecurrenceRange->setDuration( r->duration() ); | 996 | mRecurrenceRange->setDuration( r->duration() ); |
995 | if ( r->duration() == 0 ) | 997 | if ( r->duration() == 0 ) |
996 | { | 998 | { |
997 | if ( r->endDate() < event->dtStart().date() ) | 999 | if ( r->endDate() < event->dtStart().date() ) |
998 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1000 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
999 | else | 1001 | else |
1000 | mRecurrenceRange->setEndDate( r->endDate() ); | 1002 | mRecurrenceRange->setEndDate( r->endDate() ); |
1001 | } else | 1003 | } else |
1002 | mRecurrenceRange->setEndDate( event->dtStart().date() ); | 1004 | mRecurrenceRange->setEndDate( event->dtStart().date() ); |
1003 | } | 1005 | } |
1004 | 1006 | ||
1005 | mExceptions->setDates( event->exDates() ); | 1007 | mExceptions->setDates( event->exDates() ); |
1006 | } | 1008 | } |
1007 | 1009 | ||
1008 | void KOEditorRecurrence::writeEvent( Incidence *event ) | 1010 | void KOEditorRecurrence::writeEvent( Incidence *event ) |
1009 | { | 1011 | { |
1010 | Recurrence *r = event->recurrence(); | 1012 | |
1011 | 1013 | ||
1012 | // clear out any old settings; | 1014 | if ( !mEnabledCheck->isChecked() ) { |
1013 | r->unsetRecurs(); | 1015 | if ( event->doesRecur() ) |
1016 | event->recurrence()->unsetRecurs(); | ||
1017 | } else { | ||
1018 | Recurrence *r = event->recurrence(); | ||
1014 | 1019 | ||
1015 | if ( mEnabledCheck->isChecked() ) { | 1020 | // clear out any old settings; |
1021 | r->unsetRecurs(); | ||
1016 | int duration = mRecurrenceRange->duration(); | 1022 | int duration = mRecurrenceRange->duration(); |
1017 | QDate endDate; | 1023 | QDate endDate; |
1018 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); | 1024 | if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); |
1019 | 1025 | ||
1020 | int recurrenceType = mRecurrenceChooser->type(); | 1026 | int recurrenceType = mRecurrenceChooser->type(); |
1021 | 1027 | ||
1022 | if ( recurrenceType == RecurrenceChooser::Daily ) { | 1028 | if ( recurrenceType == RecurrenceChooser::Daily ) { |
1023 | int freq = mDaily->frequency(); | 1029 | int freq = mDaily->frequency(); |
1024 | if ( duration != 0 ) r->setDaily( freq, duration ); | 1030 | if ( duration != 0 ) r->setDaily( freq, duration ); |
1025 | else r->setDaily( freq, endDate ); | 1031 | else r->setDaily( freq, endDate ); |
1026 | } else if ( recurrenceType == RecurrenceChooser::Weekly ) { | 1032 | } else if ( recurrenceType == RecurrenceChooser::Weekly ) { |
1027 | int freq = mWeekly->frequency(); | 1033 | int freq = mWeekly->frequency(); |
1028 | QBitArray days = mWeekly->days(); | 1034 | QBitArray days = mWeekly->days(); |
1029 | int j; | 1035 | int j; |
1030 | bool found = false; | 1036 | bool found = false; |
1031 | for (j = 0; j < 7 ; ++j ) { | 1037 | for (j = 0; j < 7 ; ++j ) { |
1032 | found |=days.at(j); | 1038 | found |=days.at(j); |
1033 | } | 1039 | } |
1034 | if ( !found ) { | 1040 | if ( !found ) { |
1035 | days.setBit( event->dtStart().date().dayOfWeek()-1); | 1041 | days.setBit( event->dtStart().date().dayOfWeek()-1); |
1036 | //qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); | 1042 | //qDebug("bit set %d ", event->dtStart().date().dayOfWeek()-1); |
1037 | } | 1043 | } |
1038 | if ( duration != 0 ) r->setWeekly( freq, days, duration ); | 1044 | if ( duration != 0 ) r->setWeekly( freq, days, duration ); |
1039 | else r->setWeekly( freq, days, endDate ); | 1045 | else r->setWeekly( freq, days, endDate ); |
1040 | } else if ( recurrenceType == RecurrenceChooser::Monthly ) { | 1046 | } else if ( recurrenceType == RecurrenceChooser::Monthly ) { |
1041 | int freq = mMonthly->frequency(); | 1047 | int freq = mMonthly->frequency(); |
1042 | if ( mMonthly->byPos() ) { | 1048 | if ( mMonthly->byPos() ) { |
1043 | int pos = mMonthly->count(); | 1049 | int pos = mMonthly->count(); |
1044 | 1050 | ||
1045 | QBitArray days( 7 ); | 1051 | QBitArray days( 7 ); |
1046 | days.fill( false ); | 1052 | days.fill( false ); |
1047 | 1053 | ||
1048 | days.setBit( mMonthly->weekday() ); | 1054 | days.setBit( mMonthly->weekday() ); |
1049 | if ( duration != 0 ) | 1055 | if ( duration != 0 ) |
1050 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); | 1056 | r->setMonthly( Recurrence::rMonthlyPos, freq, duration ); |
1051 | else | 1057 | else |
1052 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); | 1058 | r->setMonthly( Recurrence::rMonthlyPos, freq, endDate ); |
1053 | r->addMonthlyPos( pos, days ); | 1059 | r->addMonthlyPos( pos, days ); |
1054 | } else { | 1060 | } else { |
1055 | // it's by day | 1061 | // it's by day |
1056 | int day = mMonthly->day(); | 1062 | int day = mMonthly->day(); |
1057 | 1063 | ||
1058 | if ( duration != 0 ) { | 1064 | if ( duration != 0 ) { |
1059 | r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); | 1065 | r->setMonthly( Recurrence::rMonthlyDay, freq, duration ); |
1060 | } else { | 1066 | } else { |
1061 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); | 1067 | r->setMonthly( Recurrence::rMonthlyDay, freq, endDate ); |
1062 | } | 1068 | } |
1063 | r->addMonthlyDay( day ); | 1069 | r->addMonthlyDay( day ); |
1064 | } | 1070 | } |
1065 | } else if ( recurrenceType == RecurrenceChooser::Yearly ) { | 1071 | } else if ( recurrenceType == RecurrenceChooser::Yearly ) { |
1066 | //qDebug("RecurrenceChooser::Yearly "); | 1072 | //qDebug("RecurrenceChooser::Yearly "); |
1067 | int freq = mYearly->frequency(); | 1073 | int freq = mYearly->frequency(); |
1068 | if ( mYearly->byDay() ) { | 1074 | if ( mYearly->byDay() ) { |
1069 | if ( duration != 0 ) { | 1075 | if ( duration != 0 ) { |
1070 | r->setYearly( Recurrence::rYearlyDay, freq, duration ); | 1076 | r->setYearly( Recurrence::rYearlyDay, freq, duration ); |
1071 | } else { | 1077 | } else { |
1072 | r->setYearly( Recurrence::rYearlyDay, freq, endDate ); | 1078 | r->setYearly( Recurrence::rYearlyDay, freq, endDate ); |
1073 | } | 1079 | } |
1074 | r->addYearlyNum( event->dtStart().date().dayOfYear() ); | 1080 | r->addYearlyNum( event->dtStart().date().dayOfYear() ); |
1075 | } else { | 1081 | } else { |
1076 | if ( duration != 0 ) { | 1082 | if ( duration != 0 ) { |
1077 | r->setYearly( Recurrence::rYearlyMonth, freq, duration ); | 1083 | r->setYearly( Recurrence::rYearlyMonth, freq, duration ); |
1078 | } else { | 1084 | } else { |
1079 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); | 1085 | r->setYearly( Recurrence::rYearlyMonth, freq, endDate ); |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index a690ab1..db695f5 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -286,131 +286,131 @@ void KOEventViewer::setColorMode( int m ) | |||
286 | void KOEventViewer::appendEvent(Event *event, int mode ) | 286 | void KOEventViewer::appendEvent(Event *event, int mode ) |
287 | { | 287 | { |
288 | mMailSubject = ""; | 288 | mMailSubject = ""; |
289 | mCurrentIncidence = event; | 289 | mCurrentIncidence = event; |
290 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 290 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
291 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | 291 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); |
292 | topLevelWidget()->setCaption(i18n("Event Viewer")); | 292 | topLevelWidget()->setCaption(i18n("Event Viewer")); |
293 | if ( mode == 0 ) { | 293 | if ( mode == 0 ) { |
294 | addTag("h2",deTag(event->summary())); | 294 | addTag("h2",deTag(event->summary())); |
295 | formatReadOnly(event); | 295 | formatReadOnly(event); |
296 | } | 296 | } |
297 | else { | 297 | else { |
298 | if ( mColorMode == 1 ) { | 298 | if ( mColorMode == 1 ) { |
299 | mText +="<font color=\"#00A000\">"; | 299 | mText +="<font color=\"#00A000\">"; |
300 | } | 300 | } |
301 | if ( mColorMode == 2 ) { | 301 | if ( mColorMode == 2 ) { |
302 | mText +="<font color=\"#C00000\">"; | 302 | mText +="<font color=\"#C00000\">"; |
303 | } | 303 | } |
304 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 304 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
305 | if ( mode == 1 ) { | 305 | if ( mode == 1 ) { |
306 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 306 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
307 | } else { | 307 | } else { |
308 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 308 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
309 | } | 309 | } |
310 | formatReadOnly(event); | 310 | formatReadOnly(event); |
311 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 311 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
312 | if ( mColorMode ) | 312 | if ( mColorMode ) |
313 | mText += "</font>"; | 313 | mText += "</font>"; |
314 | } | 314 | } |
315 | mMailSubject += i18n( "Meeting " )+ event->summary(); | 315 | mMailSubject += i18n( "Meeting " )+ event->summary(); |
316 | if (event->cancelled ()) { | 316 | if (event->cancelled ()) { |
317 | mText +="<font color=\"#B00000\">"; | 317 | mText +="<font color=\"#B00000\">"; |
318 | addTag("i",i18n("This event has been cancelled!")); | 318 | addTag("i",i18n("This event has been cancelled!")); |
319 | mText.append("<br>"); | 319 | mText.append("<br>"); |
320 | mText += "</font>"; | 320 | mText += "</font>"; |
321 | mMailSubject += i18n("(cancelled)"); | 321 | mMailSubject += i18n("(cancelled)"); |
322 | } | 322 | } |
323 | 323 | ||
324 | if (event->doesFloat()) { | 324 | if (event->doesFloat()) { |
325 | if (event->isMultiDay()) { | 325 | if (event->isMultiDay()) { |
326 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 326 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
327 | .arg(event->dtStartDateStr(shortDate)) | 327 | .arg(event->dtStartDateStr(shortDate)) |
328 | .arg(event->dtEndDateStr(shortDate))); | 328 | .arg(event->dtEndDateStr(shortDate))); |
329 | } else { | 329 | } else { |
330 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 330 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
331 | } | 331 | } |
332 | } else { | 332 | } else { |
333 | if (event->isMultiDay()) { | 333 | if (event->isMultiDay()) { |
334 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 334 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
335 | .arg(event->dtStartStr( shortDate))); | 335 | .arg(event->dtStartStr( shortDate))); |
336 | mText.append(i18n("<p><b>To:</b> %1</p>") | 336 | mText.append(i18n("<p><b>To:</b> %1</p>") |
337 | .arg(event->dtEndStr(shortDate))); | 337 | .arg(event->dtEndStr(shortDate))); |
338 | } else { | 338 | } else { |
339 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 339 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
340 | .arg(event->dtStartTimeStr()) | 340 | .arg(event->dtStartTimeStr()) |
341 | .arg(event->dtEndTimeStr())); | 341 | .arg(event->dtEndTimeStr())); |
342 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 342 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
343 | .arg(event->dtStartDateStr( shortDate ))); | 343 | .arg(event->dtStartDateStr( shortDate ))); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | if (!event->location().isEmpty()) { | 346 | if (!event->location().isEmpty()) { |
347 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 347 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
348 | mMailSubject += i18n(" at ") + event->location(); | 348 | mMailSubject += i18n(" at ") + event->location(); |
349 | } | 349 | } |
350 | if (event->recurrence()->doesRecur()) { | 350 | if (event->doesRecur()) { |
351 | 351 | ||
352 | QString recurText = event->recurrence()->recurrenceText(); | 352 | QString recurText = event->recurrenceText(); |
353 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 353 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
354 | bool ok; | 354 | bool ok; |
355 | QDate start = QDate::currentDate(); | 355 | QDate start = QDate::currentDate(); |
356 | QDateTime next; | 356 | QDateTime next; |
357 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 357 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
358 | if ( ok ) { | 358 | if ( ok ) { |
359 | if ( wideScreen ){ | 359 | if ( wideScreen ){ |
360 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); | 360 | addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); |
361 | } else { | 361 | } else { |
362 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 362 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
363 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 363 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
364 | } | 364 | } |
365 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); | 365 | mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); |
366 | 366 | ||
367 | } else { | 367 | } else { |
368 | bool last; | 368 | bool last; |
369 | QDate nextd; | 369 | QDate nextd; |
370 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 370 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
371 | if ( last ) { | 371 | if ( last ) { |
372 | if ( wideScreen ){ | 372 | if ( wideScreen ){ |
373 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); | 373 | addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); |
374 | } else{ | 374 | } else{ |
375 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 375 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
376 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 376 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
377 | } | 377 | } |
378 | } | 378 | } |
379 | } | 379 | } |
380 | } else { | 380 | } else { |
381 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); | 381 | mMailSubject += i18n(" - " )+event->dtStartStr( true ); |
382 | 382 | ||
383 | } | 383 | } |
384 | 384 | ||
385 | 385 | ||
386 | if (event->isAlarmEnabled()) { | 386 | if (event->isAlarmEnabled()) { |
387 | Alarm *alarm =event->alarms().first() ; | 387 | Alarm *alarm =event->alarms().first() ; |
388 | QDateTime t = alarm->time(); | 388 | QDateTime t = alarm->time(); |
389 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 389 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
390 | if(wideScreen ){ | 390 | if(wideScreen ){ |
391 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); | 391 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
392 | }else{ | 392 | }else{ |
393 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 393 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
394 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 394 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
395 | } | 395 | } |
396 | //addTag("p",s); | 396 | //addTag("p",s); |
397 | } | 397 | } |
398 | 398 | ||
399 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 399 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
400 | 400 | ||
401 | formatCategories(event); | 401 | formatCategories(event); |
402 | 402 | ||
403 | formatAttendees(event); | 403 | formatAttendees(event); |
404 | 404 | ||
405 | if ( KOPrefs::instance()->mEVshowCreated ) { | 405 | if ( KOPrefs::instance()->mEVshowCreated ) { |
406 | if(wideScreen ){ | 406 | if(wideScreen ){ |
407 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 407 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
408 | }else{ | 408 | }else{ |
409 | addTag("p",i18n("<b>Created: ") +" </b>"); | 409 | addTag("p",i18n("<b>Created: ") +" </b>"); |
410 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 410 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
411 | } | 411 | } |
412 | 412 | ||
413 | 413 | ||
414 | } | 414 | } |
415 | if ( KOPrefs::instance()->mEVshowChanged ) { | 415 | if ( KOPrefs::instance()->mEVshowChanged ) { |
416 | if(wideScreen ){ | 416 | if(wideScreen ){ |
@@ -420,129 +420,129 @@ void KOEventViewer::appendEvent(Event *event, int mode ) | |||
420 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 420 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
421 | } | 421 | } |
422 | 422 | ||
423 | } | 423 | } |
424 | if ( KOPrefs::instance()->mEVshowDetails ) { | 424 | if ( KOPrefs::instance()->mEVshowDetails ) { |
425 | if (!event->description().isEmpty()) { | 425 | if (!event->description().isEmpty()) { |
426 | addTag("p",i18n("<b>Details: </b>")); | 426 | addTag("p",i18n("<b>Details: </b>")); |
427 | addTag("p",deTag(event->description())); | 427 | addTag("p",deTag(event->description())); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | setText(mText); | 430 | setText(mText); |
431 | //QWhatsThis::add(this,mText); | 431 | //QWhatsThis::add(this,mText); |
432 | 432 | ||
433 | } | 433 | } |
434 | 434 | ||
435 | void KOEventViewer::appendTodo(Todo *event, int mode ) | 435 | void KOEventViewer::appendTodo(Todo *event, int mode ) |
436 | { | 436 | { |
437 | mMailSubject = ""; | 437 | mMailSubject = ""; |
438 | mCurrentIncidence = event; | 438 | mCurrentIncidence = event; |
439 | topLevelWidget()->setCaption(i18n("Todo Viewer")); | 439 | topLevelWidget()->setCaption(i18n("Todo Viewer")); |
440 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 440 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
441 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); | 441 | bool wideScreen = ( QApplication::desktop()->width() >= 640 ); |
442 | if (mode == 0 ) { | 442 | if (mode == 0 ) { |
443 | addTag("h2",deTag(event->summary())); | 443 | addTag("h2",deTag(event->summary())); |
444 | formatReadOnly(event); | 444 | formatReadOnly(event); |
445 | } | 445 | } |
446 | else { | 446 | else { |
447 | if ( mColorMode == 1 ) { | 447 | if ( mColorMode == 1 ) { |
448 | mText +="<font color=\"#00A000\">"; | 448 | mText +="<font color=\"#00A000\">"; |
449 | } | 449 | } |
450 | if ( mColorMode == 2 ) { | 450 | if ( mColorMode == 2 ) { |
451 | mText +="<font color=\"#B00000\">"; | 451 | mText +="<font color=\"#B00000\">"; |
452 | } | 452 | } |
453 | if ( mode == 1 ) { | 453 | if ( mode == 1 ) { |
454 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 454 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
455 | } else { | 455 | } else { |
456 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 456 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
457 | } | 457 | } |
458 | formatReadOnly(event); | 458 | formatReadOnly(event); |
459 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 459 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
460 | if ( mColorMode ) | 460 | if ( mColorMode ) |
461 | mText += "</font>"; | 461 | mText += "</font>"; |
462 | } | 462 | } |
463 | mMailSubject += i18n( "Todo " )+ event->summary(); | 463 | mMailSubject += i18n( "Todo " )+ event->summary(); |
464 | 464 | ||
465 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 465 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
466 | mText +="<font color=\"#B00000\">"; | 466 | mText +="<font color=\"#B00000\">"; |
467 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); | 467 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); |
468 | mText += "</font>"; | 468 | mText += "</font>"; |
469 | } else { | 469 | } else { |
470 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 470 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
471 | .arg(event->percentComplete())); | 471 | .arg(event->percentComplete())); |
472 | } | 472 | } |
473 | 473 | ||
474 | if (event->cancelled ()) { | 474 | if (event->cancelled ()) { |
475 | mText +="<font color=\"#B00000\">"; | 475 | mText +="<font color=\"#B00000\">"; |
476 | addTag("i",i18n("This todo has been cancelled!")); | 476 | addTag("i",i18n("This todo has been cancelled!")); |
477 | mText.append("<br>"); | 477 | mText.append("<br>"); |
478 | mText += "</font>"; | 478 | mText += "</font>"; |
479 | mMailSubject += i18n("(cancelled)"); | 479 | mMailSubject += i18n("(cancelled)"); |
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | 483 | ||
484 | if (event->recurrence()->doesRecur()) { | 484 | if (event->doesRecur()) { |
485 | 485 | ||
486 | QString recurText = event->recurrence()->recurrenceText(); | 486 | QString recurText = event->recurrence()->recurrenceText(); |
487 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 487 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
488 | 488 | ||
489 | } | 489 | } |
490 | if (event->hasStartDate()) { | 490 | if (event->hasStartDate()) { |
491 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); | 491 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); |
492 | } | 492 | } |
493 | if (event->hasDueDate()) { | 493 | if (event->hasDueDate()) { |
494 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); | 494 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); |
495 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); | 495 | mMailSubject += i18n(" - " )+event->dtDueStr( true ); |
496 | } | 496 | } |
497 | if (!event->location().isEmpty()) { | 497 | if (!event->location().isEmpty()) { |
498 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); | 498 | addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); |
499 | mMailSubject += i18n(" at ") + event->location(); | 499 | mMailSubject += i18n(" at ") + event->location(); |
500 | } | 500 | } |
501 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 501 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
502 | .arg(QString::number(event->priority()))); | 502 | .arg(QString::number(event->priority()))); |
503 | 503 | ||
504 | if (event->isAlarmEnabled()) { | 504 | if (event->isAlarmEnabled()) { |
505 | Alarm *alarm =event->alarms().first() ; | 505 | Alarm *alarm =event->alarms().first() ; |
506 | QDateTime t = alarm->time(); | 506 | QDateTime t = alarm->time(); |
507 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 507 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
508 | if ( wideScreen ) { | 508 | if ( wideScreen ) { |
509 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); | 509 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); |
510 | } else { | 510 | } else { |
511 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 511 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
512 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 512 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
513 | } | 513 | } |
514 | } | 514 | } |
515 | 515 | ||
516 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); | 516 | addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); |
517 | 517 | ||
518 | formatCategories(event); | 518 | formatCategories(event); |
519 | 519 | ||
520 | formatAttendees(event); | 520 | formatAttendees(event); |
521 | 521 | ||
522 | if ( KOPrefs::instance()->mEVshowCreated ) { | 522 | if ( KOPrefs::instance()->mEVshowCreated ) { |
523 | if(wideScreen ){ | 523 | if(wideScreen ){ |
524 | 524 | ||
525 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 525 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
526 | 526 | ||
527 | } else { | 527 | } else { |
528 | addTag("p",i18n("<b>Created: ") +" </b>"); | 528 | addTag("p",i18n("<b>Created: ") +" </b>"); |
529 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 529 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | if ( KOPrefs::instance()->mEVshowChanged ) { | 532 | if ( KOPrefs::instance()->mEVshowChanged ) { |
533 | if(wideScreen ){ | 533 | if(wideScreen ){ |
534 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); | 534 | addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); |
535 | 535 | ||
536 | } else { | 536 | } else { |
537 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 537 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
538 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 538 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
539 | } | 539 | } |
540 | } | 540 | } |
541 | if ( event->relatedTo() ) { | 541 | if ( event->relatedTo() ) { |
542 | addTag("b",i18n("Parent todo:<br>")); | 542 | addTag("b",i18n("Parent todo:<br>")); |
543 | 543 | ||
544 | QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); | 544 | QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); |
545 | 545 | ||
546 | mText += t_name; | 546 | mText += t_name; |
547 | mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; | 547 | mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; |
548 | mText += deTag(event->relatedTo()->summary()); | 548 | mText += deTag(event->relatedTo()->summary()); |
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d25f671..e7a5e0e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp | |||
@@ -72,180 +72,180 @@ extern QPixmap* sgListViewJournalPix; | |||
72 | 72 | ||
73 | class KOListViewWhatsThis :public QWhatsThis | 73 | class KOListViewWhatsThis :public QWhatsThis |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 76 | KOListViewWhatsThis( QWidget *wid, KOListView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
77 | 77 | ||
78 | protected: | 78 | protected: |
79 | virtual QString text( const QPoint& p) | 79 | virtual QString text( const QPoint& p) |
80 | { | 80 | { |
81 | return _view->getWhatsThisText(p) ; | 81 | return _view->getWhatsThisText(p) ; |
82 | } | 82 | } |
83 | private: | 83 | private: |
84 | QWidget* _wid; | 84 | QWidget* _wid; |
85 | KOListView * _view; | 85 | KOListView * _view; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | 88 | ||
89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) | 89 | ListItemVisitor::ListItemVisitor(KOListViewItem *item, QDate date ) |
90 | { | 90 | { |
91 | mItem = item; | 91 | mItem = item; |
92 | mDate = date; | 92 | mDate = date; |
93 | } | 93 | } |
94 | 94 | ||
95 | ListItemVisitor::~ListItemVisitor() | 95 | ListItemVisitor::~ListItemVisitor() |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
99 | bool ListItemVisitor::visit(Event *e) | 99 | bool ListItemVisitor::visit(Event *e) |
100 | { | 100 | { |
101 | bool ok = false; | 101 | bool ok = false; |
102 | QString start, end; | 102 | QString start, end; |
103 | QDate ds, de; | 103 | QDate ds, de; |
104 | if ( e->doesRecur() ) { | 104 | if ( e->doesRecur() ) { |
105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); | 105 | ds = e->getNextOccurence( QDateTime( mDate, QTime(0,0,0)), &ok ).date(); |
106 | if ( ok ) { | 106 | if ( ok ) { |
107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); | 107 | int days = e->dtStart().date().daysTo(e->dtEnd().date() ); |
108 | start = KGlobal::locale()->formatDate(ds,true); | 108 | start = KGlobal::locale()->formatDate(ds,true); |
109 | de = ds.addDays( days); | 109 | de = ds.addDays( days); |
110 | end = KGlobal::locale()->formatDate(de,true); | 110 | end = KGlobal::locale()->formatDate(de,true); |
111 | } | 111 | } |
112 | 112 | ||
113 | } | 113 | } |
114 | if ( ! ok ) { | 114 | if ( ! ok ) { |
115 | start =e->dtStartDateStr(); | 115 | start =e->dtStartDateStr(); |
116 | end = e->dtEndDateStr(); | 116 | end = e->dtEndDateStr(); |
117 | ds = e->dtStart().date(); | 117 | ds = e->dtStart().date(); |
118 | de = e->dtEnd().date(); | 118 | de = e->dtEnd().date(); |
119 | } | 119 | } |
120 | mItem->setText(0,e->summary()); | 120 | mItem->setText(0,e->summary()); |
121 | mItem->setText(1,start); | 121 | mItem->setText(1,start); |
122 | if ( e->doesFloat() ) | 122 | if ( e->doesFloat() ) |
123 | mItem->setText(2,"---"); | 123 | mItem->setText(2,"---"); |
124 | else | 124 | else |
125 | mItem->setText(2,e->dtStartTimeStr()); | 125 | mItem->setText(2,e->dtStartTimeStr()); |
126 | mItem->setText(3,end); | 126 | mItem->setText(3,end); |
127 | if ( e->doesFloat() ) | 127 | if ( e->doesFloat() ) |
128 | mItem->setText(4,"---"); | 128 | mItem->setText(4,"---"); |
129 | else | 129 | else |
130 | mItem->setText(4,e->dtEndTimeStr()); | 130 | mItem->setText(4,e->dtEndTimeStr()); |
131 | if ( e->isAlarmEnabled() ) { | 131 | if ( e->isAlarmEnabled() ) { |
132 | mItem->setText(5,e->alarms().first()->offsetText() ); | 132 | mItem->setText(5,e->alarms().first()->offsetText() ); |
133 | } else { | 133 | } else { |
134 | mItem->setText(5, i18n("No")); | 134 | mItem->setText(5, i18n("No")); |
135 | } | 135 | } |
136 | mItem->setText(6, e->recurrence()->recurrenceText()); | 136 | mItem->setText(6, e->recurrenceText()); |
137 | if( ! e->doesRecur() ) | 137 | if( ! e->doesRecur() ) |
138 | mItem->setSortKey( 6, "-" ); | 138 | mItem->setSortKey( 6, "-" ); |
139 | mItem->setText(7,"---"); | 139 | mItem->setText(7,"---"); |
140 | mItem->setText(8,"---"); | 140 | mItem->setText(8,"---"); |
141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); | 141 | mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); |
142 | mItem->setText(10,e->categoriesStr()); | 142 | mItem->setText(10,e->categoriesStr()); |
143 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); | 143 | mItem->setText(11, KOPrefs::instance()->calName( e->calID() )); |
144 | mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); | 144 | mItem->setText(12, KGlobal::locale()->formatDateTime( e->lastModified(), true, true )); |
145 | 145 | ||
146 | QString key; | 146 | QString key; |
147 | QDate d = e->lastModified().date(); | 147 | QDate d = e->lastModified().date(); |
148 | QTime t = e->lastModified().time(); | 148 | QTime t = e->lastModified().time(); |
149 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); | 149 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),t.hour(),t.minute(),t.second() ); |
150 | mItem->setSortKey(12,key); | 150 | mItem->setSortKey(12,key); |
151 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); | 151 | t = e->doesFloat() ? QTime(0,0) : e->dtStart().time(); |
152 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); | 152 | key.sprintf("%04d%02d%02d%02d%02d",ds.year(),ds.month(),ds.day(),t.hour(),t.minute()); |
153 | mItem->setSortKey(1,key); | 153 | mItem->setSortKey(1,key); |
154 | 154 | ||
155 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); | 155 | t = e->doesFloat() ? QTime(0,0) : e->dtEnd().time(); |
156 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); | 156 | key.sprintf("%04d%02d%02d%02d%02d",de.year(),de.month(),de.day(),t.hour(),t.minute()); |
157 | mItem->setSortKey(3,key); | 157 | mItem->setSortKey(3,key); |
158 | return true; | 158 | return true; |
159 | } | 159 | } |
160 | 160 | ||
161 | bool ListItemVisitor::visit(Todo *t) | 161 | bool ListItemVisitor::visit(Todo *t) |
162 | { | 162 | { |
163 | mItem->setText(0,t->summary()); | 163 | mItem->setText(0,t->summary()); |
164 | if ( t->isCompleted() ) { | 164 | if ( t->isCompleted() ) { |
165 | mItem->setSortKey(0,"99"+ t->summary().left(10)); | 165 | mItem->setSortKey(0,"99"+ t->summary().left(10)); |
166 | } else | 166 | } else |
167 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); | 167 | mItem->setSortKey(0,QString::number( t->percentComplete()+1 )+ t->summary().left(10)); |
168 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); | 168 | mItem->setPixmap( 0, *(sgListViewCompletedPix[t->percentComplete()/20])); |
169 | if (t->hasStartDate()) { | 169 | if (t->hasStartDate()) { |
170 | mItem->setText(1,t->dtStartDateStr()); | 170 | mItem->setText(1,t->dtStartDateStr()); |
171 | if (t->doesFloat()) { | 171 | if (t->doesFloat()) { |
172 | mItem->setText(2,"---"); | 172 | mItem->setText(2,"---"); |
173 | } else { | 173 | } else { |
174 | mItem->setText(2,t->dtStartTimeStr()); | 174 | mItem->setText(2,t->dtStartTimeStr()); |
175 | } | 175 | } |
176 | } else { | 176 | } else { |
177 | mItem->setText(1,"---"); | 177 | mItem->setText(1,"---"); |
178 | mItem->setText(2,"---"); | 178 | mItem->setText(2,"---"); |
179 | } | 179 | } |
180 | mItem->setText(3,"---"); | 180 | mItem->setText(3,"---"); |
181 | mItem->setText(4,"---"); | 181 | mItem->setText(4,"---"); |
182 | if ( t->isAlarmEnabled() ) { | 182 | if ( t->isAlarmEnabled() ) { |
183 | mItem->setText(5,t->alarms().first()->offsetText() ); | 183 | mItem->setText(5,t->alarms().first()->offsetText() ); |
184 | } else { | 184 | } else { |
185 | mItem->setText(5, i18n("No")); | 185 | mItem->setText(5, i18n("No")); |
186 | } | 186 | } |
187 | mItem->setText(6, t->recurrence()->recurrenceText()); | 187 | mItem->setText(6, t->recurrenceText()); |
188 | if( ! t->doesRecur() ) | 188 | if( ! t->doesRecur() ) |
189 | mItem->setSortKey( 6, "-" ); | 189 | mItem->setSortKey( 6, "-" ); |
190 | if (t->hasDueDate()) { | 190 | if (t->hasDueDate()) { |
191 | mItem->setText(7,t->dtDueDateStr()); | 191 | mItem->setText(7,t->dtDueDateStr()); |
192 | if (t->doesFloat()) { | 192 | if (t->doesFloat()) { |
193 | mItem->setText(8,"---"); | 193 | mItem->setText(8,"---"); |
194 | } else { | 194 | } else { |
195 | mItem->setText(8,t->dtDueTimeStr()); | 195 | mItem->setText(8,t->dtDueTimeStr()); |
196 | } | 196 | } |
197 | } else { | 197 | } else { |
198 | mItem->setText(7,"---"); | 198 | mItem->setText(7,"---"); |
199 | mItem->setText(8,"---"); | 199 | mItem->setText(8,"---"); |
200 | } | 200 | } |
201 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); | 201 | mItem->setText(9, t->cancelled() ? i18n("Yes") : i18n("No")); |
202 | mItem->setText(10,t->categoriesStr()); | 202 | mItem->setText(10,t->categoriesStr()); |
203 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); | 203 | mItem->setText(11, KOPrefs::instance()->calName( t->calID() )); |
204 | mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); | 204 | mItem->setText(12, KGlobal::locale()->formatDateTime( t->lastModified(), true, true )); |
205 | QString key; | 205 | QString key; |
206 | QDate d = t->lastModified().date(); | 206 | QDate d = t->lastModified().date(); |
207 | QTime tm = t->lastModified().time(); | 207 | QTime tm = t->lastModified().time(); |
208 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); | 208 | key.sprintf("%04d%02d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute(),tm.second() ); |
209 | mItem->setSortKey(12,key); | 209 | mItem->setSortKey(12,key); |
210 | if (t->hasDueDate()) { | 210 | if (t->hasDueDate()) { |
211 | d = t->dtDue().date(); | 211 | d = t->dtDue().date(); |
212 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); | 212 | tm = t->doesFloat() ? QTime(0,0) : t->dtDue().time(); |
213 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 213 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
214 | mItem->setSortKey(7,key); | 214 | mItem->setSortKey(7,key); |
215 | } | 215 | } |
216 | if ( t->hasStartDate() ) { | 216 | if ( t->hasStartDate() ) { |
217 | d = t->dtStart().date(); | 217 | d = t->dtStart().date(); |
218 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); | 218 | tm = t->doesFloat() ? QTime(0,0) : t->dtStart().time(); |
219 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); | 219 | key.sprintf("%04d%02d%02d%02d%02d",d.year(),d.month(),d.day(),tm.hour(),tm.minute()); |
220 | mItem->setSortKey(1,key); | 220 | mItem->setSortKey(1,key); |
221 | } | 221 | } |
222 | return true; | 222 | return true; |
223 | } | 223 | } |
224 | 224 | ||
225 | bool ListItemVisitor::visit(Journal * j) | 225 | bool ListItemVisitor::visit(Journal * j) |
226 | { | 226 | { |
227 | 227 | ||
228 | QString des; | 228 | QString des; |
229 | mItem->setPixmap( 0, *sgListViewJournalPix); | 229 | mItem->setPixmap( 0, *sgListViewJournalPix); |
230 | if ( !j->summary().isEmpty() ) { | 230 | if ( !j->summary().isEmpty() ) { |
231 | des = j->summary(); | 231 | des = j->summary(); |
232 | } else { | 232 | } else { |
233 | des = j->description().left(30); | 233 | des = j->description().left(30); |
234 | des = des.simplifyWhiteSpace (); | 234 | des = des.simplifyWhiteSpace (); |
235 | des.replace (QRegExp ("\\n"),"" ); | 235 | des.replace (QRegExp ("\\n"),"" ); |
236 | des.replace (QRegExp ("\\r"),"" ); | 236 | des.replace (QRegExp ("\\r"),"" ); |
237 | } | 237 | } |
238 | mItem->setText(0,des.left(25)); | 238 | mItem->setText(0,des.left(25)); |
239 | mItem->setSortKey(0,"0"+ des.left(25)); | 239 | mItem->setSortKey(0,"0"+ des.left(25)); |
240 | mItem->setText(1,j->dtStartDateStr()); | 240 | mItem->setText(1,j->dtStartDateStr()); |
241 | mItem->setText(2,"---"); | 241 | mItem->setText(2,"---"); |
242 | mItem->setText(3,"---"); | 242 | mItem->setText(3,"---"); |
243 | mItem->setText(4,"---"); | 243 | mItem->setText(4,"---"); |
244 | mItem->setText(5,"---"); | 244 | mItem->setText(5,"---"); |
245 | mItem->setText(6,"---"); | 245 | mItem->setText(6,"---"); |
246 | mItem->setText(7,j->dtStartDateStr()); | 246 | mItem->setText(7,j->dtStartDateStr()); |
247 | mItem->setText(8,"---"); | 247 | mItem->setText(8,"---"); |
248 | mItem->setText(9,"---"); | 248 | mItem->setText(9,"---"); |
249 | mItem->setText(10,j->categoriesStr()); | 249 | mItem->setText(10,j->categoriesStr()); |
250 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); | 250 | mItem->setText(11, KOPrefs::instance()->calName( j->calID() )); |
251 | mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); | 251 | mItem->setText(12, KGlobal::locale()->formatDateTime( j->lastModified(), true, true )); |
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 498d9b0..eea9a4d 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp | |||
@@ -726,220 +726,220 @@ int MonthViewCell::insertEvent(Event *event) | |||
726 | } | 726 | } |
727 | if ( !event->doesFloat() ) { | 727 | if ( !event->doesFloat() ) { |
728 | if ( mDate == event->dtStart().date () ) | 728 | if ( mDate == event->dtStart().date () ) |
729 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; | 729 | time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; |
730 | else if ( mDate == event->dtEnd().date () ) | 730 | else if ( mDate == event->dtEnd().date () ) |
731 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; | 731 | time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; |
732 | 732 | ||
733 | } | 733 | } |
734 | text = time + event->summary(); | 734 | text = time + event->summary(); |
735 | if ( useToolTips ) | 735 | if ( useToolTips ) |
736 | mToolTipText += prefix + text; | 736 | mToolTipText += prefix + text; |
737 | } else { | 737 | } else { |
738 | if (event->doesFloat()) { | 738 | if (event->doesFloat()) { |
739 | text = event->summary(); | 739 | text = event->summary(); |
740 | if ( useToolTips ) | 740 | if ( useToolTips ) |
741 | mToolTipText += text; | 741 | mToolTipText += text; |
742 | } | 742 | } |
743 | else { | 743 | else { |
744 | text = KGlobal::locale()->formatTime(event->dtStart().time()); | 744 | text = KGlobal::locale()->formatTime(event->dtStart().time()); |
745 | text += " " + event->summary(); | 745 | text += " " + event->summary(); |
746 | if ( useToolTips ) | 746 | if ( useToolTips ) |
747 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); | 747 | mToolTipText += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); |
748 | } | 748 | } |
749 | } | 749 | } |
750 | if ( useToolTips && ! event->location().isEmpty() ) { | 750 | if ( useToolTips && ! event->location().isEmpty() ) { |
751 | mToolTipText += " (" + event->location() +")"; | 751 | mToolTipText += " (" + event->location() +")"; |
752 | } | 752 | } |
753 | MonthViewItem *item ; | 753 | MonthViewItem *item ; |
754 | 754 | ||
755 | if ( mAvailItemList.count() ) { | 755 | if ( mAvailItemList.count() ) { |
756 | item = mAvailItemList.first(); | 756 | item = mAvailItemList.first(); |
757 | mAvailItemList.remove( item ); | 757 | mAvailItemList.remove( item ); |
758 | item->recycle( event, text ); | 758 | item->recycle( event, text ); |
759 | } else { | 759 | } else { |
760 | item = new MonthViewItem( event, text ); | 760 | item = new MonthViewItem( event, text ); |
761 | } | 761 | } |
762 | 762 | ||
763 | QPalette pal; | 763 | QPalette pal; |
764 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 764 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
765 | QStringList categories = event->categories(); | 765 | QStringList categories = event->categories(); |
766 | QString cat = categories.first(); | 766 | QString cat = categories.first(); |
767 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 767 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
768 | pal = getPalette(); | 768 | pal = getPalette(); |
769 | if (cat.isEmpty()) { | 769 | if (cat.isEmpty()) { |
770 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 770 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
771 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); | 771 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( event->calID() )); |
772 | } else { | 772 | } else { |
773 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 773 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
774 | } | 774 | } |
775 | 775 | ||
776 | } else { | 776 | } else { |
777 | if (cat.isEmpty()) { | 777 | if (cat.isEmpty()) { |
778 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 778 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
779 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); | 779 | pal = QPalette( KOPrefs::instance()->defaultColor( event->calID() ), KOPrefs::instance()->defaultColor( event->calID() )); |
780 | } else { | 780 | } else { |
781 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 781 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
782 | } | 782 | } |
783 | } | 783 | } |
784 | 784 | ||
785 | } else { | 785 | } else { |
786 | pal = mStandardPalette ; | 786 | pal = mStandardPalette ; |
787 | } | 787 | } |
788 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 788 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
789 | item->setPalette( pal ); | 789 | item->setPalette( pal ); |
790 | item->setRecur( event->recurrence()->doesRecur() ); | 790 | item->setRecur( event->doesRecur() ); |
791 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); | 791 | item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); |
792 | item->setMoreInfo( event->description().length() > 0 ); | 792 | item->setMoreInfo( event->description().length() > 0 ); |
793 | #ifdef DESKTOP_VERSION | 793 | #ifdef DESKTOP_VERSION |
794 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, | 794 | Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, |
795 | KOPrefs::instance()->email()); | 795 | KOPrefs::instance()->email()); |
796 | if ( me != 0 ) { | 796 | if ( me != 0 ) { |
797 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) | 797 | if ( me->status() == Attendee::NeedsAction && me->RSVP()) |
798 | item->setReply(true && multiday < 2); | 798 | item->setReply(true && multiday < 2); |
799 | else | 799 | else |
800 | item->setReply(false); | 800 | item->setReply(false); |
801 | } else | 801 | } else |
802 | item->setReply(false); | 802 | item->setReply(false); |
803 | #endif | 803 | #endif |
804 | 804 | ||
805 | item->setMultiDay( multiday ); | 805 | item->setMultiDay( multiday ); |
806 | if ( multiday ) { | 806 | if ( multiday ) { |
807 | insertItem( item ,mdayCount); | 807 | insertItem( item ,mdayCount); |
808 | ++mdayCount; | 808 | ++mdayCount; |
809 | } else { | 809 | } else { |
810 | uint i = mdayCount; | 810 | uint i = mdayCount; |
811 | uint pos = mdayCount; | 811 | uint pos = mdayCount; |
812 | uint itcount = count(); | 812 | uint itcount = count(); |
813 | if ( itcount > 1000 ) { | 813 | if ( itcount > 1000 ) { |
814 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); | 814 | qDebug("KO: Bug in MonthViewCell::insertEvent %u ", itcount); |
815 | itcount = 0; | 815 | itcount = 0; |
816 | } | 816 | } |
817 | for ( i = pos; i < itcount;++i ) { | 817 | for ( i = pos; i < itcount;++i ) { |
818 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); | 818 | // qDebug("i %d mday %u count %d ",i,itcount,mdayCount ); |
819 | QListBoxItem* it = this->item ( i ); | 819 | QListBoxItem* it = this->item ( i ); |
820 | if ( it && text < it->text() ) { | 820 | if ( it && text < it->text() ) { |
821 | pos = i; | 821 | pos = i; |
822 | break; | 822 | break; |
823 | } | 823 | } |
824 | ++pos; | 824 | ++pos; |
825 | } | 825 | } |
826 | insertItem( item ,pos); | 826 | insertItem( item ,pos); |
827 | } | 827 | } |
828 | if ( useToolTips ) { | 828 | if ( useToolTips ) { |
829 | mToolTip.append( mToolTipText ); | 829 | mToolTip.append( mToolTipText ); |
830 | } | 830 | } |
831 | return mdayCount; | 831 | return mdayCount; |
832 | } | 832 | } |
833 | void MonthViewCell::insertTodo(Todo *todo) | 833 | void MonthViewCell::insertTodo(Todo *todo) |
834 | { | 834 | { |
835 | setFocusPolicy(WheelFocus); | 835 | setFocusPolicy(WheelFocus); |
836 | QString text; | 836 | QString text; |
837 | if (todo->hasDueDate()) { | 837 | if (todo->hasDueDate()) { |
838 | if (!todo->doesFloat()) { | 838 | if (!todo->doesFloat()) { |
839 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); | 839 | text += KGlobal::locale()->formatTime(todo->dtDue().time()); |
840 | text += " "; | 840 | text += " "; |
841 | } | 841 | } |
842 | } | 842 | } |
843 | text += todo->summary(); | 843 | text += todo->summary(); |
844 | MonthViewItem *item ; | 844 | MonthViewItem *item ; |
845 | if ( mAvailItemList.count() ) { | 845 | if ( mAvailItemList.count() ) { |
846 | item = mAvailItemList.first(); | 846 | item = mAvailItemList.first(); |
847 | mAvailItemList.remove( item ); | 847 | mAvailItemList.remove( item ); |
848 | item->recycle( todo, text ); | 848 | item->recycle( todo, text ); |
849 | } else { | 849 | } else { |
850 | item = new MonthViewItem( todo, text ); | 850 | item = new MonthViewItem( todo, text ); |
851 | } | 851 | } |
852 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); | 852 | //MonthViewItem *item = new MonthViewItem( todo, mDate, text ); |
853 | //item->setPalette( mStandardPalette ); | 853 | //item->setPalette( mStandardPalette ); |
854 | QPalette pal; | 854 | QPalette pal; |
855 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { | 855 | if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { |
856 | QStringList categories = todo->categories(); | 856 | QStringList categories = todo->categories(); |
857 | QString cat = categories.first(); | 857 | QString cat = categories.first(); |
858 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { | 858 | if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { |
859 | pal = getPalette(); | 859 | pal = getPalette(); |
860 | if (cat.isEmpty()) { | 860 | if (cat.isEmpty()) { |
861 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); | 861 | //pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); |
862 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); | 862 | pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->defaultColor( todo->calID() )); |
863 | } else { | 863 | } else { |
864 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); | 864 | pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); |
865 | } | 865 | } |
866 | 866 | ||
867 | } else { | 867 | } else { |
868 | if (cat.isEmpty()) { | 868 | if (cat.isEmpty()) { |
869 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); | 869 | //pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); |
870 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); | 870 | pal = QPalette(KOPrefs::instance()->defaultColor( todo->calID() ), KOPrefs::instance()->defaultColor( todo->calID() )); |
871 | } else { | 871 | } else { |
872 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); | 872 | pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); |
873 | } | 873 | } |
874 | } | 874 | } |
875 | 875 | ||
876 | } else { | 876 | } else { |
877 | pal = mStandardPalette ; | 877 | pal = mStandardPalette ; |
878 | } | 878 | } |
879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); | 879 | pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); |
880 | item->setPalette( pal ); | 880 | item->setPalette( pal ); |
881 | item->setRecur( todo->recurrence()->doesRecur() ); | 881 | item->setRecur( todo->doesRecur() ); |
882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); | 882 | item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); |
883 | item->setMoreInfo( todo->description().length() > 0 ); | 883 | item->setMoreInfo( todo->description().length() > 0 ); |
884 | insertItem( item , count()); | 884 | insertItem( item , count()); |
885 | #ifdef DESKTOP_VERSION | 885 | #ifdef DESKTOP_VERSION |
886 | mToolTip.append( text ); | 886 | mToolTip.append( text ); |
887 | #endif | 887 | #endif |
888 | } | 888 | } |
889 | void MonthViewCell::repaintfinishUpdateCell() | 889 | void MonthViewCell::repaintfinishUpdateCell() |
890 | { | 890 | { |
891 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 891 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
892 | while ( mitem ) { | 892 | while ( mitem ) { |
893 | mitem->setBlockRepaint( false ); | 893 | mitem->setBlockRepaint( false ); |
894 | updateItem ( mitem ); | 894 | updateItem ( mitem ); |
895 | mitem = (MonthViewItem *)mitem->next(); | 895 | mitem = (MonthViewItem *)mitem->next(); |
896 | } | 896 | } |
897 | blockSignals( false ); | 897 | blockSignals( false ); |
898 | } | 898 | } |
899 | void MonthViewCell::finishUpdateCell() | 899 | void MonthViewCell::finishUpdateCell() |
900 | { | 900 | { |
901 | 901 | ||
902 | 902 | ||
903 | 903 | ||
904 | #ifdef DESKTOP_VERSION | 904 | #ifdef DESKTOP_VERSION |
905 | if (mToolTip.count() > 0 ) { | 905 | if (mToolTip.count() > 0 ) { |
906 | mToolTip.sort(); | 906 | mToolTip.sort(); |
907 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); | 907 | QToolTip::add(this,mToolTip.join("\n"),toolTipGroup(),""); |
908 | } | 908 | } |
909 | #endif | 909 | #endif |
910 | //sort(); | 910 | //sort(); |
911 | //setMyPalette(); | 911 | //setMyPalette(); |
912 | setMyPalette(); | 912 | setMyPalette(); |
913 | 913 | ||
914 | resizeEvent( 0 ); | 914 | resizeEvent( 0 ); |
915 | 915 | ||
916 | } | 916 | } |
917 | void MonthViewCell::updateCell() | 917 | void MonthViewCell::updateCell() |
918 | { | 918 | { |
919 | if ( !mMonthView->isUpdatePossible() ) | 919 | if ( !mMonthView->isUpdatePossible() ) |
920 | return; | 920 | return; |
921 | startUpdateCell(); | 921 | startUpdateCell(); |
922 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 922 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
923 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); | 923 | QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); |
924 | Event *event; | 924 | Event *event; |
925 | for( event = events.first(); event; event = events.next() ) { // for event | 925 | for( event = events.first(); event; event = events.next() ) { // for event |
926 | insertEvent(event); | 926 | insertEvent(event); |
927 | } | 927 | } |
928 | // insert due todos | 928 | // insert due todos |
929 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); | 929 | QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); |
930 | Todo *todo; | 930 | Todo *todo; |
931 | for(todo = todos.first(); todo; todo = todos.next()) { | 931 | for(todo = todos.first(); todo; todo = todos.next()) { |
932 | insertTodo( todo ); | 932 | insertTodo( todo ); |
933 | } | 933 | } |
934 | finishUpdateCell(); | 934 | finishUpdateCell(); |
935 | // if ( isVisible()) | 935 | // if ( isVisible()) |
936 | //qApp->processEvents(); | 936 | //qApp->processEvents(); |
937 | } | 937 | } |
938 | 938 | ||
939 | void MonthViewCell::updateConfig( bool bigFont ) // = false | 939 | void MonthViewCell::updateConfig( bool bigFont ) // = false |
940 | { | 940 | { |
941 | 941 | ||
942 | if ( bigFont ) { | 942 | if ( bigFont ) { |
943 | QFont fo = KOPrefs::instance()->mMonthViewFont; | 943 | QFont fo = KOPrefs::instance()->mMonthViewFont; |
944 | int ps = fo.pointSize() + 2; | 944 | int ps = fo.pointSize() + 2; |
945 | if ( ps < 18 ) | 945 | if ( ps < 18 ) |
@@ -1044,128 +1044,130 @@ void MonthViewCell::resizeEvent ( QResizeEvent * e ) | |||
1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; | 1044 | bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; |
1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { | 1045 | if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { |
1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); | 1046 | text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " " + QString::number( mDate.day() ); |
1047 | mLabel->resize( mLabelBigSize ); | 1047 | mLabel->resize( mLabelBigSize ); |
1048 | } else { | 1048 | } else { |
1049 | mLabel->resize( mLabelSize ); | 1049 | mLabel->resize( mLabelSize ); |
1050 | text = QString::number( mDate.day() ); | 1050 | text = QString::number( mDate.day() ); |
1051 | } | 1051 | } |
1052 | mLabel->setText( text ); | 1052 | mLabel->setText( text ); |
1053 | 1053 | ||
1054 | int size = height() - mLabel->height() - lineWidth()-1; | 1054 | int size = height() - mLabel->height() - lineWidth()-1; |
1055 | //qDebug("LW %d ", lineWidth()); | 1055 | //qDebug("LW %d ", lineWidth()); |
1056 | if ( size > 0 ) | 1056 | if ( size > 0 ) |
1057 | verticalScrollBar()->setMaximumHeight( size ); | 1057 | verticalScrollBar()->setMaximumHeight( size ); |
1058 | size = width() - mLabel->width() -lineWidth()-1; | 1058 | size = width() - mLabel->width() -lineWidth()-1; |
1059 | if ( size > 0 ) | 1059 | if ( size > 0 ) |
1060 | horizontalScrollBar()->setMaximumWidth( size ); | 1060 | horizontalScrollBar()->setMaximumWidth( size ); |
1061 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); | 1061 | mLabel->move( width()-lineWidth() - mLabel->width(), height()-lineWidth() - mLabel->height() ); |
1062 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); | 1062 | //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); |
1063 | // mItemList->resize ( width(), height () ); | 1063 | // mItemList->resize ( width(), height () ); |
1064 | if ( e ) | 1064 | if ( e ) |
1065 | KNoScrollListBox::resizeEvent ( e ); | 1065 | KNoScrollListBox::resizeEvent ( e ); |
1066 | } | 1066 | } |
1067 | 1067 | ||
1068 | void MonthViewCell::defaultAction( QListBoxItem *item ) | 1068 | void MonthViewCell::defaultAction( QListBoxItem *item ) |
1069 | { | 1069 | { |
1070 | 1070 | ||
1071 | if ( !item ) { | 1071 | if ( !item ) { |
1072 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1072 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1073 | emit newEventSignal( dt ); | 1073 | emit newEventSignal( dt ); |
1074 | return; | 1074 | return; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1077 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1078 | Incidence *incidence = eventItem->incidence(); | 1078 | Incidence *incidence = eventItem->incidence(); |
1079 | if ( incidence ) mMonthView->defaultAction( incidence ); | 1079 | if ( incidence ) mMonthView->defaultAction( incidence ); |
1080 | } | 1080 | } |
1081 | void MonthViewCell::showDay() | 1081 | void MonthViewCell::showDay() |
1082 | { | 1082 | { |
1083 | emit showDaySignal( date() ); | 1083 | emit showDaySignal( date() ); |
1084 | } | 1084 | } |
1085 | void MonthViewCell::newEvent() | 1085 | void MonthViewCell::newEvent() |
1086 | { | 1086 | { |
1087 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1087 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1088 | emit newEventSignal( dt ); | 1088 | emit newEventSignal( dt ); |
1089 | } | 1089 | } |
1090 | void MonthViewCell::cellClicked( QListBoxItem *item ) | 1090 | void MonthViewCell::cellClicked( QListBoxItem *item ) |
1091 | { | 1091 | { |
1092 | mMonthView->setSelectedCell( this ); | 1092 | mMonthView->setSelectedCell( this ); |
1093 | if ( item == 0 ) { | 1093 | if ( item == 0 ) { |
1094 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); | 1094 | QDateTime dt( date(), QTime( KOPrefs::instance()->mStartTime, 0 ) ); |
1095 | emit newEventSignal( dt ); | 1095 | emit newEventSignal( dt ); |
1096 | return; | 1096 | return; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | } | 1099 | } |
1100 | 1100 | ||
1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) | 1101 | void MonthViewCell::contextMenu( QListBoxItem *item ) |
1102 | { | 1102 | { |
1103 | mMonthView->setPopupCell( this ); | 1103 | mMonthView->setPopupCell( this ); |
1104 | if ( !item ) { | 1104 | if ( !item ) { |
1105 | mMonthView->showContextMenu( 0 ); | 1105 | mMonthView->showContextMenu( 0 ); |
1106 | return; | 1106 | return; |
1107 | } | 1107 | } |
1108 | //selection( item ); | ||
1109 | //qApp->processEvents(); | ||
1108 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); | 1110 | MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); |
1109 | Incidence *incidence = eventItem->incidence(); | 1111 | Incidence *incidence = eventItem->incidence(); |
1110 | if ( incidence ) mMonthView->showContextMenu( incidence ); | 1112 | if ( incidence ) mMonthView->showContextMenu( incidence ); |
1111 | } | 1113 | } |
1112 | 1114 | ||
1113 | void MonthViewCell::selection( QListBoxItem *item ) | 1115 | void MonthViewCell::selection( QListBoxItem *item ) |
1114 | { | 1116 | { |
1115 | if ( !item ) { | 1117 | if ( !item ) { |
1116 | emit highlightIncidence( 0 , this, 0 ); | 1118 | emit highlightIncidence( 0 , this, 0 ); |
1117 | return; | 1119 | return; |
1118 | } | 1120 | } |
1119 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); | 1121 | MonthViewItem * it = (static_cast<MonthViewItem *>( item )); |
1120 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); | 1122 | emit highlightIncidence( it->incidence(), this, it->multiDay() ); |
1121 | mMonthView->setSelectedCell( this ); | 1123 | mMonthView->setSelectedCell( this ); |
1122 | } | 1124 | } |
1123 | 1125 | ||
1124 | void MonthViewCell::deHighLight() | 1126 | void MonthViewCell::deHighLight() |
1125 | { | 1127 | { |
1126 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1128 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1127 | while ( mitem ) { | 1129 | while ( mitem ) { |
1128 | if ( mitem->setHighlightedFalse() ) | 1130 | if ( mitem->setHighlightedFalse() ) |
1129 | updateItem ( mitem ); | 1131 | updateItem ( mitem ); |
1130 | mitem = (MonthViewItem *)mitem->next(); | 1132 | mitem = (MonthViewItem *)mitem->next(); |
1131 | } | 1133 | } |
1132 | } | 1134 | } |
1133 | // returns true if no inc found | 1135 | // returns true if no inc found |
1134 | bool MonthViewCell::doHighLight( Incidence * inc ) | 1136 | bool MonthViewCell::doHighLight( Incidence * inc ) |
1135 | { | 1137 | { |
1136 | 1138 | ||
1137 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); | 1139 | MonthViewItem *mitem = (MonthViewItem*) firstItem (); |
1138 | while ( mitem ) { | 1140 | while ( mitem ) { |
1139 | if ( mitem->incidence() == inc ) { | 1141 | if ( mitem->incidence() == inc ) { |
1140 | if ( mitem->setHighlighted( inc ) ) | 1142 | if ( mitem->setHighlighted( inc ) ) |
1141 | updateItem ( mitem ); | 1143 | updateItem ( mitem ); |
1142 | return false; | 1144 | return false; |
1143 | } | 1145 | } |
1144 | mitem = (MonthViewItem *)mitem->next(); | 1146 | mitem = (MonthViewItem *)mitem->next(); |
1145 | } | 1147 | } |
1146 | return true; | 1148 | return true; |
1147 | } | 1149 | } |
1148 | // ******************************************************************************* | 1150 | // ******************************************************************************* |
1149 | // ******************************************************************************* | 1151 | // ******************************************************************************* |
1150 | // ******************************************************************************* | 1152 | // ******************************************************************************* |
1151 | 1153 | ||
1152 | 1154 | ||
1153 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) | 1155 | KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) |
1154 | : KOEventView( calendar, parent, name ), | 1156 | : KOEventView( calendar, parent, name ), |
1155 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), | 1157 | mDaysPerWeek( 7 ), mNumWeeks( 6 ), mNumCells( mDaysPerWeek * mNumWeeks ), |
1156 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) | 1158 | mWidthLongDayLabel( 0 ), mSelectedCell( 0 ) |
1157 | { | 1159 | { |
1158 | mFlagKeyPressed = false; | 1160 | mFlagKeyPressed = false; |
1159 | mShortDayLabelsM = false; | 1161 | mShortDayLabelsM = false; |
1160 | mShortDayLabelsW = false; | 1162 | mShortDayLabelsW = false; |
1161 | skipResize = false; | 1163 | skipResize = false; |
1162 | clPending = true; | 1164 | clPending = true; |
1163 | mPopupCell = 0; | 1165 | mPopupCell = 0; |
1164 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); | 1166 | mNavigatorBar = new NavigatorBar( QDate::currentDate(), this, "useBigPixmaps" ); |
1165 | mWidStack = new QWidgetStack( this ); | 1167 | mWidStack = new QWidgetStack( this ); |
1166 | QVBoxLayout* hb = new QVBoxLayout( this ); | 1168 | QVBoxLayout* hb = new QVBoxLayout( this ); |
1167 | mMonthView = new QWidget( mWidStack ); | 1169 | mMonthView = new QWidget( mWidStack ); |
1168 | mWeekView = new QWidget( mWidStack ); | 1170 | mWeekView = new QWidget( mWidStack ); |
1169 | #if QT_VERSION >= 0x030000 | 1171 | #if QT_VERSION >= 0x030000 |
1170 | mWidStack->addWidget(mMonthView ); | 1172 | mWidStack->addWidget(mMonthView ); |
1171 | mWidStack->addWidget(mWeekView ); | 1173 | mWidStack->addWidget(mWeekView ); |
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 100a81b..682f83b 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp | |||
@@ -316,129 +316,130 @@ void KOTodoEditor::setDefaults(QDateTime due,Todo *relatedEvent,bool allDay) | |||
316 | } | 316 | } |
317 | void KOTodoEditor::checkRecurrence() | 317 | void KOTodoEditor::checkRecurrence() |
318 | { | 318 | { |
319 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | 319 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { |
320 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); | 320 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), true ); |
321 | 321 | ||
322 | if ( mTodo ) | 322 | if ( mTodo ) |
323 | mRecurrence->readEvent( mTodo ); | 323 | mRecurrence->readEvent( mTodo ); |
324 | else { | 324 | else { |
325 | bool time = mGeneral->mTimeButton->isChecked(); | 325 | bool time = mGeneral->mTimeButton->isChecked(); |
326 | QDateTime from,to; | 326 | QDateTime from,to; |
327 | if ( time ) { | 327 | if ( time ) { |
328 | to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; | 328 | to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ; |
329 | from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; | 329 | from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ; |
330 | } else { | 330 | } else { |
331 | to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; | 331 | to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ; |
332 | from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; | 332 | from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ; |
333 | } | 333 | } |
334 | if ( to < from ) | 334 | if ( to < from ) |
335 | to = from; | 335 | to = from; |
336 | mRecurrence->setDefaults(from,to); | 336 | mRecurrence->setDefaults(from,to); |
337 | } | 337 | } |
338 | } else { | 338 | } else { |
339 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); | 339 | tabWidget()->setTabEnabled ( mRecurrence->parentWidget(), false ); |
340 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); | 340 | mRecurrence->setDefaults(QDateTime::currentDateTime(),QDateTime::currentDateTime().addSecs( 3600 )); |
341 | } | 341 | } |
342 | } | 342 | } |
343 | void KOTodoEditor::readTodo(Todo *todo) | 343 | void KOTodoEditor::readTodo(Todo *todo) |
344 | { | 344 | { |
345 | mGeneral->readTodo(todo); | 345 | mGeneral->readTodo(todo); |
346 | mDetails->readEvent(todo); | 346 | mDetails->readEvent(todo); |
347 | mRelatedTodo = 0;//todo->relatedTo(); | 347 | mRelatedTodo = 0;//todo->relatedTo(); |
348 | // categories | 348 | // categories |
349 | // mCategoryDialog->setSelected(todo->categories()); | 349 | // mCategoryDialog->setSelected(todo->categories()); |
350 | 350 | ||
351 | // We should handle read-only events here. | 351 | // We should handle read-only events here. |
352 | } | 352 | } |
353 | 353 | ||
354 | void KOTodoEditor::writeTodo(Todo *event) | 354 | void KOTodoEditor::writeTodo(Todo *event) |
355 | { | 355 | { |
356 | bool maybeComputeRecurrenceTime = false; | 356 | bool maybeComputeRecurrenceTime = false; |
357 | if( event->hasRecurrenceID() && event->percentComplete() < 100) | 357 | if( event->hasRecurrenceID() && event->percentComplete() < 100) |
358 | maybeComputeRecurrenceTime = true; | 358 | maybeComputeRecurrenceTime = true; |
359 | event->setHasRecurrenceID( false ); | 359 | event->setHasRecurrenceID( false ); |
360 | mGeneral->writeTodo(event); | 360 | mGeneral->writeTodo(event); |
361 | mDetails->writeEvent(event); | 361 | mDetails->writeEvent(event); |
362 | 362 | ||
363 | // set related event, i.e. parent to-do in this case. | 363 | // set related event, i.e. parent to-do in this case. |
364 | if (mRelatedTodo) { | 364 | if (mRelatedTodo) { |
365 | event->setRelatedTo(mRelatedTodo); | 365 | event->setRelatedTo(mRelatedTodo); |
366 | } | 366 | } |
367 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { | 367 | if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { |
368 | mRecurrence->writeEvent(event); | 368 | mRecurrence->writeEvent(event); |
369 | if ( event->doesRecur() ) { | 369 | if ( event->doesRecur() ) { |
370 | int addSec = -1 ; | 370 | int addSec = -1 ; |
371 | if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) | 371 | if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 ) |
372 | addSec = 1; | 372 | addSec = 1; |
373 | event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); | 373 | event->setRecurrenceID( event->dtStart().addSecs( addSec ) ); |
374 | event->setRecurDates(); | 374 | event->setRecurDates(); |
375 | } else { | 375 | } else { |
376 | event->setHasRecurrenceID( false ); | 376 | event->setHasRecurrenceID( false ); |
377 | } | 377 | } |
378 | } else { | 378 | } else { |
379 | event->setHasRecurrenceID( false ); | 379 | event->setHasRecurrenceID( false ); |
380 | event->recurrence()->unsetRecurs(); | 380 | if ( event->doesRecur() ) |
381 | event->recurrence()->unsetRecurs(); | ||
381 | } | 382 | } |
382 | } | 383 | } |
383 | 384 | ||
384 | bool KOTodoEditor::validateInput() | 385 | bool KOTodoEditor::validateInput() |
385 | { | 386 | { |
386 | if (!mGeneral->validateInput()) return false; | 387 | if (!mGeneral->validateInput()) return false; |
387 | if (!mDetails->validateInput()) return false; | 388 | if (!mDetails->validateInput()) return false; |
388 | return true; | 389 | return true; |
389 | } | 390 | } |
390 | 391 | ||
391 | int KOTodoEditor::msgItemDelete() | 392 | int KOTodoEditor::msgItemDelete() |
392 | { | 393 | { |
393 | return KMessageBox::warningContinueCancel(this, | 394 | return KMessageBox::warningContinueCancel(this, |
394 | i18n("This item will be permanently deleted."), | 395 | i18n("This item will be permanently deleted."), |
395 | i18n("KOrganizer Confirmation"),i18n("Delete")); | 396 | i18n("KOrganizer Confirmation"),i18n("Delete")); |
396 | } | 397 | } |
397 | 398 | ||
398 | void KOTodoEditor::modified (int modification) | 399 | void KOTodoEditor::modified (int modification) |
399 | { | 400 | { |
400 | if (modification == KOGlobals::CATEGORY_MODIFIED || | 401 | if (modification == KOGlobals::CATEGORY_MODIFIED || |
401 | KOGlobals::UNKNOWN_MODIFIED == modification ) | 402 | KOGlobals::UNKNOWN_MODIFIED == modification ) |
402 | // mCategoryDialog->setSelected (mTodo->categories ()); | 403 | // mCategoryDialog->setSelected (mTodo->categories ()); |
403 | mGeneral->modified (mTodo, modification); | 404 | mGeneral->modified (mTodo, modification); |
404 | 405 | ||
405 | } | 406 | } |
406 | 407 | ||
407 | void KOTodoEditor::slotLoadTemplate() | 408 | void KOTodoEditor::slotLoadTemplate() |
408 | { | 409 | { |
409 | 410 | ||
410 | QString fileName =locateLocal( "templates", "todos" ); | 411 | QString fileName =locateLocal( "templates", "todos" ); |
411 | QDir t_dir; | 412 | QDir t_dir; |
412 | if ( !t_dir.exists(fileName) ) | 413 | if ( !t_dir.exists(fileName) ) |
413 | t_dir.mkdir ( fileName ); | 414 | t_dir.mkdir ( fileName ); |
414 | fileName += "/todo"; | 415 | fileName += "/todo"; |
415 | fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); | 416 | fileName = KFileDialog::getSaveFileName( fileName , "Load Todo template", this ); |
416 | if ( fileName.length() == 0 ) | 417 | if ( fileName.length() == 0 ) |
417 | return; | 418 | return; |
418 | CalendarLocal cal; | 419 | CalendarLocal cal; |
419 | ICalFormat format; | 420 | ICalFormat format; |
420 | if ( !format.load( &cal, fileName ) ) { | 421 | if ( !format.load( &cal, fileName ) ) { |
421 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") | 422 | KMessageBox::error( this, i18n("Error loading template file\n '%1'.") |
422 | .arg( fileName ) ); | 423 | .arg( fileName ) ); |
423 | return ; | 424 | return ; |
424 | } | 425 | } |
425 | QPtrList<Todo> todos = cal.todos(); | 426 | QPtrList<Todo> todos = cal.todos(); |
426 | Todo * todo = todos.first(); | 427 | Todo * todo = todos.first(); |
427 | if ( !todo ) { | 428 | if ( !todo ) { |
428 | KMessageBox::error( this, | 429 | KMessageBox::error( this, |
429 | i18n("Template does not\ncontain a valid Todo.")); | 430 | i18n("Template does not\ncontain a valid Todo.")); |
430 | } else { | 431 | } else { |
431 | readTodo( todo ); | 432 | readTodo( todo ); |
432 | } | 433 | } |
433 | 434 | ||
434 | } | 435 | } |
435 | 436 | ||
436 | void KOTodoEditor::slotSaveTemplate() | 437 | void KOTodoEditor::slotSaveTemplate() |
437 | { | 438 | { |
438 | QString fileName =locateLocal( "templates", "todos" ); | 439 | QString fileName =locateLocal( "templates", "todos" ); |
439 | QDir t_dir; | 440 | QDir t_dir; |
440 | if ( !t_dir.exists(fileName) ) | 441 | if ( !t_dir.exists(fileName) ) |
441 | t_dir.mkdir ( fileName ); | 442 | t_dir.mkdir ( fileName ); |
442 | fileName += "/todo"; | 443 | fileName += "/todo"; |
443 | fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); | 444 | fileName = KFileDialog::getSaveFileName( fileName , "Save as Todo template", this ); |
444 | if ( fileName.length() > 0 ) | 445 | if ( fileName.length() > 0 ) |
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index fafcb58..f88403c 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -446,244 +446,244 @@ void KOWhatsNextView::appendDay( int i, QDate eventDate ) | |||
446 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 446 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
447 | mText += "<table>\n"; | 447 | mText += "<table>\n"; |
448 | } | 448 | } |
449 | } | 449 | } |
450 | 450 | ||
451 | 451 | ||
452 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 452 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
453 | { | 453 | { |
454 | updateView(); | 454 | updateView(); |
455 | } | 455 | } |
456 | 456 | ||
457 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 457 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
458 | { | 458 | { |
459 | } | 459 | } |
460 | 460 | ||
461 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 461 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
462 | { | 462 | { |
463 | switch(action) { | 463 | switch(action) { |
464 | case KOGlobals::EVENTADDED: | 464 | case KOGlobals::EVENTADDED: |
465 | updateView(); | 465 | updateView(); |
466 | break; | 466 | break; |
467 | case KOGlobals::EVENTEDITED: | 467 | case KOGlobals::EVENTEDITED: |
468 | updateView(); | 468 | updateView(); |
469 | break; | 469 | break; |
470 | case KOGlobals::EVENTDELETED: | 470 | case KOGlobals::EVENTDELETED: |
471 | updateView(); | 471 | updateView(); |
472 | break; | 472 | break; |
473 | default: | 473 | default: |
474 | updateView(); | 474 | updateView(); |
475 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 475 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 | ||
479 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) | 479 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) |
480 | { | 480 | { |
481 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 481 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
482 | return false; | 482 | return false; |
483 | QDateTime cdt = QDateTime::currentDateTime(); | 483 | QDateTime cdt = QDateTime::currentDateTime(); |
484 | QDateTime noc; | 484 | QDateTime noc; |
485 | QString tempText; | 485 | QString tempText; |
486 | if ( appendTable && !notRed ) { | 486 | if ( appendTable && !notRed ) { |
487 | tempText = "<table>"; | 487 | tempText = "<table>"; |
488 | } | 488 | } |
489 | bool ok = true; | 489 | bool ok = true; |
490 | if ( reply ) { | 490 | if ( reply ) { |
491 | noc = ev->getNextOccurence( cdt, &ok ); | 491 | noc = ev->getNextOccurence( cdt, &ok ); |
492 | if (! ok && ev->typeID() == eventID) | 492 | if (! ok && ev->typeID() == eventID) |
493 | return false; | 493 | return false; |
494 | } | 494 | } |
495 | bool bDay = false; | 495 | bool bDay = false; |
496 | if ( ev->isBirthday() || ev->isAnniversary() ) | 496 | if ( ev->isBirthday() || ev->isAnniversary() ) |
497 | bDay = true; | 497 | bDay = true; |
498 | tempText += "<tr><td><b>"; | 498 | tempText += "<tr><td><b>"; |
499 | if (ev->typeID() == eventID ) { | 499 | if (ev->typeID() == eventID ) { |
500 | if (reply) { | 500 | if (reply) { |
501 | if (!ev->doesFloat()) | 501 | if (!ev->doesFloat()) |
502 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 502 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
503 | else | 503 | else |
504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 504 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
505 | 505 | ||
506 | } else { | 506 | } else { |
507 | if (!ev->doesFloat()) { | 507 | if (!ev->doesFloat()) { |
508 | Event *event = static_cast<Event *>(ev); | 508 | Event *event = static_cast<Event *>(ev); |
509 | QDateTime st,end; | 509 | QDateTime st,end; |
510 | if ( event->recurrence()->doesRecur() ) { | 510 | if ( event->doesRecur() ) { |
511 | QDate recDate= mEventDate; | 511 | QDate recDate= mEventDate; |
512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 512 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
513 | while ( ! event->recursOn( recDate ) ) { | 513 | while ( ! event->recursOn( recDate ) ) { |
514 | recDate = recDate.addDays( -1 ); | 514 | recDate = recDate.addDays( -1 ); |
515 | 515 | ||
516 | } | 516 | } |
517 | st = QDateTime ( recDate, event->dtStart().time() ); | 517 | st = QDateTime ( recDate, event->dtStart().time() ); |
518 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 518 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
519 | } | 519 | } |
520 | else { | 520 | else { |
521 | st = event->dtStart(); | 521 | st = event->dtStart(); |
522 | end = event->dtEnd(); | 522 | end = event->dtEnd(); |
523 | } | 523 | } |
524 | 524 | ||
525 | 525 | ||
526 | QString dateText; | 526 | QString dateText; |
527 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 527 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
528 | if ( st.date() < mEventDate ) | 528 | if ( st.date() < mEventDate ) |
529 | dateText = "++:++-"; | 529 | dateText = "++:++-"; |
530 | else | 530 | else |
531 | dateText = event->dtStartTimeStr() + "-"; | 531 | dateText = event->dtStartTimeStr() + "-"; |
532 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) | 532 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) |
533 | dateText += " "; | 533 | dateText += " "; |
534 | if ( end.date() > mEventDate ) | 534 | if ( end.date() > mEventDate ) |
535 | dateText += "++:++"; | 535 | dateText += "++:++"; |
536 | else | 536 | else |
537 | dateText += event->dtEndTimeStr(); | 537 | dateText += event->dtEndTimeStr(); |
538 | if ( notRed ) | 538 | if ( notRed ) |
539 | tempText += dateText; | 539 | tempText += dateText; |
540 | else { | 540 | else { |
541 | if ( end < cdt ) { | 541 | if ( end < cdt ) { |
542 | if ( !KOPrefs::instance()->mWNViewShowsPast ) | 542 | if ( !KOPrefs::instance()->mWNViewShowsPast ) |
543 | return false; | 543 | return false; |
544 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; | 544 | tempText += "<font color=\"#F00000\">" + dateText + "</font>"; |
545 | } | 545 | } |
546 | else if ( st < cdt ) | 546 | else if ( st < cdt ) |
547 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; | 547 | tempText += "<font color=\"#008000\">" + dateText + "</font>"; |
548 | else | 548 | else |
549 | tempText += dateText; | 549 | tempText += dateText; |
550 | 550 | ||
551 | } | 551 | } |
552 | 552 | ||
553 | } else { | 553 | } else { |
554 | if ( bDay ) { | 554 | if ( bDay ) { |
555 | 555 | ||
556 | if ( ev->isBirthday()) | 556 | if ( ev->isBirthday()) |
557 | tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; | 557 | tempText += "<font color=\"#00B000\">" + i18n("Birthday") +":</font>"; |
558 | else | 558 | else |
559 | tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; | 559 | tempText += "<font color=\"#00B0000\">" + i18n("Anniversary")+":</font>"; |
560 | } else { | 560 | } else { |
561 | if ( ((Event*)ev)->isMultiDay() ) { | 561 | if ( ((Event*)ev)->isMultiDay() ) { |
562 | QString dfs = KGlobal::locale()->dateFormatShort(); | 562 | QString dfs = KGlobal::locale()->dateFormatShort(); |
563 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 563 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
564 | tempText +=KGlobal::locale()->formatDate(((Event*)ev)->dtStart().date(), true, KLocale::Userdefined) + "-"; | 564 | tempText +=KGlobal::locale()->formatDate(((Event*)ev)->dtStart().date(), true, KLocale::Userdefined) + "-"; |
565 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) | 565 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) |
566 | tempText += " "; | 566 | tempText += " "; |
567 | tempText +=KGlobal::locale()->formatDate(((Event*)ev)->dtEnd().date(), true, KLocale::Userdefined); | 567 | tempText +=KGlobal::locale()->formatDate(((Event*)ev)->dtEnd().date(), true, KLocale::Userdefined); |
568 | KGlobal::locale()->setDateFormatShort(dfs); | 568 | KGlobal::locale()->setDateFormatShort(dfs); |
569 | } else { | 569 | } else { |
570 | tempText += " " ;//i18n("Allday:"); | 570 | tempText += " " ;//i18n("Allday:"); |
571 | } | 571 | } |
572 | } | 572 | } |
573 | 573 | ||
574 | } | 574 | } |
575 | } | 575 | } |
576 | } else { | 576 | } else { |
577 | mTodos.append( ev ); | 577 | mTodos.append( ev ); |
578 | tempText += i18n("ToDo:"); | 578 | tempText += i18n("ToDo:"); |
579 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) | 579 | if ( KOPrefs::instance()->mWhatsNextTime2Lines ) |
580 | tempText += " "; | 580 | tempText += " "; |
581 | if (reply) { | 581 | if (reply) { |
582 | tempText += " "; | 582 | tempText += " "; |
583 | if ( noc != cdt ) { | 583 | if ( noc != cdt ) { |
584 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 584 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
585 | } | 585 | } |
586 | } else { | 586 | } else { |
587 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { | 587 | if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { |
588 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 588 | // tempText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
589 | QString dfs = KGlobal::locale()->dateFormatShort(); | 589 | QString dfs = KGlobal::locale()->dateFormatShort(); |
590 | KGlobal::locale()->setDateFormatShort("%d.%b"); | 590 | KGlobal::locale()->setDateFormatShort("%d.%b"); |
591 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; | 591 | tempText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; |
592 | KGlobal::locale()->setDateFormatShort(dfs); | 592 | KGlobal::locale()->setDateFormatShort(dfs); |
593 | } else { | 593 | } else { |
594 | if (!ev->doesFloat() ) | 594 | if (!ev->doesFloat() ) |
595 | if( ( (Todo*)ev)->dtDue() < cdt ) { | 595 | if( ( (Todo*)ev)->dtDue() < cdt ) { |
596 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; | 596 | tempText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; |
597 | 597 | ||
598 | 598 | ||
599 | } else | 599 | } else |
600 | tempText +=((Todo*)ev)->dtDueTimeStr(); | 600 | tempText +=((Todo*)ev)->dtDueTimeStr(); |
601 | mTodos.append( ev ); | 601 | mTodos.append( ev ); |
602 | } | 602 | } |
603 | } | 603 | } |
604 | } | 604 | } |
605 | tempText += "</b></td><td>"; | 605 | tempText += "</b></td><td>"; |
606 | bool needClose = false; | 606 | bool needClose = false; |
607 | if ( ev->cancelled() ) { | 607 | if ( ev->cancelled() ) { |
608 | tempText += "<font color=\"#F00000\">[c"; | 608 | tempText += "<font color=\"#F00000\">[c"; |
609 | needClose =true; | 609 | needClose =true; |
610 | 610 | ||
611 | } | 611 | } |
612 | if ( ev->isAlarmEnabled() && ev->alarmEnabled()) { | 612 | if ( ev->isAlarmEnabled() && ev->alarmEnabled()) { |
613 | if ( !needClose) | 613 | if ( !needClose) |
614 | tempText +="["; | 614 | tempText +="["; |
615 | tempText += "a"; | 615 | tempText += "a"; |
616 | needClose =true; | 616 | needClose =true; |
617 | 617 | ||
618 | } | 618 | } |
619 | if ( ev->description().length() > 0 ) { | 619 | if ( ev->description().length() > 0 ) { |
620 | if ( !needClose) | 620 | if ( !needClose) |
621 | tempText +="["; | 621 | tempText +="["; |
622 | tempText += "i"; | 622 | tempText += "i"; |
623 | needClose =true; | 623 | needClose =true; |
624 | } | 624 | } |
625 | if ( ev->recurrence()->doesRecur() ) { | 625 | if ( ev->doesRecur() ) { |
626 | if ( !needClose) | 626 | if ( !needClose) |
627 | tempText +="["; | 627 | tempText +="["; |
628 | tempText += "r"; | 628 | tempText += "r"; |
629 | needClose =true; | 629 | needClose =true; |
630 | } | 630 | } |
631 | if ( needClose ) { | 631 | if ( needClose ) { |
632 | tempText += "] "; | 632 | tempText += "] "; |
633 | } | 633 | } |
634 | if ( ev->cancelled() ) | 634 | if ( ev->cancelled() ) |
635 | tempText += "</font>"; | 635 | tempText += "</font>"; |
636 | tempText += "<a "; | 636 | tempText += "<a "; |
637 | if (ev->typeID() == eventID ) tempText += "href=\"event:"; | 637 | if (ev->typeID() == eventID ) tempText += "href=\"event:"; |
638 | if (ev->typeID() == todoID ) tempText += "href=\"todo:"; | 638 | if (ev->typeID() == todoID ) tempText += "href=\"todo:"; |
639 | tempText += ev->uid() + "\">"; | 639 | tempText += ev->uid() + "\">"; |
640 | if ( ev->summary().length() > 0 ) | 640 | if ( ev->summary().length() > 0 ) |
641 | tempText += ev->summary(); | 641 | tempText += ev->summary(); |
642 | else | 642 | else |
643 | tempText += i18n("-no summary-"); | 643 | tempText += i18n("-no summary-"); |
644 | if ( bDay ) { | 644 | if ( bDay ) { |
645 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); | 645 | noc = ev->getNextOccurence( cdt.addDays(-1), &ok ); |
646 | if ( ok ) { | 646 | if ( ok ) { |
647 | int years = 0; | 647 | int years = 0; |
648 | if ( ev->typeID() == todoID ) { | 648 | if ( ev->typeID() == todoID ) { |
649 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); | 649 | years = noc.date().year() -((Todo*)ev)->dtDue().date().year(); |
650 | } else | 650 | } else |
651 | years = noc.date().year() - ev->dtStart().date().year(); | 651 | years = noc.date().year() - ev->dtStart().date().year(); |
652 | tempText += i18n(" (%1 y.)"). arg( years ); | 652 | tempText += i18n(" (%1 y.)"). arg( years ); |
653 | } | 653 | } |
654 | } | 654 | } |
655 | 655 | ||
656 | tempText += "</a>"; | 656 | tempText += "</a>"; |
657 | if ( KOPrefs::instance()->mWNViewShowLocation ) | 657 | if ( KOPrefs::instance()->mWNViewShowLocation ) |
658 | if ( !ev->location().isEmpty() ) | 658 | if ( !ev->location().isEmpty() ) |
659 | tempText += " ("+ev->location() +")"; | 659 | tempText += " ("+ev->location() +")"; |
660 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) | 660 | if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) |
661 | tempText += " ["+ev->relatedTo()->summary() +"]"; | 661 | tempText += " ["+ev->relatedTo()->summary() +"]"; |
662 | tempText += "</td></tr>\n"; | 662 | tempText += "</td></tr>\n"; |
663 | mText += tempText; | 663 | mText += tempText; |
664 | return true; | 664 | return true; |
665 | } | 665 | } |
666 | 666 | ||
667 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) | 667 | bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) |
668 | { | 668 | { |
669 | if ( mTodos.find( ev ) != mTodos.end() ) return false; | 669 | if ( mTodos.find( ev ) != mTodos.end() ) return false; |
670 | 670 | ||
671 | mTodos.append( ev ); | 671 | mTodos.append( ev ); |
672 | if ( !isSub ) | 672 | if ( !isSub ) |
673 | mText += "<p>"; | 673 | mText += "<p>"; |
674 | else | 674 | else |
675 | mText += "<li>"; | 675 | mText += "<li>"; |
676 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; | 676 | mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; |
677 | 677 | ||
678 | 678 | ||
679 | mText += ind; | 679 | mText += ind; |
680 | bool needClose = false; | 680 | bool needClose = false; |
681 | if ( ev->cancelled() ) { | 681 | if ( ev->cancelled() ) { |
682 | mText += "<font color=\"#F00000\">[c"; | 682 | mText += "<font color=\"#F00000\">[c"; |
683 | needClose =true; | 683 | needClose =true; |
684 | 684 | ||
685 | } | 685 | } |
686 | if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) { | 686 | if ( ev->isAlarmEnabled() && ev->alarmEnabled() ) { |
687 | if ( !needClose) | 687 | if ( !needClose) |
688 | mText +="["; | 688 | mText +="["; |
689 | mText += "a"; | 689 | mText += "a"; |
diff --git a/libkcal/event.cpp b/libkcal/event.cpp index ad66639..0766fd9 100644 --- a/libkcal/event.cpp +++ b/libkcal/event.cpp | |||
@@ -112,128 +112,129 @@ void Event::setDtEnd(const QDateTime &dtEnd) | |||
112 | setHasEndDate(true); | 112 | setHasEndDate(true); |
113 | setHasDuration(false); | 113 | setHasDuration(false); |
114 | 114 | ||
115 | updated(); | 115 | updated(); |
116 | } | 116 | } |
117 | 117 | ||
118 | QDateTime Event::dtEnd() const | 118 | QDateTime Event::dtEnd() const |
119 | { | 119 | { |
120 | if (hasEndDate()) return mDtEnd; | 120 | if (hasEndDate()) return mDtEnd; |
121 | if (hasDuration()) return dtStart().addSecs(duration()); | 121 | if (hasDuration()) return dtStart().addSecs(duration()); |
122 | 122 | ||
123 | return dtStart(); | 123 | return dtStart(); |
124 | } | 124 | } |
125 | 125 | ||
126 | QString Event::dtEndTimeStr() const | 126 | QString Event::dtEndTimeStr() const |
127 | { | 127 | { |
128 | return KGlobal::locale()->formatTime(mDtEnd.time()); | 128 | return KGlobal::locale()->formatTime(mDtEnd.time()); |
129 | } | 129 | } |
130 | 130 | ||
131 | QString Event::dtEndDateStr(bool shortfmt) const | 131 | QString Event::dtEndDateStr(bool shortfmt) const |
132 | { | 132 | { |
133 | return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); | 133 | return KGlobal::locale()->formatDate(mDtEnd.date(),shortfmt); |
134 | } | 134 | } |
135 | 135 | ||
136 | QString Event::dtEndStr(bool shortfmt) const | 136 | QString Event::dtEndStr(bool shortfmt) const |
137 | { | 137 | { |
138 | return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); | 138 | return KGlobal::locale()->formatDateTime(mDtEnd, shortfmt); |
139 | } | 139 | } |
140 | 140 | ||
141 | void Event::setHasEndDate(bool b) | 141 | void Event::setHasEndDate(bool b) |
142 | { | 142 | { |
143 | mHasEndDate = b; | 143 | mHasEndDate = b; |
144 | } | 144 | } |
145 | 145 | ||
146 | bool Event::hasEndDate() const | 146 | bool Event::hasEndDate() const |
147 | { | 147 | { |
148 | return mHasEndDate; | 148 | return mHasEndDate; |
149 | } | 149 | } |
150 | 150 | ||
151 | bool Event::isMultiDay() const | 151 | bool Event::isMultiDay() const |
152 | { | 152 | { |
153 | bool multi = !(dtStart().date() == dtEnd().date()); | 153 | bool multi = !(dtStart().date() == dtEnd().date()); |
154 | return multi; | 154 | return multi; |
155 | } | 155 | } |
156 | 156 | ||
157 | void Event::setTransparency(Event::Transparency transparency) | 157 | void Event::setTransparency(Event::Transparency transparency) |
158 | { | 158 | { |
159 | if (mReadOnly) return; | 159 | if (mReadOnly) return; |
160 | mTransparency = transparency; | 160 | mTransparency = transparency; |
161 | updated(); | 161 | updated(); |
162 | } | 162 | } |
163 | 163 | ||
164 | Event::Transparency Event::transparency() const | 164 | Event::Transparency Event::transparency() const |
165 | { | 165 | { |
166 | return mTransparency; | 166 | return mTransparency; |
167 | } | 167 | } |
168 | 168 | ||
169 | void Event::setDuration(int seconds) | 169 | void Event::setDuration(int seconds) |
170 | { | 170 | { |
171 | setHasEndDate(false); | 171 | setHasEndDate(false); |
172 | Incidence::setDuration(seconds); | 172 | Incidence::setDuration(seconds); |
173 | } | 173 | } |
174 | bool Event::matchTime(QDateTime*startDT, QDateTime* endDT) | 174 | bool Event::matchTime(QDateTime*startDT, QDateTime* endDT) |
175 | { | 175 | { |
176 | if ( cancelled() ) return false; | ||
176 | if ( ! doesRecur() ) { | 177 | if ( ! doesRecur() ) { |
177 | if ( doesFloat() ) { | 178 | if ( doesFloat() ) { |
178 | if ( mDtEnd.addDays( 1 ) < *startDT) | 179 | if ( mDtEnd.addDays( 1 ) < *startDT) |
179 | return false; | 180 | return false; |
180 | if ( endDT && mDtStart > * endDT) | 181 | if ( endDT && mDtStart > * endDT) |
181 | return false; | 182 | return false; |
182 | } else { | 183 | } else { |
183 | if ( mDtEnd < *startDT ) | 184 | if ( mDtEnd < *startDT ) |
184 | return false; | 185 | return false; |
185 | if ( endDT && mDtStart > * endDT) | 186 | if ( endDT && mDtStart > * endDT) |
186 | return false; | 187 | return false; |
187 | } | 188 | } |
188 | } else { | 189 | } else { |
189 | if ( endDT && mDtStart > * endDT) | 190 | if ( endDT && mDtStart > * endDT) |
190 | return false; | 191 | return false; |
191 | } | 192 | } |
192 | return true; | 193 | return true; |
193 | } | 194 | } |
194 | bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT ) | 195 | bool Event::isOverlapping ( Event* testEvent, QDateTime* overlapDT, QDateTime* startDT ) |
195 | { | 196 | { |
196 | if ( testEvent == this ) | 197 | if ( testEvent == this ) |
197 | return false; | 198 | return false; |
198 | if ( ! doesRecur() && !testEvent->doesRecur() ) { | 199 | if ( ! doesRecur() && !testEvent->doesRecur() ) { |
199 | QDateTime te; | 200 | QDateTime te; |
200 | if ( testEvent->doesFloat() ) | 201 | if ( testEvent->doesFloat() ) |
201 | te = testEvent->mDtEnd.addDays( 1 ); | 202 | te = testEvent->mDtEnd.addDays( 1 ); |
202 | else | 203 | else |
203 | te = testEvent->mDtEnd; | 204 | te = testEvent->mDtEnd; |
204 | QDateTime e; | 205 | QDateTime e; |
205 | if ( doesFloat() ) | 206 | if ( doesFloat() ) |
206 | e = mDtEnd.addDays( 1 ); | 207 | e = mDtEnd.addDays( 1 ); |
207 | else | 208 | else |
208 | e = mDtEnd; | 209 | e = mDtEnd; |
209 | if ( mDtStart < te && testEvent->mDtStart < e ) { | 210 | if ( mDtStart < te && testEvent->mDtStart < e ) { |
210 | if ( mDtStart < testEvent->mDtStart ) | 211 | if ( mDtStart < testEvent->mDtStart ) |
211 | *overlapDT = testEvent->mDtStart; | 212 | *overlapDT = testEvent->mDtStart; |
212 | else | 213 | else |
213 | *overlapDT = mDtStart; | 214 | *overlapDT = mDtStart; |
214 | if ( startDT ) | 215 | if ( startDT ) |
215 | return (*overlapDT >= *startDT ); | 216 | return (*overlapDT >= *startDT ); |
216 | return true; | 217 | return true; |
217 | } | 218 | } |
218 | return false; | 219 | return false; |
219 | } | 220 | } |
220 | if ( !doesFloat() && !testEvent->doesFloat() && !isMultiDay() && !testEvent->isMultiDay() ) { | 221 | if ( !doesFloat() && !testEvent->doesFloat() && !isMultiDay() && !testEvent->isMultiDay() ) { |
221 | if ( mDtStart.time() >= testEvent->mDtEnd.time() || testEvent->mDtStart.time() >= mDtEnd.time() ) { | 222 | if ( mDtStart.time() >= testEvent->mDtEnd.time() || testEvent->mDtStart.time() >= mDtEnd.time() ) { |
222 | // no need to test. times mismatch | 223 | // no need to test. times mismatch |
223 | //fprintf(stderr,"timi "); | 224 | //fprintf(stderr,"timi "); |
224 | return false; | 225 | return false; |
225 | } | 226 | } |
226 | } | 227 | } |
227 | Event *nonRecur = 0; | 228 | Event *nonRecur = 0; |
228 | Event *recurEvent = 0; | 229 | Event *recurEvent = 0; |
229 | if ( ! doesRecur() ) { | 230 | if ( ! doesRecur() ) { |
230 | nonRecur = this; | 231 | nonRecur = this; |
231 | recurEvent = testEvent; | 232 | recurEvent = testEvent; |
232 | } | 233 | } |
233 | else if ( !testEvent->doesRecur() ) { | 234 | else if ( !testEvent->doesRecur() ) { |
234 | nonRecur = testEvent; | 235 | nonRecur = testEvent; |
235 | recurEvent = this; | 236 | recurEvent = this; |
236 | } | 237 | } |
237 | if ( nonRecur ) { | 238 | if ( nonRecur ) { |
238 | QDateTime enr; | 239 | QDateTime enr; |
239 | if ( nonRecur->doesFloat() ) | 240 | if ( nonRecur->doesFloat() ) |
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 4794bc9..f349681 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -311,140 +311,137 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
311 | // status | 311 | // status |
312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); | 312 | // addPropValue(parent, VCStatusProp, incidence->getStatusStr().utf8()); |
313 | 313 | ||
314 | // secrecy | 314 | // secrecy |
315 | enum icalproperty_class classInt; | 315 | enum icalproperty_class classInt; |
316 | switch (incidence->secrecy()) { | 316 | switch (incidence->secrecy()) { |
317 | case Incidence::SecrecyPublic: | 317 | case Incidence::SecrecyPublic: |
318 | classInt = ICAL_CLASS_PUBLIC; | 318 | classInt = ICAL_CLASS_PUBLIC; |
319 | break; | 319 | break; |
320 | case Incidence::SecrecyConfidential: | 320 | case Incidence::SecrecyConfidential: |
321 | classInt = ICAL_CLASS_CONFIDENTIAL; | 321 | classInt = ICAL_CLASS_CONFIDENTIAL; |
322 | break; | 322 | break; |
323 | case Incidence::SecrecyPrivate: | 323 | case Incidence::SecrecyPrivate: |
324 | classInt =ICAL_CLASS_PRIVATE ; | 324 | classInt =ICAL_CLASS_PRIVATE ; |
325 | default: | 325 | default: |
326 | classInt =ICAL_CLASS_PRIVATE ; | 326 | classInt =ICAL_CLASS_PRIVATE ; |
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); | 329 | icalcomponent_add_property(parent,icalproperty_new_class(classInt)); |
330 | 330 | ||
331 | // priority | 331 | // priority |
332 | icalcomponent_add_property(parent,icalproperty_new_priority( | 332 | icalcomponent_add_property(parent,icalproperty_new_priority( |
333 | incidence->priority())); | 333 | incidence->priority())); |
334 | 334 | ||
335 | // categories | 335 | // categories |
336 | QStringList categories = incidence->categories(); | 336 | QStringList categories = incidence->categories(); |
337 | QStringList::Iterator it; | 337 | QStringList::Iterator it; |
338 | for(it = categories.begin(); it != categories.end(); ++it ) { | 338 | for(it = categories.begin(); it != categories.end(); ++it ) { |
339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); | 339 | icalcomponent_add_property(parent,icalproperty_new_categories((*it).utf8())); |
340 | } | 340 | } |
341 | // TODO: Ensure correct concatenation of categories properties. | 341 | // TODO: Ensure correct concatenation of categories properties. |
342 | 342 | ||
343 | /* | 343 | /* |
344 | // categories | 344 | // categories |
345 | tmpStrList = incidence->getCategories(); | 345 | tmpStrList = incidence->getCategories(); |
346 | tmpStr = ""; | 346 | tmpStr = ""; |
347 | QString catStr; | 347 | QString catStr; |
348 | for ( QStringList::Iterator it = tmpStrList.begin(); | 348 | for ( QStringList::Iterator it = tmpStrList.begin(); |
349 | it != tmpStrList.end(); | 349 | it != tmpStrList.end(); |
350 | ++it ) { | 350 | ++it ) { |
351 | catStr = *it; | 351 | catStr = *it; |
352 | if (catStr[0] == ' ') | 352 | if (catStr[0] == ' ') |
353 | tmpStr += catStr.mid(1); | 353 | tmpStr += catStr.mid(1); |
354 | else | 354 | else |
355 | tmpStr += catStr; | 355 | tmpStr += catStr; |
356 | // this must be a ';' character as the vCalendar specification requires! | 356 | // this must be a ';' character as the vCalendar specification requires! |
357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 357 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
358 | // read in. | 358 | // read in. |
359 | tmpStr += ";"; | 359 | tmpStr += ";"; |
360 | } | 360 | } |
361 | if (!tmpStr.isEmpty()) { | 361 | if (!tmpStr.isEmpty()) { |
362 | tmpStr.truncate(tmpStr.length()-1); | 362 | tmpStr.truncate(tmpStr.length()-1); |
363 | icalcomponent_add_property(parent,icalproperty_new_categories( | 363 | icalcomponent_add_property(parent,icalproperty_new_categories( |
364 | writeText(incidence->getCategories().join(";")))); | 364 | writeText(incidence->getCategories().join(";")))); |
365 | } | 365 | } |
366 | */ | 366 | */ |
367 | 367 | ||
368 | // related event | 368 | // related event |
369 | if (!incidence->relatedToUid().isEmpty()) { | 369 | if (!incidence->relatedToUid().isEmpty()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedToUid().utf8())); | 371 | incidence->relatedToUid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | if (incidence->doesRecur()) { |
376 | if (recur->doesRecur()) { | 376 | icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence())); |
377 | 377 | // recurrence excpetion dates | |
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | 378 | DateList dateList = incidence->exDates(); |
379 | } | 379 | DateList::ConstIterator exIt; |
380 | 380 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | |
381 | // recurrence excpetion dates | 381 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
382 | DateList dateList = incidence->exDates(); | 382 | writeICalDate(*exIt))); |
383 | DateList::ConstIterator exIt; | 383 | } |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | ||
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | ||
386 | writeICalDate(*exIt))); | ||
387 | } | 384 | } |
388 | 385 | ||
389 | // attachments | 386 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 387 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 388 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 389 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 390 | ||
394 | // alarms | 391 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 392 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 393 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 394 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 395 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 396 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 397 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 398 | } |
402 | } | 399 | } |
403 | if( incidence->hasRecurrenceID() ) { | 400 | if( incidence->hasRecurrenceID() ) { |
404 | icalcomponent_add_property(parent, | 401 | icalcomponent_add_property(parent, |
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | 402 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); |
406 | } | 403 | } |
407 | // duration | 404 | // duration |
408 | 405 | ||
409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 406 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
410 | 407 | ||
411 | if (incidence->hasDuration()) { | 408 | if (incidence->hasDuration()) { |
412 | icaldurationtype duration; | 409 | icaldurationtype duration; |
413 | duration = writeICalDuration(incidence->duration()); | 410 | duration = writeICalDuration(incidence->duration()); |
414 | icalcomponent_add_property(parent,icalproperty_new_duration(duration)); | 411 | icalcomponent_add_property(parent,icalproperty_new_duration(duration)); |
415 | } | 412 | } |
416 | } | 413 | } |
417 | 414 | ||
418 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 415 | void ICalFormatImpl::writeIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
419 | { | 416 | { |
420 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( | 417 | icalcomponent_add_property(parent,icalproperty_new_dtstamp( |
421 | writeICalDateTime(QDateTime::currentDateTime()))); | 418 | writeICalDateTime(QDateTime::currentDateTime()))); |
422 | 419 | ||
423 | // organizer stuff | 420 | // organizer stuff |
424 | icalcomponent_add_property(parent,icalproperty_new_organizer( | 421 | icalcomponent_add_property(parent,icalproperty_new_organizer( |
425 | ("MAILTO:" + incidenceBase->organizer()).utf8())); | 422 | ("MAILTO:" + incidenceBase->organizer()).utf8())); |
426 | 423 | ||
427 | // attendees | 424 | // attendees |
428 | if (incidenceBase->attendeeCount() != 0) { | 425 | if (incidenceBase->attendeeCount() != 0) { |
429 | QPtrList<Attendee> al = incidenceBase->attendees(); | 426 | QPtrList<Attendee> al = incidenceBase->attendees(); |
430 | QPtrListIterator<Attendee> ai(al); | 427 | QPtrListIterator<Attendee> ai(al); |
431 | for (; ai.current(); ++ai) { | 428 | for (; ai.current(); ++ai) { |
432 | icalcomponent_add_property(parent,writeAttendee(ai.current())); | 429 | icalcomponent_add_property(parent,writeAttendee(ai.current())); |
433 | } | 430 | } |
434 | } | 431 | } |
435 | 432 | ||
436 | // custom properties | 433 | // custom properties |
437 | writeCustomProperties(parent, incidenceBase); | 434 | writeCustomProperties(parent, incidenceBase); |
438 | } | 435 | } |
439 | 436 | ||
440 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) | 437 | void ICalFormatImpl::writeCustomProperties(icalcomponent *parent,CustomProperties *properties) |
441 | { | 438 | { |
442 | QMap<QCString, QString> custom = properties->customProperties(); | 439 | QMap<QCString, QString> custom = properties->customProperties(); |
443 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { | 440 | for (QMap<QCString, QString>::Iterator c = custom.begin(); c != custom.end(); ++c) { |
444 | icalproperty *p = icalproperty_new_x(c.data().utf8()); | 441 | icalproperty *p = icalproperty_new_x(c.data().utf8()); |
445 | icalproperty_set_x_name(p,c.key()); | 442 | icalproperty_set_x_name(p,c.key()); |
446 | icalcomponent_add_property(parent,p); | 443 | icalcomponent_add_property(parent,p); |
447 | } | 444 | } |
448 | } | 445 | } |
449 | 446 | ||
450 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) | 447 | icalproperty *ICalFormatImpl::writeAttendee(Attendee *attendee) |
@@ -1234,129 +1231,130 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
1234 | break; | 1231 | break; |
1235 | 1232 | ||
1236 | case ICAL_CATEGORIES_PROPERTY: // categories | 1233 | case ICAL_CATEGORIES_PROPERTY: // categories |
1237 | text = icalproperty_get_categories(p); | 1234 | text = icalproperty_get_categories(p); |
1238 | categories.append(QString::fromUtf8(text)); | 1235 | categories.append(QString::fromUtf8(text)); |
1239 | break; | 1236 | break; |
1240 | //******************************************* | 1237 | //******************************************* |
1241 | case ICAL_RRULE_PROPERTY: | 1238 | case ICAL_RRULE_PROPERTY: |
1242 | // we do need (maybe )start datetime of incidence for recurrence | 1239 | // we do need (maybe )start datetime of incidence for recurrence |
1243 | // such that we can read recurrence only after we read incidence completely | 1240 | // such that we can read recurrence only after we read incidence completely |
1244 | readrec = true; | 1241 | readrec = true; |
1245 | rectype = icalproperty_get_rrule(p); | 1242 | rectype = icalproperty_get_rrule(p); |
1246 | break; | 1243 | break; |
1247 | 1244 | ||
1248 | case ICAL_EXDATE_PROPERTY: | 1245 | case ICAL_EXDATE_PROPERTY: |
1249 | icaltime = icalproperty_get_exdate(p); | 1246 | icaltime = icalproperty_get_exdate(p); |
1250 | incidence->addExDate(readICalDate(icaltime)); | 1247 | incidence->addExDate(readICalDate(icaltime)); |
1251 | break; | 1248 | break; |
1252 | 1249 | ||
1253 | case ICAL_CLASS_PROPERTY: { | 1250 | case ICAL_CLASS_PROPERTY: { |
1254 | int inttext = icalproperty_get_class(p); | 1251 | int inttext = icalproperty_get_class(p); |
1255 | if (inttext == ICAL_CLASS_PUBLIC ) { | 1252 | if (inttext == ICAL_CLASS_PUBLIC ) { |
1256 | incidence->setSecrecy(Incidence::SecrecyPublic); | 1253 | incidence->setSecrecy(Incidence::SecrecyPublic); |
1257 | } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { | 1254 | } else if (inttext == ICAL_CLASS_CONFIDENTIAL ) { |
1258 | incidence->setSecrecy(Incidence::SecrecyConfidential); | 1255 | incidence->setSecrecy(Incidence::SecrecyConfidential); |
1259 | } else { | 1256 | } else { |
1260 | incidence->setSecrecy(Incidence::SecrecyPrivate); | 1257 | incidence->setSecrecy(Incidence::SecrecyPrivate); |
1261 | } | 1258 | } |
1262 | } | 1259 | } |
1263 | break; | 1260 | break; |
1264 | 1261 | ||
1265 | case ICAL_ATTACH_PROPERTY: // attachments | 1262 | case ICAL_ATTACH_PROPERTY: // attachments |
1266 | incidence->addAttachment(readAttachment(p)); | 1263 | incidence->addAttachment(readAttachment(p)); |
1267 | break; | 1264 | break; |
1268 | 1265 | ||
1269 | default: | 1266 | default: |
1270 | // kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind | 1267 | // kdDebug(5800) << "ICALFormat::readIncidence(): Unknown property: " << kind |
1271 | // << endl; | 1268 | // << endl; |
1272 | break; | 1269 | break; |
1273 | } | 1270 | } |
1274 | 1271 | ||
1275 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1272 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1276 | } | 1273 | } |
1277 | if ( readrec ) { | 1274 | if ( readrec ) { |
1278 | readRecurrenceRule(rectype,incidence); | 1275 | readRecurrenceRule(rectype,incidence); |
1279 | } | 1276 | } |
1280 | // kpilot stuff | 1277 | // kpilot stuff |
1281 | // TODO: move this application-specific code to kpilot | 1278 | // TODO: move this application-specific code to kpilot |
1282 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); | 1279 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); |
1283 | if (!kp.isNull()) { | 1280 | if (!kp.isNull()) { |
1284 | incidence->setPilotId(kp.toInt()); | 1281 | incidence->setPilotId(kp.toInt()); |
1285 | } | 1282 | } |
1286 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); | 1283 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); |
1287 | if (!kp.isNull()) { | 1284 | if (!kp.isNull()) { |
1288 | incidence->setSyncStatus(kp.toInt()); | 1285 | incidence->setSyncStatus(kp.toInt()); |
1289 | } | 1286 | } |
1290 | 1287 | ||
1291 | 1288 | ||
1292 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); | 1289 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); |
1293 | if (!kp.isNull()) { | 1290 | if (!kp.isNull()) { |
1294 | incidence->setIDStr(kp); | 1291 | incidence->setIDStr(kp); |
1295 | } | 1292 | } |
1296 | 1293 | ||
1297 | // Cancel backwards compatibility mode for subsequent changes by the application | 1294 | // Cancel backwards compatibility mode for subsequent changes by the application |
1298 | incidence->recurrence()->setCompatVersion(); | 1295 | if ( readrec ) |
1296 | incidence->recurrence()->setCompatVersion(); | ||
1299 | 1297 | ||
1300 | // add categories | 1298 | // add categories |
1301 | incidence->setCategories(categories); | 1299 | incidence->setCategories(categories); |
1302 | 1300 | ||
1303 | // iterate through all alarms | 1301 | // iterate through all alarms |
1304 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); | 1302 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); |
1305 | alarm; | 1303 | alarm; |
1306 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { | 1304 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { |
1307 | readAlarm(alarm,incidence); | 1305 | readAlarm(alarm,incidence); |
1308 | } | 1306 | } |
1309 | } | 1307 | } |
1310 | 1308 | ||
1311 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 1309 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
1312 | { | 1310 | { |
1313 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1311 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1314 | 1312 | ||
1315 | while (p) { | 1313 | while (p) { |
1316 | icalproperty_kind kind = icalproperty_isa(p); | 1314 | icalproperty_kind kind = icalproperty_isa(p); |
1317 | switch (kind) { | 1315 | switch (kind) { |
1318 | 1316 | ||
1319 | case ICAL_UID_PROPERTY: // unique id | 1317 | case ICAL_UID_PROPERTY: // unique id |
1320 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); | 1318 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); |
1321 | break; | 1319 | break; |
1322 | 1320 | ||
1323 | case ICAL_ORGANIZER_PROPERTY: // organizer | 1321 | case ICAL_ORGANIZER_PROPERTY: // organizer |
1324 | incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); | 1322 | incidenceBase->setOrganizer(QString::fromUtf8(icalproperty_get_organizer(p))); |
1325 | break; | 1323 | break; |
1326 | 1324 | ||
1327 | case ICAL_ATTENDEE_PROPERTY: // attendee | 1325 | case ICAL_ATTENDEE_PROPERTY: // attendee |
1328 | incidenceBase->addAttendee(readAttendee(p)); | 1326 | incidenceBase->addAttendee(readAttendee(p)); |
1329 | break; | 1327 | break; |
1330 | 1328 | ||
1331 | default: | 1329 | default: |
1332 | break; | 1330 | break; |
1333 | } | 1331 | } |
1334 | 1332 | ||
1335 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1333 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1336 | } | 1334 | } |
1337 | 1335 | ||
1338 | // custom properties | 1336 | // custom properties |
1339 | readCustomProperties(parent, incidenceBase); | 1337 | readCustomProperties(parent, incidenceBase); |
1340 | } | 1338 | } |
1341 | 1339 | ||
1342 | void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) | 1340 | void ICalFormatImpl::readCustomProperties(icalcomponent *parent,CustomProperties *properties) |
1343 | { | 1341 | { |
1344 | QMap<QCString, QString> customProperties; | 1342 | QMap<QCString, QString> customProperties; |
1345 | 1343 | ||
1346 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); | 1344 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_X_PROPERTY); |
1347 | 1345 | ||
1348 | while (p) { | 1346 | while (p) { |
1349 | QString value = QString::fromUtf8(icalproperty_get_x(p)); | 1347 | QString value = QString::fromUtf8(icalproperty_get_x(p)); |
1350 | customProperties[icalproperty_get_x_name(p)] = value; | 1348 | customProperties[icalproperty_get_x_name(p)] = value; |
1351 | //qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) ); | 1349 | //qDebug("ICalFormatImpl::readCustomProperties %s %s",value.latin1(), icalproperty_get_x_name(p) ); |
1352 | 1350 | ||
1353 | p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); | 1351 | p = icalcomponent_get_next_property(parent,ICAL_X_PROPERTY); |
1354 | } | 1352 | } |
1355 | 1353 | ||
1356 | properties->setCustomProperties(customProperties); | 1354 | properties->setCustomProperties(customProperties); |
1357 | } | 1355 | } |
1358 | 1356 | ||
1359 | void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence) | 1357 | void ICalFormatImpl::readRecurrenceRule(struct icalrecurrencetype rrule,Incidence *incidence) |
1360 | { | 1358 | { |
1361 | // kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl; | 1359 | // kdDebug(5800) << "Read recurrence for " << incidence->summary() << endl; |
1362 | 1360 | ||
diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index e4bcc5e..4643a3a 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp | |||
@@ -1,397 +1,418 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kglobal.h> | 21 | #include <kglobal.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | #include "incidence.h" | 27 | #include "incidence.h" |
28 | #include "todo.h" | 28 | #include "todo.h" |
29 | 29 | ||
30 | using namespace KCal; | 30 | using namespace KCal; |
31 | 31 | ||
32 | Incidence::Incidence() : | 32 | Incidence::Incidence() : |
33 | IncidenceBase(), | 33 | IncidenceBase(), |
34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) | 34 | mRelatedTo(0), mSecrecy(SecrecyPublic), mPriority(3) |
35 | { | 35 | { |
36 | mRecurrence = new Recurrence(this); | 36 | mRecurrence = 0;//new Recurrence(this); |
37 | mCancelled = false; | 37 | mCancelled = false; |
38 | recreate(); | 38 | recreate(); |
39 | mHasStartDate = true; | 39 | mHasStartDate = true; |
40 | mAlarms.setAutoDelete(true); | 40 | mAlarms.setAutoDelete(true); |
41 | mAttachments.setAutoDelete(true); | 41 | mAttachments.setAutoDelete(true); |
42 | mHasRecurrenceID = false; | 42 | mHasRecurrenceID = false; |
43 | mHoliday = false; | 43 | mHoliday = false; |
44 | mBirthday = false; | 44 | mBirthday = false; |
45 | mAnniversary = false; | 45 | mAnniversary = false; |
46 | 46 | ||
47 | } | 47 | } |
48 | 48 | ||
49 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) | 49 | Incidence::Incidence( const Incidence &i ) : IncidenceBase( i ) |
50 | { | 50 | { |
51 | // TODO: reenable attributes currently commented out. | 51 | // TODO: reenable attributes currently commented out. |
52 | mRevision = i.mRevision; | 52 | mRevision = i.mRevision; |
53 | mCreated = i.mCreated; | 53 | mCreated = i.mCreated; |
54 | mDescription = i.mDescription; | 54 | mDescription = i.mDescription; |
55 | mSummary = i.mSummary; | 55 | mSummary = i.mSummary; |
56 | mCategories = i.mCategories; | 56 | mCategories = i.mCategories; |
57 | // Incidence *mRelatedTo; Incidence *mRelatedTo; | 57 | // Incidence *mRelatedTo; Incidence *mRelatedTo; |
58 | mRelatedTo = 0; | 58 | mRelatedTo = 0; |
59 | mRelatedToUid = i.mRelatedToUid; | 59 | mRelatedToUid = i.mRelatedToUid; |
60 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; | 60 | // QPtrList<Incidence> mRelations; QPtrList<Incidence> mRelations; |
61 | mExDates = i.mExDates; | 61 | mExDates = i.mExDates; |
62 | mAttachments = i.mAttachments; | 62 | mAttachments = i.mAttachments; |
63 | mResources = i.mResources; | 63 | mResources = i.mResources; |
64 | mSecrecy = i.mSecrecy; | 64 | mSecrecy = i.mSecrecy; |
65 | mPriority = i.mPriority; | 65 | mPriority = i.mPriority; |
66 | mLocation = i.mLocation; | 66 | mLocation = i.mLocation; |
67 | mCancelled = i.mCancelled; | 67 | mCancelled = i.mCancelled; |
68 | mHasStartDate = i.mHasStartDate; | 68 | mHasStartDate = i.mHasStartDate; |
69 | QPtrListIterator<Alarm> it( i.mAlarms ); | 69 | QPtrListIterator<Alarm> it( i.mAlarms ); |
70 | const Alarm *a; | 70 | const Alarm *a; |
71 | while( (a = it.current()) ) { | 71 | while( (a = it.current()) ) { |
72 | Alarm *b = new Alarm( *a ); | 72 | Alarm *b = new Alarm( *a ); |
73 | b->setParent( this ); | 73 | b->setParent( this ); |
74 | mAlarms.append( b ); | 74 | mAlarms.append( b ); |
75 | 75 | ||
76 | ++it; | 76 | ++it; |
77 | } | 77 | } |
78 | mAlarms.setAutoDelete(true); | 78 | mAlarms.setAutoDelete(true); |
79 | mHasRecurrenceID = i.mHasRecurrenceID; | 79 | mHasRecurrenceID = i.mHasRecurrenceID; |
80 | mRecurrenceID = i.mRecurrenceID; | 80 | mRecurrenceID = i.mRecurrenceID; |
81 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | 81 | if ( i.mRecurrence ) |
82 | mRecurrence = new Recurrence( *(i.mRecurrence), this ); | ||
83 | else | ||
84 | mRecurrence = 0; | ||
82 | mHoliday = i.mHoliday ; | 85 | mHoliday = i.mHoliday ; |
83 | mBirthday = i.mBirthday; | 86 | mBirthday = i.mBirthday; |
84 | mAnniversary = i.mAnniversary; | 87 | mAnniversary = i.mAnniversary; |
85 | } | 88 | } |
86 | 89 | ||
87 | Incidence::~Incidence() | 90 | Incidence::~Incidence() |
88 | { | 91 | { |
89 | 92 | ||
90 | Incidence *ev; | 93 | Incidence *ev; |
91 | QPtrList<Incidence> Relations = relations(); | 94 | QPtrList<Incidence> Relations = relations(); |
92 | for (ev=Relations.first();ev;ev=Relations.next()) { | 95 | for (ev=Relations.first();ev;ev=Relations.next()) { |
93 | if (ev->relatedTo() == this) ev->setRelatedTo(0); | 96 | if (ev->relatedTo() == this) ev->setRelatedTo(0); |
94 | } | 97 | } |
95 | if (relatedTo()) relatedTo()->removeRelation(this); | 98 | if (relatedTo()) relatedTo()->removeRelation(this); |
96 | delete mRecurrence; | 99 | if ( mRecurrence ) |
100 | delete mRecurrence; | ||
97 | 101 | ||
98 | } | 102 | } |
99 | 103 | ||
100 | bool Incidence::isHoliday() const | 104 | bool Incidence::isHoliday() const |
101 | { | 105 | { |
102 | return mHoliday; | 106 | return mHoliday; |
103 | } | 107 | } |
104 | bool Incidence::isBirthday() const | 108 | bool Incidence::isBirthday() const |
105 | { | 109 | { |
106 | 110 | ||
107 | return mBirthday ; | 111 | return mBirthday ; |
108 | } | 112 | } |
109 | bool Incidence::isAnniversary() const | 113 | bool Incidence::isAnniversary() const |
110 | { | 114 | { |
111 | return mAnniversary ; | 115 | return mAnniversary ; |
112 | 116 | ||
113 | } | 117 | } |
114 | 118 | ||
115 | bool Incidence::hasRecurrenceID() const | 119 | bool Incidence::hasRecurrenceID() const |
116 | { | 120 | { |
117 | return mHasRecurrenceID; | 121 | return mHasRecurrenceID; |
118 | } | 122 | } |
119 | 123 | ||
120 | void Incidence::setHasRecurrenceID( bool b ) | 124 | void Incidence::setHasRecurrenceID( bool b ) |
121 | { | 125 | { |
122 | mHasRecurrenceID = b; | 126 | mHasRecurrenceID = b; |
123 | } | 127 | } |
124 | 128 | ||
125 | void Incidence::setRecurrenceID(QDateTime d) | 129 | void Incidence::setRecurrenceID(QDateTime d) |
126 | { | 130 | { |
127 | mRecurrenceID = d; | 131 | mRecurrenceID = d; |
128 | mHasRecurrenceID = true; | 132 | mHasRecurrenceID = true; |
129 | updated(); | 133 | updated(); |
130 | } | 134 | } |
131 | QDateTime Incidence::recurrenceID () const | 135 | QDateTime Incidence::recurrenceID () const |
132 | { | 136 | { |
133 | return mRecurrenceID; | 137 | return mRecurrenceID; |
134 | } | 138 | } |
135 | 139 | ||
136 | bool Incidence::cancelled() const | 140 | bool Incidence::cancelled() const |
137 | { | 141 | { |
138 | return mCancelled; | 142 | return mCancelled; |
139 | } | 143 | } |
140 | void Incidence::setCancelled( bool b ) | 144 | void Incidence::setCancelled( bool b ) |
141 | { | 145 | { |
142 | mCancelled = b; | 146 | mCancelled = b; |
143 | updated(); | 147 | updated(); |
144 | } | 148 | } |
145 | bool Incidence::hasStartDate() const | 149 | bool Incidence::hasStartDate() const |
146 | { | 150 | { |
147 | return mHasStartDate; | 151 | return mHasStartDate; |
148 | } | 152 | } |
149 | 153 | ||
150 | void Incidence::setHasStartDate(bool f) | 154 | void Incidence::setHasStartDate(bool f) |
151 | { | 155 | { |
152 | if (mReadOnly) return; | 156 | if (mReadOnly) return; |
153 | mHasStartDate = f; | 157 | mHasStartDate = f; |
154 | updated(); | 158 | updated(); |
155 | } | 159 | } |
156 | 160 | ||
157 | // A string comparison that considers that null and empty are the same | 161 | // A string comparison that considers that null and empty are the same |
158 | static bool stringCompare( const QString& s1, const QString& s2 ) | 162 | static bool stringCompare( const QString& s1, const QString& s2 ) |
159 | { | 163 | { |
160 | if ( s1.isEmpty() && s2.isEmpty() ) | 164 | if ( s1.isEmpty() && s2.isEmpty() ) |
161 | return true; | 165 | return true; |
162 | return s1 == s2; | 166 | return s1 == s2; |
163 | } | 167 | } |
164 | 168 | ||
165 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) | 169 | bool KCal::operator==( const Incidence& i1, const Incidence& i2 ) |
166 | { | 170 | { |
167 | 171 | ||
168 | if( i1.alarms().count() != i2.alarms().count() ) { | 172 | if( i1.alarms().count() != i2.alarms().count() ) { |
169 | return false; // no need to check further | 173 | return false; // no need to check further |
170 | } | 174 | } |
171 | if ( i1.alarms().count() > 0 ) { | 175 | if ( i1.alarms().count() > 0 ) { |
172 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) | 176 | if ( !( *(i1.alarms().first()) == *(i2.alarms().first())) ) |
173 | { | 177 | { |
174 | qDebug("alarm not equal "); | 178 | qDebug("alarm not equal "); |
175 | return false; | 179 | return false; |
176 | } | 180 | } |
177 | } | 181 | } |
178 | #if 0 | 182 | #if 0 |
179 | QPtrListIterator<Alarm> a1( i1.alarms() ); | 183 | QPtrListIterator<Alarm> a1( i1.alarms() ); |
180 | QPtrListIterator<Alarm> a2( i2.alarms() ); | 184 | QPtrListIterator<Alarm> a2( i2.alarms() ); |
181 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { | 185 | for( ; a1.current() && a2.current(); ++a1, ++a2 ) { |
182 | if( *a1.current() == *a2.current() ) { | 186 | if( *a1.current() == *a2.current() ) { |
183 | continue; | 187 | continue; |
184 | } | 188 | } |
185 | else { | 189 | else { |
186 | return false; | 190 | return false; |
187 | } | 191 | } |
188 | } | 192 | } |
189 | #endif | 193 | #endif |
190 | 194 | ||
191 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { | 195 | if ( i1.hasRecurrenceID() == i2.hasRecurrenceID() ) { |
192 | if ( i1.hasRecurrenceID() ) { | 196 | if ( i1.hasRecurrenceID() ) { |
193 | if ( i1.recurrenceID() != i2.recurrenceID() ) | 197 | if ( i1.recurrenceID() != i2.recurrenceID() ) |
194 | return false; | 198 | return false; |
195 | } | 199 | } |
196 | 200 | ||
197 | } else { | 201 | } else { |
198 | return false; | 202 | return false; |
199 | } | 203 | } |
200 | 204 | ||
201 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) | 205 | if ( ! operator==( (const IncidenceBase&)i1, (const IncidenceBase&)i2 ) ) |
202 | return false; | 206 | return false; |
203 | if ( i1.hasStartDate() == i2.hasStartDate() ) { | 207 | if ( i1.hasStartDate() == i2.hasStartDate() ) { |
204 | if ( i1.hasStartDate() ) { | 208 | if ( i1.hasStartDate() ) { |
205 | if ( i1.dtStart() != i2.dtStart() ) | 209 | if ( i1.dtStart() != i2.dtStart() ) |
206 | return false; | 210 | return false; |
207 | } | 211 | } |
208 | } else { | 212 | } else { |
209 | return false; | 213 | return false; |
210 | } | 214 | } |
211 | if (!( *i1.recurrence() == *i2.recurrence()) ) { | 215 | if ( i1.mRecurrence != 0 && i2.mRecurrence != 0 ) { |
212 | qDebug("recurrence is NOT equal "); | 216 | if (!( *i1.mRecurrence == *i2.mRecurrence) ) { |
213 | return false; | 217 | //qDebug("recurrence is NOT equal "); |
218 | return false; | ||
219 | } | ||
220 | } else { | ||
221 | // one ( or both ) recurrence is 0 | ||
222 | if ( i1.mRecurrence == 0 ) { | ||
223 | if ( i2.mRecurrence != 0 && i2.mRecurrence->doesRecur() != Recurrence::rNone ) | ||
224 | return false; | ||
225 | } else { | ||
226 | // i1.mRecurrence != 0 | ||
227 | // i2.mRecurrence == 0 | ||
228 | if ( i1.mRecurrence->doesRecur() != Recurrence::rNone ) | ||
229 | return false; | ||
230 | } | ||
214 | } | 231 | } |
232 | |||
215 | return | 233 | return |
216 | // i1.created() == i2.created() && | 234 | // i1.created() == i2.created() && |
217 | stringCompare( i1.description(), i2.description() ) && | 235 | stringCompare( i1.description(), i2.description() ) && |
218 | stringCompare( i1.summary(), i2.summary() ) && | 236 | stringCompare( i1.summary(), i2.summary() ) && |
219 | i1.categories() == i2.categories() && | 237 | i1.categories() == i2.categories() && |
220 | // no need to compare mRelatedTo | 238 | // no need to compare mRelatedTo |
221 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && | 239 | stringCompare( i1.relatedToUid(), i2.relatedToUid() ) && |
222 | // i1.relations() == i2.relations() && | 240 | // i1.relations() == i2.relations() && |
223 | i1.exDates() == i2.exDates() && | 241 | i1.exDates() == i2.exDates() && |
224 | i1.attachments() == i2.attachments() && | 242 | i1.attachments() == i2.attachments() && |
225 | i1.resources() == i2.resources() && | 243 | i1.resources() == i2.resources() && |
226 | i1.secrecy() == i2.secrecy() && | 244 | i1.secrecy() == i2.secrecy() && |
227 | i1.priority() == i2.priority() && | 245 | i1.priority() == i2.priority() && |
228 | i1.cancelled() == i2.cancelled() && | 246 | i1.cancelled() == i2.cancelled() && |
229 | stringCompare( i1.location(), i2.location() ); | 247 | stringCompare( i1.location(), i2.location() ); |
230 | } | 248 | } |
231 | 249 | ||
232 | Incidence* Incidence::recreateCloneException( QDate d ) | 250 | Incidence* Incidence::recreateCloneException( QDate d ) |
233 | { | 251 | { |
234 | Incidence* newInc = clone(); | 252 | Incidence* newInc = clone(); |
235 | newInc->recreate(); | 253 | newInc->recreate(); |
236 | if ( doesRecur() ) { | 254 | if ( doesRecur() ) { |
237 | addExDate( d ); | 255 | addExDate( d ); |
238 | newInc->recurrence()->unsetRecurs(); | 256 | newInc->recurrence()->unsetRecurs(); |
239 | if ( typeID() == eventID ) { | 257 | if ( typeID() == eventID ) { |
240 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); | 258 | int len = dtStart().secsTo( ((Event*)this)->dtEnd()); |
241 | QTime tim = dtStart().time(); | 259 | QTime tim = dtStart().time(); |
242 | newInc->setDtStart( QDateTime(d, tim) ); | 260 | newInc->setDtStart( QDateTime(d, tim) ); |
243 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); | 261 | ((Event*)newInc)->setDtEnd( newInc->dtStart().addSecs( len ) ); |
244 | } else { | 262 | } else { |
245 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); | 263 | int len = dtStart().secsTo( ((Todo*)this)->dtDue()); |
246 | QTime tim = ((Todo*)this)->dtDue().time(); | 264 | QTime tim = ((Todo*)this)->dtDue().time(); |
247 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); | 265 | ((Todo*)newInc)->setDtDue( QDateTime(d, tim) ); |
248 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); | 266 | ((Todo*)newInc)->setDtStart( ((Todo*)newInc)->dtDue().addSecs( -len ) ); |
249 | ((Todo*)this)->setRecurDates(); | 267 | ((Todo*)this)->setRecurDates(); |
250 | } | 268 | } |
251 | newInc->setExDates( DateList () ); | 269 | newInc->setExDates( DateList () ); |
252 | } | 270 | } |
253 | return newInc; | 271 | return newInc; |
254 | } | 272 | } |
255 | 273 | ||
256 | void Incidence::recreate() | 274 | void Incidence::recreate() |
257 | { | 275 | { |
258 | setCreated(QDateTime::currentDateTime()); | 276 | setCreated(QDateTime::currentDateTime()); |
259 | 277 | ||
260 | setUid(CalFormat::createUniqueId()); | 278 | setUid(CalFormat::createUniqueId()); |
261 | 279 | ||
262 | setRevision(0); | 280 | setRevision(0); |
263 | setIDStr( ":" ); | 281 | setIDStr( ":" ); |
264 | setLastModified(QDateTime::currentDateTime()); | 282 | setLastModified(QDateTime::currentDateTime()); |
265 | } | 283 | } |
266 | void Incidence::cloneRelations( Incidence * newInc ) | 284 | void Incidence::cloneRelations( Incidence * newInc ) |
267 | { | 285 | { |
268 | // newInc is already a clone of this incidence | 286 | // newInc is already a clone of this incidence |
269 | Incidence * inc; | 287 | Incidence * inc; |
270 | Incidence * cloneInc; | 288 | Incidence * cloneInc; |
271 | QPtrList<Incidence> Relations = relations(); | 289 | QPtrList<Incidence> Relations = relations(); |
272 | for (inc=Relations.first();inc;inc=Relations.next()) { | 290 | for (inc=Relations.first();inc;inc=Relations.next()) { |
273 | cloneInc = inc->clone(); | 291 | cloneInc = inc->clone(); |
274 | cloneInc->recreate(); | 292 | cloneInc->recreate(); |
275 | cloneInc->setRelatedTo( newInc ); | 293 | cloneInc->setRelatedTo( newInc ); |
276 | inc->cloneRelations( cloneInc ); | 294 | inc->cloneRelations( cloneInc ); |
277 | } | 295 | } |
278 | } | 296 | } |
279 | void Incidence::setReadOnly( bool readOnly ) | 297 | void Incidence::setReadOnly( bool readOnly ) |
280 | { | 298 | { |
281 | IncidenceBase::setReadOnly( readOnly ); | 299 | IncidenceBase::setReadOnly( readOnly ); |
282 | recurrence()->setRecurReadOnly( readOnly); | 300 | if ( mRecurrence ) |
301 | mRecurrence->setRecurReadOnly( readOnly); | ||
283 | } | 302 | } |
284 | void Incidence::setLastModifiedSubInvalid() | 303 | void Incidence::setLastModifiedSubInvalid() |
285 | { | 304 | { |
286 | mLastModifiedSub = QDateTime(); | 305 | mLastModifiedSub = QDateTime(); |
287 | if ( mRelatedTo ) | 306 | if ( mRelatedTo ) |
288 | mRelatedTo->setLastModifiedSubInvalid(); | 307 | mRelatedTo->setLastModifiedSubInvalid(); |
289 | } | 308 | } |
290 | QDateTime Incidence::lastModifiedSub() | 309 | QDateTime Incidence::lastModifiedSub() |
291 | { | 310 | { |
292 | if ( !mRelations.count() ) | 311 | if ( !mRelations.count() ) |
293 | return lastModified(); | 312 | return lastModified(); |
294 | if ( mLastModifiedSub.isValid() ) | 313 | if ( mLastModifiedSub.isValid() ) |
295 | return mLastModifiedSub; | 314 | return mLastModifiedSub; |
296 | mLastModifiedSub = lastModified(); | 315 | mLastModifiedSub = lastModified(); |
297 | Incidence * inc; | 316 | Incidence * inc; |
298 | QPtrList<Incidence> Relations = relations(); | 317 | QPtrList<Incidence> Relations = relations(); |
299 | for (inc=Relations.first();inc;inc=Relations.next()) { | 318 | for (inc=Relations.first();inc;inc=Relations.next()) { |
300 | if ( inc->lastModifiedSub() > mLastModifiedSub ) | 319 | if ( inc->lastModifiedSub() > mLastModifiedSub ) |
301 | mLastModifiedSub = inc->lastModifiedSub(); | 320 | mLastModifiedSub = inc->lastModifiedSub(); |
302 | } | 321 | } |
303 | return mLastModifiedSub; | 322 | return mLastModifiedSub; |
304 | } | 323 | } |
305 | void Incidence::setCreated(QDateTime created) | 324 | void Incidence::setCreated(QDateTime created) |
306 | { | 325 | { |
307 | if (mReadOnly) return; | 326 | if (mReadOnly) return; |
308 | mCreated = getEvenTime(created); | 327 | mCreated = getEvenTime(created); |
309 | } | 328 | } |
310 | 329 | ||
311 | QDateTime Incidence::created() const | 330 | QDateTime Incidence::created() const |
312 | { | 331 | { |
313 | return mCreated; | 332 | return mCreated; |
314 | } | 333 | } |
315 | 334 | ||
316 | void Incidence::setRevision(int rev) | 335 | void Incidence::setRevision(int rev) |
317 | { | 336 | { |
318 | if (mReadOnly) return; | 337 | if (mReadOnly) return; |
319 | mRevision = rev; | 338 | mRevision = rev; |
320 | 339 | ||
321 | updated(); | 340 | updated(); |
322 | } | 341 | } |
323 | 342 | ||
324 | int Incidence::revision() const | 343 | int Incidence::revision() const |
325 | { | 344 | { |
326 | return mRevision; | 345 | return mRevision; |
327 | } | 346 | } |
328 | 347 | ||
329 | void Incidence::setDtStart(const QDateTime &dtStart) | 348 | void Incidence::setDtStart(const QDateTime &dtStart) |
330 | { | 349 | { |
331 | 350 | ||
332 | QDateTime dt = getEvenTime(dtStart); | 351 | QDateTime dt = getEvenTime(dtStart); |
333 | recurrence()->setRecurStart( dt); | 352 | |
353 | if ( mRecurrence ) | ||
354 | mRecurrence->setRecurStart( dt); | ||
334 | IncidenceBase::setDtStart( dt ); | 355 | IncidenceBase::setDtStart( dt ); |
335 | } | 356 | } |
336 | 357 | ||
337 | void Incidence::setDescription(const QString &description) | 358 | void Incidence::setDescription(const QString &description) |
338 | { | 359 | { |
339 | if (mReadOnly) return; | 360 | if (mReadOnly) return; |
340 | mDescription = description; | 361 | mDescription = description; |
341 | updated(); | 362 | updated(); |
342 | } | 363 | } |
343 | 364 | ||
344 | QString Incidence::description() const | 365 | QString Incidence::description() const |
345 | { | 366 | { |
346 | return mDescription; | 367 | return mDescription; |
347 | } | 368 | } |
348 | 369 | ||
349 | 370 | ||
350 | void Incidence::setSummary(const QString &summary) | 371 | void Incidence::setSummary(const QString &summary) |
351 | { | 372 | { |
352 | if (mReadOnly) return; | 373 | if (mReadOnly) return; |
353 | mSummary = summary; | 374 | mSummary = summary; |
354 | updated(); | 375 | updated(); |
355 | } | 376 | } |
356 | 377 | ||
357 | QString Incidence::summary() const | 378 | QString Incidence::summary() const |
358 | { | 379 | { |
359 | return mSummary; | 380 | return mSummary; |
360 | } | 381 | } |
361 | void Incidence::checkCategories() | 382 | void Incidence::checkCategories() |
362 | { | 383 | { |
363 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); | 384 | mHoliday = mCategories.contains("Holiday") || mCategories.contains(i18n("Holiday")); |
364 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); | 385 | mBirthday = mCategories.contains("Birthday") || mCategories.contains(i18n("Birthday")); |
365 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); | 386 | mAnniversary = mCategories.contains("Anniversary") || mCategories.contains(i18n("Anniversary")); |
366 | } | 387 | } |
367 | 388 | ||
368 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false | 389 | void Incidence::addCategories(const QStringList &categories, bool addToRelations ) //addToRelations = false |
369 | { | 390 | { |
370 | if (mReadOnly) return; | 391 | if (mReadOnly) return; |
371 | int i; | 392 | int i; |
372 | for( i = 0; i < categories.count(); ++i ) { | 393 | for( i = 0; i < categories.count(); ++i ) { |
373 | if ( !mCategories.contains (categories[i])) | 394 | if ( !mCategories.contains (categories[i])) |
374 | mCategories.append( categories[i] ); | 395 | mCategories.append( categories[i] ); |
375 | } | 396 | } |
376 | checkCategories(); | 397 | checkCategories(); |
377 | updated(); | 398 | updated(); |
378 | if ( addToRelations ) { | 399 | if ( addToRelations ) { |
379 | Incidence * inc; | 400 | Incidence * inc; |
380 | QPtrList<Incidence> Relations = relations(); | 401 | QPtrList<Incidence> Relations = relations(); |
381 | for (inc=Relations.first();inc;inc=Relations.next()) { | 402 | for (inc=Relations.first();inc;inc=Relations.next()) { |
382 | inc->addCategories( categories, true ); | 403 | inc->addCategories( categories, true ); |
383 | } | 404 | } |
384 | } | 405 | } |
385 | } | 406 | } |
386 | 407 | ||
387 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false | 408 | void Incidence::setCategories(const QStringList &categories, bool setForRelations ) //setForRelations = false |
388 | { | 409 | { |
389 | if (mReadOnly) return; | 410 | if (mReadOnly) return; |
390 | mCategories = categories; | 411 | mCategories = categories; |
391 | checkCategories(); | 412 | checkCategories(); |
392 | updated(); | 413 | updated(); |
393 | if ( setForRelations ) { | 414 | if ( setForRelations ) { |
394 | Incidence * inc; | 415 | Incidence * inc; |
395 | QPtrList<Incidence> Relations = relations(); | 416 | QPtrList<Incidence> Relations = relations(); |
396 | for (inc=Relations.first();inc;inc=Relations.next()) { | 417 | for (inc=Relations.first();inc;inc=Relations.next()) { |
397 | inc->setCategories( categories, true ); | 418 | inc->setCategories( categories, true ); |
@@ -443,137 +464,136 @@ void Incidence::setRelatedToUid(const QString &relatedToUid) | |||
443 | } | 464 | } |
444 | 465 | ||
445 | QString Incidence::relatedToUid() const | 466 | QString Incidence::relatedToUid() const |
446 | { | 467 | { |
447 | return mRelatedToUid; | 468 | return mRelatedToUid; |
448 | } | 469 | } |
449 | 470 | ||
450 | void Incidence::setRelatedTo(Incidence *relatedTo) | 471 | void Incidence::setRelatedTo(Incidence *relatedTo) |
451 | { | 472 | { |
452 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); | 473 | //qDebug("Incidence::setRelatedTo %d ", relatedTo); |
453 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); | 474 | //qDebug("setRelatedTo(Incidence *relatedTo) %s %s", summary().latin1(), relatedTo->summary().latin1() ); |
454 | if (mReadOnly || mRelatedTo == relatedTo) return; | 475 | if (mReadOnly || mRelatedTo == relatedTo) return; |
455 | if(mRelatedTo) { | 476 | if(mRelatedTo) { |
456 | // updated(); | 477 | // updated(); |
457 | mRelatedTo->removeRelation(this); | 478 | mRelatedTo->removeRelation(this); |
458 | } | 479 | } |
459 | mRelatedTo = relatedTo; | 480 | mRelatedTo = relatedTo; |
460 | if (mRelatedTo) { | 481 | if (mRelatedTo) { |
461 | mRelatedTo->addRelation(this); | 482 | mRelatedTo->addRelation(this); |
462 | mRelatedToUid = mRelatedTo->uid(); | 483 | mRelatedToUid = mRelatedTo->uid(); |
463 | } else { | 484 | } else { |
464 | mRelatedToUid = ""; | 485 | mRelatedToUid = ""; |
465 | } | 486 | } |
466 | } | 487 | } |
467 | 488 | ||
468 | Incidence *Incidence::relatedTo() const | 489 | Incidence *Incidence::relatedTo() const |
469 | { | 490 | { |
470 | return mRelatedTo; | 491 | return mRelatedTo; |
471 | } | 492 | } |
472 | 493 | ||
473 | QPtrList<Incidence> Incidence::relations() const | 494 | QPtrList<Incidence> Incidence::relations() const |
474 | { | 495 | { |
475 | return mRelations; | 496 | return mRelations; |
476 | } | 497 | } |
477 | 498 | ||
478 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) | 499 | void Incidence::addRelationsToList(QPtrList<Incidence> *rel) |
479 | { | 500 | { |
480 | Incidence* inc; | 501 | Incidence* inc; |
481 | QPtrList<Incidence> Relations = relations(); | 502 | QPtrList<Incidence> Relations = relations(); |
482 | for (inc=Relations.first();inc;inc=Relations.next()) { | 503 | for (inc=Relations.first();inc;inc=Relations.next()) { |
483 | inc->addRelationsToList( rel ); | 504 | inc->addRelationsToList( rel ); |
484 | } | 505 | } |
485 | if ( rel->findRef( this ) == -1 ) | 506 | if ( rel->findRef( this ) == -1 ) |
486 | rel->append( this ); | 507 | rel->append( this ); |
487 | } | 508 | } |
488 | 509 | ||
489 | void Incidence::addRelation(Incidence *event) | 510 | void Incidence::addRelation(Incidence *event) |
490 | { | 511 | { |
491 | setLastModifiedSubInvalid(); | 512 | setLastModifiedSubInvalid(); |
492 | if( mRelations.findRef( event ) == -1 ) { | 513 | if( mRelations.findRef( event ) == -1 ) { |
493 | mRelations.append(event); | 514 | mRelations.append(event); |
494 | //updated(); | 515 | //updated(); |
495 | } | 516 | } |
496 | } | 517 | } |
497 | 518 | ||
498 | void Incidence::removeRelation(Incidence *event) | 519 | void Incidence::removeRelation(Incidence *event) |
499 | { | 520 | { |
500 | setLastModifiedSubInvalid(); | 521 | setLastModifiedSubInvalid(); |
501 | mRelations.removeRef(event); | 522 | mRelations.removeRef(event); |
502 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); | 523 | // if (event->getRelatedTo() == this) event->setRelatedTo(0); |
503 | } | 524 | } |
504 | 525 | ||
505 | bool Incidence::recursOn(const QDate &qd) const | 526 | bool Incidence::recursOn(const QDate &qd) const |
506 | { | 527 | { |
507 | if (recurrence()->recursOnPure(qd) && !isException(qd)) return true; | 528 | if (mRecurrence && mRecurrence->recursOnPure(qd) && !isException(qd)) return true; |
508 | else return false; | 529 | else return false; |
509 | } | 530 | } |
510 | 531 | ||
511 | void Incidence::setExDates(const DateList &exDates) | 532 | void Incidence::setExDates(const DateList &exDates) |
512 | { | 533 | { |
513 | if (mReadOnly) return; | 534 | if (mReadOnly) return; |
514 | mExDates = exDates; | 535 | mExDates = exDates; |
515 | |||
516 | recurrence()->setRecurExDatesCount(mExDates.count()); | 536 | recurrence()->setRecurExDatesCount(mExDates.count()); |
517 | 537 | ||
518 | updated(); | 538 | updated(); |
519 | } | 539 | } |
520 | 540 | ||
521 | void Incidence::addExDate(const QDate &date) | 541 | void Incidence::addExDate(const QDate &date) |
522 | { | 542 | { |
523 | if (mReadOnly) return; | 543 | if (mReadOnly) return; |
524 | mExDates.append(date); | 544 | mExDates.append(date); |
525 | 545 | ||
526 | recurrence()->setRecurExDatesCount(mExDates.count()); | 546 | recurrence()->setRecurExDatesCount(mExDates.count()); |
527 | 547 | ||
528 | updated(); | 548 | updated(); |
529 | } | 549 | } |
530 | 550 | ||
531 | DateList Incidence::exDates() const | 551 | DateList Incidence::exDates() const |
532 | { | 552 | { |
533 | return mExDates; | 553 | return mExDates; |
534 | } | 554 | } |
535 | 555 | ||
536 | bool Incidence::isException(const QDate &date) const | 556 | bool Incidence::isException(const QDate &date) const |
537 | { | 557 | { |
538 | DateList::ConstIterator it; | 558 | DateList::ConstIterator it; |
539 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { | 559 | for( it = mExDates.begin(); it != mExDates.end(); ++it ) { |
540 | if ( (*it) == date ) { | 560 | if ( (*it) == date ) { |
541 | return true; | 561 | return true; |
542 | } | 562 | } |
543 | } | 563 | } |
544 | 564 | ||
545 | return false; | 565 | return false; |
546 | } | 566 | } |
547 | 567 | ||
548 | void Incidence::addAttachment(Attachment *attachment) | 568 | void Incidence::addAttachment(Attachment *attachment) |
549 | { | 569 | { |
550 | if (mReadOnly || !attachment) return; | 570 | if (mReadOnly || !attachment) return; |
551 | mAttachments.append(attachment); | 571 | mAttachments.append(attachment); |
552 | updated(); | 572 | updated(); |
553 | } | 573 | } |
554 | 574 | ||
555 | void Incidence::deleteAttachment(Attachment *attachment) | 575 | void Incidence::deleteAttachment(Attachment *attachment) |
556 | { | 576 | { |
557 | mAttachments.removeRef(attachment); | 577 | mAttachments.removeRef(attachment); |
558 | } | 578 | } |
559 | 579 | ||
560 | void Incidence::deleteAttachments(const QString& mime) | 580 | void Incidence::deleteAttachments(const QString& mime) |
561 | { | 581 | { |
562 | Attachment *at = mAttachments.first(); | 582 | Attachment *at = mAttachments.first(); |
563 | while (at) { | 583 | while (at) { |
564 | if (at->mimeType() == mime) | 584 | if (at->mimeType() == mime) |
565 | mAttachments.remove(); | 585 | mAttachments.remove(); |
566 | else | 586 | else |
567 | at = mAttachments.next(); | 587 | at = mAttachments.next(); |
568 | } | 588 | } |
569 | } | 589 | } |
570 | 590 | ||
571 | QPtrList<Attachment> Incidence::attachments() const | 591 | QPtrList<Attachment> Incidence::attachments() const |
572 | { | 592 | { |
573 | return mAttachments; | 593 | return mAttachments; |
574 | } | 594 | } |
575 | 595 | ||
576 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const | 596 | QPtrList<Attachment> Incidence::attachments(const QString& mime) const |
577 | { | 597 | { |
578 | QPtrList<Attachment> attachments; | 598 | QPtrList<Attachment> attachments; |
579 | QPtrListIterator<Attachment> it( mAttachments ); | 599 | QPtrListIterator<Attachment> it( mAttachments ); |
@@ -637,144 +657,155 @@ QString Incidence::secrecyName(int secrecy) | |||
637 | break; | 657 | break; |
638 | case SecrecyPrivate: | 658 | case SecrecyPrivate: |
639 | return i18n("Private"); | 659 | return i18n("Private"); |
640 | break; | 660 | break; |
641 | case SecrecyConfidential: | 661 | case SecrecyConfidential: |
642 | return i18n("Confidential"); | 662 | return i18n("Confidential"); |
643 | break; | 663 | break; |
644 | default: | 664 | default: |
645 | return i18n("Undefined"); | 665 | return i18n("Undefined"); |
646 | break; | 666 | break; |
647 | } | 667 | } |
648 | } | 668 | } |
649 | 669 | ||
650 | QStringList Incidence::secrecyList() | 670 | QStringList Incidence::secrecyList() |
651 | { | 671 | { |
652 | QStringList list; | 672 | QStringList list; |
653 | list << secrecyName(SecrecyPublic); | 673 | list << secrecyName(SecrecyPublic); |
654 | list << secrecyName(SecrecyPrivate); | 674 | list << secrecyName(SecrecyPrivate); |
655 | list << secrecyName(SecrecyConfidential); | 675 | list << secrecyName(SecrecyConfidential); |
656 | 676 | ||
657 | return list; | 677 | return list; |
658 | } | 678 | } |
659 | 679 | ||
660 | 680 | ||
661 | QPtrList<Alarm> Incidence::alarms() const | 681 | QPtrList<Alarm> Incidence::alarms() const |
662 | { | 682 | { |
663 | return mAlarms; | 683 | return mAlarms; |
664 | } | 684 | } |
665 | 685 | ||
666 | Alarm* Incidence::newAlarm() | 686 | Alarm* Incidence::newAlarm() |
667 | { | 687 | { |
668 | Alarm* alarm = new Alarm(this); | 688 | Alarm* alarm = new Alarm(this); |
669 | mAlarms.append(alarm); | 689 | mAlarms.append(alarm); |
670 | // updated(); | 690 | // updated(); |
671 | return alarm; | 691 | return alarm; |
672 | } | 692 | } |
673 | 693 | ||
674 | void Incidence::addAlarm(Alarm *alarm) | 694 | void Incidence::addAlarm(Alarm *alarm) |
675 | { | 695 | { |
676 | mAlarms.append(alarm); | 696 | mAlarms.append(alarm); |
677 | updated(); | 697 | updated(); |
678 | } | 698 | } |
679 | 699 | ||
680 | void Incidence::removeAlarm(Alarm *alarm) | 700 | void Incidence::removeAlarm(Alarm *alarm) |
681 | { | 701 | { |
682 | mAlarms.removeRef(alarm); | 702 | mAlarms.removeRef(alarm); |
683 | updated(); | 703 | updated(); |
684 | } | 704 | } |
685 | 705 | ||
686 | void Incidence::clearAlarms() | 706 | void Incidence::clearAlarms() |
687 | { | 707 | { |
688 | mAlarms.clear(); | 708 | mAlarms.clear(); |
689 | updated(); | 709 | updated(); |
690 | } | 710 | } |
691 | 711 | ||
692 | bool Incidence::isAlarmEnabled() const | 712 | bool Incidence::isAlarmEnabled() const |
693 | { | 713 | { |
694 | Alarm* alarm; | 714 | Alarm* alarm; |
695 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { | 715 | for (QPtrListIterator<Alarm> it(mAlarms); (alarm = it.current()) != 0; ++it) { |
696 | if (alarm->enabled()) | 716 | if (alarm->enabled()) |
697 | return true; | 717 | return true; |
698 | } | 718 | } |
699 | return false; | 719 | return false; |
700 | } | 720 | } |
701 | 721 | #include <stdlib.h> | |
702 | Recurrence *Incidence::recurrence() const | 722 | Recurrence *Incidence::recurrence() |
703 | { | 723 | { |
724 | if ( ! mRecurrence ) { | ||
725 | mRecurrence = new Recurrence(this); | ||
726 | qDebug("creating new recurence "); | ||
727 | //abort(); | ||
728 | } | ||
704 | return mRecurrence; | 729 | return mRecurrence; |
705 | } | 730 | } |
706 | void Incidence::setRecurrence( Recurrence * r) | 731 | void Incidence::setRecurrence( Recurrence * r) |
707 | { | 732 | { |
708 | delete mRecurrence; | 733 | if ( mRecurrence ) |
709 | mRecurrence = r; | 734 | delete mRecurrence; |
735 | mRecurrence = r; | ||
710 | } | 736 | } |
711 | 737 | ||
712 | void Incidence::setLocation(const QString &location) | 738 | void Incidence::setLocation(const QString &location) |
713 | { | 739 | { |
714 | if (mReadOnly) return; | 740 | if (mReadOnly) return; |
715 | mLocation = location; | 741 | mLocation = location; |
716 | updated(); | 742 | updated(); |
717 | } | 743 | } |
718 | 744 | ||
719 | QString Incidence::location() const | 745 | QString Incidence::location() const |
720 | { | 746 | { |
721 | return mLocation; | 747 | return mLocation; |
722 | } | 748 | } |
749 | QString Incidence::recurrenceText() const | ||
750 | { | ||
751 | if ( mRecurrence ) return mRecurrence->recurrenceText(); | ||
752 | return i18n("No"); | ||
753 | } | ||
723 | 754 | ||
724 | ushort Incidence::doesRecur() const | 755 | ushort Incidence::doesRecur() const |
725 | { | 756 | { |
726 | if ( mRecurrence ) return mRecurrence->doesRecur(); | 757 | if ( mRecurrence ) return mRecurrence->doesRecur(); |
727 | else return Recurrence::rNone; | 758 | else return Recurrence::rNone; |
728 | } | 759 | } |
729 | 760 | ||
730 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const | 761 | QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const |
731 | { | 762 | { |
732 | QDateTime incidenceStart = dt; | 763 | QDateTime incidenceStart = dt; |
733 | *ok = false; | 764 | *ok = false; |
734 | if ( doesRecur() ) { | 765 | if ( doesRecur() ) { |
735 | bool last; | 766 | bool last; |
736 | recurrence()->getPreviousDateTime( incidenceStart , &last ); | 767 | mRecurrence->getPreviousDateTime( incidenceStart , &last ); |
737 | int count = 0; | 768 | int count = 0; |
738 | if ( !last ) { | 769 | if ( !last ) { |
739 | while ( !last ) { | 770 | while ( !last ) { |
740 | ++count; | 771 | ++count; |
741 | incidenceStart = recurrence()->getNextDateTime( incidenceStart, &last ); | 772 | incidenceStart = mRecurrence->getNextDateTime( incidenceStart, &last ); |
742 | if ( recursOn( incidenceStart.date() ) ) { | 773 | if ( recursOn( incidenceStart.date() ) ) { |
743 | last = true; // exit while llop | 774 | last = true; // exit while llop |
744 | } else { | 775 | } else { |
745 | if ( last ) { // no alarm on last recurrence | 776 | if ( last ) { // no alarm on last recurrence |
746 | return QDateTime (); | 777 | return QDateTime (); |
747 | } | 778 | } |
748 | int year = incidenceStart.date().year(); | 779 | int year = incidenceStart.date().year(); |
749 | // workaround for bug in recurrence | 780 | // workaround for bug in recurrence |
750 | if ( count == 100 || year < 1000 || year > 5000 ) { | 781 | if ( count == 100 || year < 1000 || year > 5000 ) { |
751 | return QDateTime (); | 782 | return QDateTime (); |
752 | } | 783 | } |
753 | incidenceStart = incidenceStart.addSecs( 1 ); | 784 | incidenceStart = incidenceStart.addSecs( 1 ); |
754 | } | 785 | } |
755 | } | 786 | } |
756 | } else { | 787 | } else { |
757 | return QDateTime (); | 788 | return QDateTime (); |
758 | } | 789 | } |
759 | } else { | 790 | } else { |
760 | if ( hasStartDate () ) { | 791 | if ( hasStartDate () ) { |
761 | incidenceStart = dtStart(); | 792 | incidenceStart = dtStart(); |
762 | } | 793 | } |
763 | if ( typeID() == todoID ) { | 794 | if ( typeID() == todoID ) { |
764 | if ( ((Todo*)this)->hasDueDate() ) | 795 | if ( ((Todo*)this)->hasDueDate() ) |
765 | incidenceStart = ((Todo*)this)->dtDue(); | 796 | incidenceStart = ((Todo*)this)->dtDue(); |
766 | } | 797 | } |
767 | } | 798 | } |
768 | if ( incidenceStart > dt ) | 799 | if ( incidenceStart > dt ) |
769 | *ok = true; | 800 | *ok = true; |
770 | return incidenceStart; | 801 | return incidenceStart; |
771 | } | 802 | } |
772 | QDateTime Incidence::dtStart() const | 803 | QDateTime Incidence::dtStart() const |
773 | { | 804 | { |
774 | if ( doesRecur() ) { | 805 | if ( doesRecur() ) { |
775 | if ( typeID() == todoID ) { | 806 | if ( typeID() == todoID ) { |
776 | ((Todo*)this)->checkSetCompletedFalse(); | 807 | ((Todo*)this)->checkSetCompletedFalse(); |
777 | } | 808 | } |
778 | } | 809 | } |
779 | return mDtStart; | 810 | return mDtStart; |
780 | } | 811 | } |
diff --git a/libkcal/incidence.h b/libkcal/incidence.h index d4af9f0..8519f01 100644 --- a/libkcal/incidence.h +++ b/libkcal/incidence.h | |||
@@ -188,134 +188,135 @@ class Incidence : public IncidenceBase | |||
188 | void setExDates(const char *dates); | 188 | void setExDates(const char *dates); |
189 | /** Add a date to the list of exceptions of the recurrence rule. */ | 189 | /** Add a date to the list of exceptions of the recurrence rule. */ |
190 | void addExDate(const QDate &date); | 190 | void addExDate(const QDate &date); |
191 | 191 | ||
192 | /** returns true if there is an exception for this date in the recurrence | 192 | /** returns true if there is an exception for this date in the recurrence |
193 | rule set, or false otherwise. */ | 193 | rule set, or false otherwise. */ |
194 | bool isException(const QDate &qd) const; | 194 | bool isException(const QDate &qd) const; |
195 | 195 | ||
196 | /** add attachment to this event */ | 196 | /** add attachment to this event */ |
197 | void addAttachment(Attachment *attachment); | 197 | void addAttachment(Attachment *attachment); |
198 | /** remove and delete a specific attachment */ | 198 | /** remove and delete a specific attachment */ |
199 | void deleteAttachment(Attachment *attachment); | 199 | void deleteAttachment(Attachment *attachment); |
200 | /** remove and delete all attachments with this mime type */ | 200 | /** remove and delete all attachments with this mime type */ |
201 | void deleteAttachments(const QString& mime); | 201 | void deleteAttachments(const QString& mime); |
202 | /** return list of all associated attachments */ | 202 | /** return list of all associated attachments */ |
203 | QPtrList<Attachment> attachments() const; | 203 | QPtrList<Attachment> attachments() const; |
204 | /** find a list of attachments with this mime type */ | 204 | /** find a list of attachments with this mime type */ |
205 | QPtrList<Attachment> attachments(const QString& mime) const; | 205 | QPtrList<Attachment> attachments(const QString& mime) const; |
206 | 206 | ||
207 | /** sets the event's status the value specified. See the enumeration | 207 | /** sets the event's status the value specified. See the enumeration |
208 | * above for possible values. */ | 208 | * above for possible values. */ |
209 | void setSecrecy(int); | 209 | void setSecrecy(int); |
210 | /** return the event's secrecy. */ | 210 | /** return the event's secrecy. */ |
211 | int secrecy() const; | 211 | int secrecy() const; |
212 | /** return the event's secrecy in string format. */ | 212 | /** return the event's secrecy in string format. */ |
213 | QString secrecyStr() const; | 213 | QString secrecyStr() const; |
214 | /** return list of all availbale secrecy classes */ | 214 | /** return list of all availbale secrecy classes */ |
215 | static QStringList secrecyList(); | 215 | static QStringList secrecyList(); |
216 | /** return human-readable name of secrecy class */ | 216 | /** return human-readable name of secrecy class */ |
217 | static QString secrecyName(int); | 217 | static QString secrecyName(int); |
218 | 218 | ||
219 | /** returns TRUE if the date specified is one on which the event will | 219 | /** returns TRUE if the date specified is one on which the event will |
220 | * recur. */ | 220 | * recur. */ |
221 | bool recursOn(const QDate &qd) const; | 221 | bool recursOn(const QDate &qd) const; |
222 | 222 | ||
223 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): | 223 | // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): |
224 | 224 | ||
225 | /** set resources used, such as Office, Car, etc. */ | 225 | /** set resources used, such as Office, Car, etc. */ |
226 | void setResources(const QStringList &resources); | 226 | void setResources(const QStringList &resources); |
227 | /** return list of current resources */ | 227 | /** return list of current resources */ |
228 | QStringList resources() const; | 228 | QStringList resources() const; |
229 | 229 | ||
230 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ | 230 | /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ |
231 | void setPriority(int priority); | 231 | void setPriority(int priority); |
232 | /** get the event's priority */ | 232 | /** get the event's priority */ |
233 | int priority() const; | 233 | int priority() const; |
234 | 234 | ||
235 | /** All alarms that are associated with this incidence */ | 235 | /** All alarms that are associated with this incidence */ |
236 | QPtrList<Alarm> alarms() const; | 236 | QPtrList<Alarm> alarms() const; |
237 | /** Create a new alarm which is associated with this incidence */ | 237 | /** Create a new alarm which is associated with this incidence */ |
238 | Alarm* newAlarm(); | 238 | Alarm* newAlarm(); |
239 | /** Add an alarm which is associated with this incidence */ | 239 | /** Add an alarm which is associated with this incidence */ |
240 | void addAlarm(Alarm*); | 240 | void addAlarm(Alarm*); |
241 | /** Remove an alarm that is associated with this incidence */ | 241 | /** Remove an alarm that is associated with this incidence */ |
242 | void removeAlarm(Alarm*); | 242 | void removeAlarm(Alarm*); |
243 | /** Remove all alarms that are associated with this incidence */ | 243 | /** Remove all alarms that are associated with this incidence */ |
244 | void clearAlarms(); | 244 | void clearAlarms(); |
245 | /** return whether any alarm associated with this incidence is enabled */ | 245 | /** return whether any alarm associated with this incidence is enabled */ |
246 | bool isAlarmEnabled() const; | 246 | bool isAlarmEnabled() const; |
247 | 247 | ||
248 | /** | 248 | /** |
249 | Return the recurrence rule associated with this incidence. If there is | 249 | Return the recurrence rule associated with this incidence. If there is |
250 | none, returns an appropriate (non-0) object. | 250 | none, returns an appropriate (non-0) object. |
251 | */ | 251 | */ |
252 | Recurrence *recurrence() const; | 252 | Recurrence *recurrence(); |
253 | void setRecurrence(Recurrence * r); | 253 | void setRecurrence(Recurrence * r); |
254 | /** | 254 | /** |
255 | Forward to Recurrence::doesRecur(). | 255 | Forward to Recurrence::doesRecur(). |
256 | */ | 256 | */ |
257 | ushort doesRecur() const; | 257 | ushort doesRecur() const; |
258 | 258 | ||
259 | /** set the event's/todo's location. Do _not_ use it with journal */ | 259 | /** set the event's/todo's location. Do _not_ use it with journal */ |
260 | void setLocation(const QString &location); | 260 | void setLocation(const QString &location); |
261 | /** return the event's/todo's location. Do _not_ use it with journal */ | 261 | /** return the event's/todo's location. Do _not_ use it with journal */ |
262 | QString location() const; | 262 | QString location() const; |
263 | /** returns TRUE or FALSE depending on whether the todo has a start date */ | 263 | /** returns TRUE or FALSE depending on whether the todo has a start date */ |
264 | bool hasStartDate() const; | 264 | bool hasStartDate() const; |
265 | /** sets the event's hasStartDate value. */ | 265 | /** sets the event's hasStartDate value. */ |
266 | void setHasStartDate(bool f); | 266 | void setHasStartDate(bool f); |
267 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; | 267 | QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; |
268 | bool cancelled() const; | 268 | bool cancelled() const; |
269 | void setCancelled( bool b ); | 269 | void setCancelled( bool b ); |
270 | 270 | ||
271 | bool hasRecurrenceID() const; | 271 | bool hasRecurrenceID() const; |
272 | void setHasRecurrenceID( bool b ); | 272 | void setHasRecurrenceID( bool b ); |
273 | 273 | ||
274 | void setRecurrenceID(QDateTime); | 274 | void setRecurrenceID(QDateTime); |
275 | QDateTime recurrenceID () const; | 275 | QDateTime recurrenceID () const; |
276 | QDateTime dtStart() const; | 276 | QDateTime dtStart() const; |
277 | bool isHoliday() const; | 277 | bool isHoliday() const; |
278 | bool isBirthday() const; | 278 | bool isBirthday() const; |
279 | bool isAnniversary() const; | 279 | bool isAnniversary() const; |
280 | QDateTime lastModifiedSub(); | 280 | QDateTime lastModifiedSub(); |
281 | QString recurrenceText() const; | ||
281 | void setLastModifiedSubInvalid(); | 282 | void setLastModifiedSubInvalid(); |
282 | 283 | ||
283 | 284 | ||
285 | Recurrence *mRecurrence; | ||
284 | protected: | 286 | protected: |
285 | QPtrList<Alarm> mAlarms; | 287 | QPtrList<Alarm> mAlarms; |
286 | QPtrList<Incidence> mRelations; | 288 | QPtrList<Incidence> mRelations; |
287 | QDateTime mRecurrenceID; | 289 | QDateTime mRecurrenceID; |
288 | bool mHasRecurrenceID; | 290 | bool mHasRecurrenceID; |
289 | private: | 291 | private: |
290 | void checkCategories(); | 292 | void checkCategories(); |
291 | bool mHoliday, mBirthday, mAnniversary; | 293 | bool mHoliday, mBirthday, mAnniversary; |
292 | int mRevision; | 294 | int mRevision; |
293 | bool mCancelled; | 295 | bool mCancelled; |
294 | 296 | ||
295 | // base components of jounal, event and todo | 297 | // base components of jounal, event and todo |
296 | QDateTime mCreated; | 298 | QDateTime mCreated; |
297 | QDateTime mLastModifiedSub; | 299 | QDateTime mLastModifiedSub; |
298 | QString mDescription; | 300 | QString mDescription; |
299 | QString mSummary; | 301 | QString mSummary; |
300 | QStringList mCategories; | 302 | QStringList mCategories; |
301 | Incidence *mRelatedTo; | 303 | Incidence *mRelatedTo; |
302 | QString mRelatedToUid; | 304 | QString mRelatedToUid; |
303 | DateList mExDates; | 305 | DateList mExDates; |
304 | QPtrList<Attachment> mAttachments; | 306 | QPtrList<Attachment> mAttachments; |
305 | QStringList mResources; | 307 | QStringList mResources; |
306 | bool mHasStartDate; // if todo has associated start date | 308 | bool mHasStartDate; // if todo has associated start date |
307 | 309 | ||
308 | int mSecrecy; | 310 | int mSecrecy; |
309 | int mPriority; // 1 = highest, 2 = less, etc. | 311 | int mPriority; // 1 = highest, 2 = less, etc. |
310 | 312 | ||
311 | //QPtrList<Alarm> mAlarms; | 313 | //QPtrList<Alarm> mAlarms; |
312 | Recurrence *mRecurrence; | ||
313 | 314 | ||
314 | QString mLocation; | 315 | QString mLocation; |
315 | }; | 316 | }; |
316 | 317 | ||
317 | bool operator==( const Incidence&, const Incidence& ); | 318 | bool operator==( const Incidence&, const Incidence& ); |
318 | 319 | ||
319 | } | 320 | } |
320 | 321 | ||
321 | #endif | 322 | #endif |
diff --git a/libkcal/kincidenceformatter.cpp b/libkcal/kincidenceformatter.cpp index 9359fad..f8f40f1 100644 --- a/libkcal/kincidenceformatter.cpp +++ b/libkcal/kincidenceformatter.cpp | |||
@@ -44,240 +44,240 @@ KIncidenceFormatter::~KIncidenceFormatter() | |||
44 | KIncidenceFormatter::KIncidenceFormatter() | 44 | KIncidenceFormatter::KIncidenceFormatter() |
45 | { | 45 | { |
46 | mColorMode = 0; | 46 | mColorMode = 0; |
47 | } | 47 | } |
48 | void KIncidenceFormatter::setEvent(Event *event) | 48 | void KIncidenceFormatter::setEvent(Event *event) |
49 | { | 49 | { |
50 | int mode = 0; | 50 | int mode = 0; |
51 | mCurrentIncidence = event; | 51 | mCurrentIncidence = event; |
52 | bool shortDate = true; | 52 | bool shortDate = true; |
53 | if ( mode == 0 ) { | 53 | if ( mode == 0 ) { |
54 | addTag("h3",deTag(event->summary())); | 54 | addTag("h3",deTag(event->summary())); |
55 | formatReadOnly(event); | 55 | formatReadOnly(event); |
56 | } | 56 | } |
57 | else { | 57 | else { |
58 | if ( mColorMode == 1 ) { | 58 | if ( mColorMode == 1 ) { |
59 | mText +="<font color=\"#00A000\">"; | 59 | mText +="<font color=\"#00A000\">"; |
60 | } | 60 | } |
61 | if ( mColorMode == 2 ) { | 61 | if ( mColorMode == 2 ) { |
62 | mText +="<font color=\"#C00000\">"; | 62 | mText +="<font color=\"#C00000\">"; |
63 | } | 63 | } |
64 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; | 64 | // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; |
65 | if ( mode == 1 ) { | 65 | if ( mode == 1 ) { |
66 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 66 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
67 | } else { | 67 | } else { |
68 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 68 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
69 | } | 69 | } |
70 | formatReadOnly(event); | 70 | formatReadOnly(event); |
71 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 71 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
72 | if ( mColorMode ) | 72 | if ( mColorMode ) |
73 | mText += "</font>"; | 73 | mText += "</font>"; |
74 | } | 74 | } |
75 | if (event->cancelled ()) { | 75 | if (event->cancelled ()) { |
76 | mText +="<font color=\"#B00000\">"; | 76 | mText +="<font color=\"#B00000\">"; |
77 | addTag("i",i18n("This event has been cancelled!")); | 77 | addTag("i",i18n("This event has been cancelled!")); |
78 | mText.append("<br>"); | 78 | mText.append("<br>"); |
79 | mText += "</font>"; | 79 | mText += "</font>"; |
80 | } | 80 | } |
81 | if (event->doesFloat()) { | 81 | if (event->doesFloat()) { |
82 | if (event->isMultiDay()) { | 82 | if (event->isMultiDay()) { |
83 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") | 83 | mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") |
84 | .arg(event->dtStartDateStr(shortDate)) | 84 | .arg(event->dtStartDateStr(shortDate)) |
85 | .arg(event->dtEndDateStr(shortDate))); | 85 | .arg(event->dtEndDateStr(shortDate))); |
86 | } else { | 86 | } else { |
87 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); | 87 | mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); |
88 | } | 88 | } |
89 | } else { | 89 | } else { |
90 | if (event->isMultiDay()) { | 90 | if (event->isMultiDay()) { |
91 | mText.append(i18n("<p><b>From:</b> %1</p> ") | 91 | mText.append(i18n("<p><b>From:</b> %1</p> ") |
92 | .arg(event->dtStartStr( shortDate))); | 92 | .arg(event->dtStartStr( shortDate))); |
93 | mText.append(i18n("<p><b>To:</b> %1</p>") | 93 | mText.append(i18n("<p><b>To:</b> %1</p>") |
94 | .arg(event->dtEndStr(shortDate))); | 94 | .arg(event->dtEndStr(shortDate))); |
95 | } else { | 95 | } else { |
96 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") | 96 | mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") |
97 | .arg(event->dtStartTimeStr()) | 97 | .arg(event->dtStartTimeStr()) |
98 | .arg(event->dtEndTimeStr())); | 98 | .arg(event->dtEndTimeStr())); |
99 | mText.append(i18n("<p><b>On:</b> %1</p> ") | 99 | mText.append(i18n("<p><b>On:</b> %1</p> ") |
100 | .arg(event->dtStartDateStr( shortDate ))); | 100 | .arg(event->dtStartDateStr( shortDate ))); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | if (!event->location().isEmpty()) { | 103 | if (!event->location().isEmpty()) { |
104 | addTag("b",i18n("Location: ")); | 104 | addTag("b",i18n("Location: ")); |
105 | mText.append(deTag(event->location())+"<br>"); | 105 | mText.append(deTag(event->location())+"<br>"); |
106 | } | 106 | } |
107 | 107 | ||
108 | if (event->recurrence()->doesRecur()) { | 108 | if (event->doesRecur()) { |
109 | 109 | ||
110 | QString recurText = event->recurrence()->recurrenceText(); | 110 | QString recurText = event->recurrence()->recurrenceText(); |
111 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); | 111 | addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); |
112 | 112 | ||
113 | bool ok; | 113 | bool ok; |
114 | QDate start = QDate::currentDate(); | 114 | QDate start = QDate::currentDate(); |
115 | QDateTime next; | 115 | QDateTime next; |
116 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); | 116 | next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); |
117 | if ( ok ) { | 117 | if ( ok ) { |
118 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); | 118 | addTag("p",i18n("<b>Next recurrence is on:</b>") ); |
119 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); | 119 | addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); |
120 | 120 | ||
121 | } else { | 121 | } else { |
122 | bool last; | 122 | bool last; |
123 | QDate nextd; | 123 | QDate nextd; |
124 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); | 124 | nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); |
125 | if ( last ) { | 125 | if ( last ) { |
126 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); | 126 | addTag("p",i18n("<b>Last recurrence was on:</b>") ); |
127 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); | 127 | addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); |
128 | } | 128 | } |
129 | } | 129 | } |
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | if (event->isAlarmEnabled()) { | 133 | if (event->isAlarmEnabled()) { |
134 | Alarm *alarm =event->alarms().first() ; | 134 | Alarm *alarm =event->alarms().first() ; |
135 | QDateTime t = alarm->time(); | 135 | QDateTime t = alarm->time(); |
136 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 136 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
137 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); | 137 | addTag("p",i18n("<b>Alarm on: </b>") + s + ": "+KGlobal::locale()->formatDateTime( t, shortDate )); |
138 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 138 | //addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
139 | //addTag("p",s); | 139 | //addTag("p",s); |
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | 143 | ||
144 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 144 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
145 | // mText.append(event->secrecyStr()+"<br>"); | 145 | // mText.append(event->secrecyStr()+"<br>"); |
146 | formatCategories(event); | 146 | formatCategories(event); |
147 | 147 | ||
148 | formatAttendees(event); | 148 | formatAttendees(event); |
149 | 149 | ||
150 | if ( mCreated ) { | 150 | if ( mCreated ) { |
151 | #ifdef DESKTOP_VERSION | 151 | #ifdef DESKTOP_VERSION |
152 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 152 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
153 | #else | 153 | #else |
154 | addTag("p",i18n("<b>Created: ") +" </b>"); | 154 | addTag("p",i18n("<b>Created: ") +" </b>"); |
155 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 155 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | } | 158 | } |
159 | if ( mModified ) { | 159 | if ( mModified ) { |
160 | #ifdef DESKTOP_VERSION | 160 | #ifdef DESKTOP_VERSION |
161 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 161 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
162 | #else | 162 | #else |
163 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 163 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
164 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 164 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
165 | #endif | 165 | #endif |
166 | 166 | ||
167 | } | 167 | } |
168 | if ( mDetails ) { | 168 | if ( mDetails ) { |
169 | if (!event->description().isEmpty()) { | 169 | if (!event->description().isEmpty()) { |
170 | addTag("p",i18n("<b>Details: </b>")); | 170 | addTag("p",i18n("<b>Details: </b>")); |
171 | addTag("p",deTag(event->description())); | 171 | addTag("p",deTag(event->description())); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | 174 | ||
175 | } | 175 | } |
176 | 176 | ||
177 | void KIncidenceFormatter::setTodo(Todo *event ) | 177 | void KIncidenceFormatter::setTodo(Todo *event ) |
178 | { | 178 | { |
179 | int mode = 0; | 179 | int mode = 0; |
180 | mCurrentIncidence = event; | 180 | mCurrentIncidence = event; |
181 | bool shortDate = true; | 181 | bool shortDate = true; |
182 | if (mode == 0 ) { | 182 | if (mode == 0 ) { |
183 | addTag("h3",deTag(event->summary())); | 183 | addTag("h3",deTag(event->summary())); |
184 | formatReadOnly(event); | 184 | formatReadOnly(event); |
185 | } | 185 | } |
186 | else { | 186 | else { |
187 | if ( mColorMode == 1 ) { | 187 | if ( mColorMode == 1 ) { |
188 | mText +="<font color=\"#00A000\">"; | 188 | mText +="<font color=\"#00A000\">"; |
189 | } | 189 | } |
190 | if ( mColorMode == 2 ) { | 190 | if ( mColorMode == 2 ) { |
191 | mText +="<font color=\"#B00000\">"; | 191 | mText +="<font color=\"#B00000\">"; |
192 | } | 192 | } |
193 | if ( mode == 1 ) { | 193 | if ( mode == 1 ) { |
194 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); | 194 | addTag("h2",i18n( "Local: " ) +deTag(event->summary())); |
195 | } else { | 195 | } else { |
196 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); | 196 | addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); |
197 | } | 197 | } |
198 | formatReadOnly(event); | 198 | formatReadOnly(event); |
199 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); | 199 | addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); |
200 | if ( mColorMode ) | 200 | if ( mColorMode ) |
201 | mText += "</font>"; | 201 | mText += "</font>"; |
202 | } | 202 | } |
203 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { | 203 | if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { |
204 | mText +="<font color=\"#B00000\">"; | 204 | mText +="<font color=\"#B00000\">"; |
205 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); | 205 | addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(shortDate) ) ); |
206 | mText += "</font>"; | 206 | mText += "</font>"; |
207 | } else { | 207 | } else { |
208 | mText.append(i18n("<p><i>%1 % completed</i></p>") | 208 | mText.append(i18n("<p><i>%1 % completed</i></p>") |
209 | .arg(event->percentComplete())); | 209 | .arg(event->percentComplete())); |
210 | } | 210 | } |
211 | if (event->cancelled ()) { | 211 | if (event->cancelled ()) { |
212 | mText +="<font color=\"#B00000\">"; | 212 | mText +="<font color=\"#B00000\">"; |
213 | addTag("i",i18n("This todo has been cancelled!")); | 213 | addTag("i",i18n("This todo has been cancelled!")); |
214 | mText.append("<br>"); | 214 | mText.append("<br>"); |
215 | mText += "</font>"; | 215 | mText += "</font>"; |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | if (event->recurrence()->doesRecur()) { | 219 | if (event->doesRecur()) { |
220 | 220 | ||
221 | QString recurText = event->recurrence()->recurrenceText(); | 221 | QString recurText = event->recurrence()->recurrenceText(); |
222 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); | 222 | addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); |
223 | } | 223 | } |
224 | 224 | ||
225 | if (event->hasStartDate()) { | 225 | if (event->hasStartDate()) { |
226 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); | 226 | mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(shortDate))); |
227 | } | 227 | } |
228 | 228 | ||
229 | 229 | ||
230 | if (event->hasDueDate()) { | 230 | if (event->hasDueDate()) { |
231 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); | 231 | mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(shortDate))); |
232 | } | 232 | } |
233 | 233 | ||
234 | if (!event->location().isEmpty()) { | 234 | if (!event->location().isEmpty()) { |
235 | addTag("b",i18n("Location: ")); | 235 | addTag("b",i18n("Location: ")); |
236 | mText.append(deTag(event->location())+"<br>"); | 236 | mText.append(deTag(event->location())+"<br>"); |
237 | } | 237 | } |
238 | 238 | ||
239 | mText.append(i18n("<p><b>Priority:</b> %2</p>") | 239 | mText.append(i18n("<p><b>Priority:</b> %2</p>") |
240 | .arg(QString::number(event->priority()))); | 240 | .arg(QString::number(event->priority()))); |
241 | 241 | ||
242 | if (event->isAlarmEnabled()) { | 242 | if (event->isAlarmEnabled()) { |
243 | Alarm *alarm =event->alarms().first() ; | 243 | Alarm *alarm =event->alarms().first() ; |
244 | QDateTime t = alarm->time(); | 244 | QDateTime t = alarm->time(); |
245 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); | 245 | QString s =i18n("( %1 before )").arg( alarm->offsetText() ); |
246 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); | 246 | addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); |
247 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); | 247 | addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); |
248 | //addTag("p",s); | 248 | //addTag("p",s); |
249 | } | 249 | } |
250 | 250 | ||
251 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); | 251 | addTag("p",i18n("<b>Access: </b>") +event->secrecyStr() ); |
252 | formatCategories(event); | 252 | formatCategories(event); |
253 | 253 | ||
254 | formatAttendees(event); | 254 | formatAttendees(event); |
255 | if ( mCreated ) { | 255 | if ( mCreated ) { |
256 | #ifdef DESKTOP_VERSION | 256 | #ifdef DESKTOP_VERSION |
257 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 257 | addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
258 | #else | 258 | #else |
259 | addTag("p",i18n("<b>Created: ") +" </b>"); | 259 | addTag("p",i18n("<b>Created: ") +" </b>"); |
260 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); | 260 | addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); |
261 | #endif | 261 | #endif |
262 | 262 | ||
263 | } | 263 | } |
264 | if ( mModified ) { | 264 | if ( mModified ) { |
265 | #ifdef DESKTOP_VERSION | 265 | #ifdef DESKTOP_VERSION |
266 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 266 | addTag("p",i18n("<b>Last modified: ") +" </b>"+KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
267 | #else | 267 | #else |
268 | addTag("p",i18n("<b>Last modified: ") +" </b>"); | 268 | addTag("p",i18n("<b>Last modified: ") +" </b>"); |
269 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); | 269 | addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); |
270 | #endif | 270 | #endif |
271 | 271 | ||
272 | } | 272 | } |
273 | if ( mDetails ) { | 273 | if ( mDetails ) { |
274 | if (!event->description().isEmpty()) { | 274 | if (!event->description().isEmpty()) { |
275 | addTag("p",i18n("<b>Details: </b>")); | 275 | addTag("p",i18n("<b>Details: </b>")); |
276 | addTag("p",deTag(event->description())); | 276 | addTag("p",deTag(event->description())); |
277 | } | 277 | } |
278 | } | 278 | } |
279 | } | 279 | } |
280 | 280 | ||
281 | void KIncidenceFormatter::setJournal(Journal* ) | 281 | void KIncidenceFormatter::setJournal(Journal* ) |
282 | { | 282 | { |
283 | 283 | ||
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 8efc1ea..2e19740 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -331,196 +331,196 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
331 | anEvent->relatedToUid().local8Bit()); | 331 | anEvent->relatedToUid().local8Bit()); |
332 | } | 332 | } |
333 | 333 | ||
334 | // categories | 334 | // categories |
335 | QStringList tmpStrList = anEvent->categories(); | 335 | QStringList tmpStrList = anEvent->categories(); |
336 | tmpStr = ""; | 336 | tmpStr = ""; |
337 | QString catStr; | 337 | QString catStr; |
338 | for ( QStringList::Iterator it = tmpStrList.begin(); | 338 | for ( QStringList::Iterator it = tmpStrList.begin(); |
339 | it != tmpStrList.end(); | 339 | it != tmpStrList.end(); |
340 | ++it ) { | 340 | ++it ) { |
341 | catStr = *it; | 341 | catStr = *it; |
342 | if (catStr[0] == ' ') | 342 | if (catStr[0] == ' ') |
343 | tmpStr += catStr.mid(1); | 343 | tmpStr += catStr.mid(1); |
344 | else | 344 | else |
345 | tmpStr += catStr; | 345 | tmpStr += catStr; |
346 | // this must be a ';' character as the vCalendar specification requires! | 346 | // this must be a ';' character as the vCalendar specification requires! |
347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is | 347 | // vcc.y has been hacked to translate the ';' to a ',' when the vcal is |
348 | // read in. | 348 | // read in. |
349 | tmpStr += ";"; | 349 | tmpStr += ";"; |
350 | } | 350 | } |
351 | if (!tmpStr.isEmpty()) { | 351 | if (!tmpStr.isEmpty()) { |
352 | tmpStr.truncate(tmpStr.length()-1); | 352 | tmpStr.truncate(tmpStr.length()-1); |
353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); | 353 | addPropValue(vtodo, VCCategoriesProp, tmpStr.local8Bit()); |
354 | } | 354 | } |
355 | 355 | ||
356 | // alarm stuff | 356 | // alarm stuff |
357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; | 357 | kdDebug(5800) << "vcalformat::eventToVTodo was called" << endl; |
358 | QPtrList<Alarm> alarms = anEvent->alarms(); | 358 | QPtrList<Alarm> alarms = anEvent->alarms(); |
359 | Alarm* alarm; | 359 | Alarm* alarm; |
360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 360 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
361 | if (alarm->enabled()) { | 361 | if (alarm->enabled()) { |
362 | VObject *a; | 362 | VObject *a; |
363 | tmpStr = qDateTimeToISO(alarm->time()); | 363 | tmpStr = qDateTimeToISO(alarm->time()); |
364 | if (alarm->type() == Alarm::Audio) { | 364 | if (alarm->type() == Alarm::Audio) { |
365 | a = addProp(vtodo, VCAAlarmProp); | 365 | a = addProp(vtodo, VCAAlarmProp); |
366 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 366 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
367 | addPropValue(a, VCRepeatCountProp, "1"); | 367 | addPropValue(a, VCRepeatCountProp, "1"); |
368 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); | 368 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); |
369 | } | 369 | } |
370 | else if (alarm->type() == Alarm::Procedure) { | 370 | else if (alarm->type() == Alarm::Procedure) { |
371 | a = addProp(vtodo, VCPAlarmProp); | 371 | a = addProp(vtodo, VCPAlarmProp); |
372 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 372 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
373 | addPropValue(a, VCRepeatCountProp, "1"); | 373 | addPropValue(a, VCRepeatCountProp, "1"); |
374 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); | 374 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); |
375 | } else { | 375 | } else { |
376 | a = addProp(vtodo, VCDAlarmProp); | 376 | a = addProp(vtodo, VCDAlarmProp); |
377 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 377 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
378 | addPropValue(a, VCRepeatCountProp, "1"); | 378 | addPropValue(a, VCRepeatCountProp, "1"); |
379 | addPropValue(a, VCDisplayStringProp, "beep!"); | 379 | addPropValue(a, VCDisplayStringProp, "beep!"); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | } | 382 | } |
383 | 383 | ||
384 | if (anEvent->pilotId()) { | 384 | if (anEvent->pilotId()) { |
385 | // pilot sync stuff | 385 | // pilot sync stuff |
386 | tmpStr.sprintf("%i",anEvent->pilotId()); | 386 | tmpStr.sprintf("%i",anEvent->pilotId()); |
387 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); | 387 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); |
388 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 388 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); | 389 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); |
390 | } | 390 | } |
391 | 391 | ||
392 | return vtodo; | 392 | return vtodo; |
393 | } | 393 | } |
394 | 394 | ||
395 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) | 395 | VObject* VCalFormat::eventToVEvent(Event *anEvent) |
396 | { | 396 | { |
397 | VObject *vevent; | 397 | VObject *vevent; |
398 | QString tmpStr; | 398 | QString tmpStr; |
399 | 399 | ||
400 | vevent = newVObject(VCEventProp); | 400 | vevent = newVObject(VCEventProp); |
401 | 401 | ||
402 | // start and end time | 402 | // start and end time |
403 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 403 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
404 | !anEvent->doesFloat()); | 404 | !anEvent->doesFloat()); |
405 | addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit()); | 405 | addPropValue(vevent, VCDTstartProp, tmpStr.local8Bit()); |
406 | 406 | ||
407 | // events that have time associated but take up no time should | 407 | // events that have time associated but take up no time should |
408 | // not have both DTSTART and DTEND. | 408 | // not have both DTSTART and DTEND. |
409 | if (anEvent->dtStart() != anEvent->dtEnd()) { | 409 | if (anEvent->dtStart() != anEvent->dtEnd()) { |
410 | tmpStr = qDateTimeToISO(anEvent->dtEnd(), | 410 | tmpStr = qDateTimeToISO(anEvent->dtEnd(), |
411 | !anEvent->doesFloat()); | 411 | !anEvent->doesFloat()); |
412 | addPropValue(vevent, VCDTendProp, tmpStr.local8Bit()); | 412 | addPropValue(vevent, VCDTendProp, tmpStr.local8Bit()); |
413 | } | 413 | } |
414 | 414 | ||
415 | // creation date | 415 | // creation date |
416 | tmpStr = qDateTimeToISO(anEvent->created()); | 416 | tmpStr = qDateTimeToISO(anEvent->created()); |
417 | addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit()); | 417 | addPropValue(vevent, VCDCreatedProp, tmpStr.local8Bit()); |
418 | 418 | ||
419 | // unique id | 419 | // unique id |
420 | addPropValue(vevent, VCUniqueStringProp, | 420 | addPropValue(vevent, VCUniqueStringProp, |
421 | anEvent->uid().local8Bit()); | 421 | anEvent->uid().local8Bit()); |
422 | 422 | ||
423 | // revision | 423 | // revision |
424 | tmpStr.sprintf("%i", anEvent->revision()); | 424 | tmpStr.sprintf("%i", anEvent->revision()); |
425 | addPropValue(vevent, VCSequenceProp, tmpStr.local8Bit()); | 425 | addPropValue(vevent, VCSequenceProp, tmpStr.local8Bit()); |
426 | 426 | ||
427 | // last modification date | 427 | // last modification date |
428 | tmpStr = qDateTimeToISO(anEvent->lastModified()); | 428 | tmpStr = qDateTimeToISO(anEvent->lastModified()); |
429 | addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit()); | 429 | addPropValue(vevent, VCLastModifiedProp, tmpStr.local8Bit()); |
430 | 430 | ||
431 | // attendee and organizer stuff | 431 | // attendee and organizer stuff |
432 | tmpStr = "MAILTO:" + anEvent->organizer(); | 432 | tmpStr = "MAILTO:" + anEvent->organizer(); |
433 | addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); | 433 | addPropValue(vevent, ICOrganizerProp, tmpStr.local8Bit()); |
434 | 434 | ||
435 | if (anEvent->attendeeCount() != 0) { | 435 | if (anEvent->attendeeCount() != 0) { |
436 | QPtrList<Attendee> al = anEvent->attendees(); | 436 | QPtrList<Attendee> al = anEvent->attendees(); |
437 | QPtrListIterator<Attendee> ai(al); | 437 | QPtrListIterator<Attendee> ai(al); |
438 | Attendee *curAttendee; | 438 | Attendee *curAttendee; |
439 | 439 | ||
440 | // TODO: Put this functionality into Attendee class | 440 | // TODO: Put this functionality into Attendee class |
441 | for (; ai.current(); ++ai) { | 441 | for (; ai.current(); ++ai) { |
442 | curAttendee = ai.current(); | 442 | curAttendee = ai.current(); |
443 | if (!curAttendee->email().isEmpty() && | 443 | if (!curAttendee->email().isEmpty() && |
444 | !curAttendee->name().isEmpty()) | 444 | !curAttendee->name().isEmpty()) |
445 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + | 445 | tmpStr = "MAILTO:" + curAttendee->name() + " <" + |
446 | curAttendee->email() + ">"; | 446 | curAttendee->email() + ">"; |
447 | else if (curAttendee->name().isEmpty()) | 447 | else if (curAttendee->name().isEmpty()) |
448 | tmpStr = "MAILTO: " + curAttendee->email(); | 448 | tmpStr = "MAILTO: " + curAttendee->email(); |
449 | else if (curAttendee->email().isEmpty()) | 449 | else if (curAttendee->email().isEmpty()) |
450 | tmpStr = "MAILTO: " + curAttendee->name(); | 450 | tmpStr = "MAILTO: " + curAttendee->name(); |
451 | else if (curAttendee->name().isEmpty() && | 451 | else if (curAttendee->name().isEmpty() && |
452 | curAttendee->email().isEmpty()) | 452 | curAttendee->email().isEmpty()) |
453 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; | 453 | kdDebug(5800) << "warning! this Event has an attendee w/o name or email!" << endl; |
454 | VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); | 454 | VObject *aProp = addPropValue(vevent, VCAttendeeProp, tmpStr.local8Bit()); |
455 | addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); | 455 | addPropValue(aProp, VCRoleProp, writeRole(curAttendee->role())); |
456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); | 456 | addPropValue(aProp, VCRSVPProp, curAttendee->RSVP() ? "TRUE" : "FALSE"); |
457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); | 457 | addPropValue(aProp, VCStatusProp, writeStatus(curAttendee->status())); |
458 | } | 458 | } |
459 | } | 459 | } |
460 | 460 | ||
461 | // recurrence rule stuff | 461 | // recurrence rule stuff |
462 | if (anEvent->recurrence()->doesRecur()) { | 462 | if (anEvent->doesRecur()) { |
463 | // some more variables | 463 | // some more variables |
464 | QPtrList<Recurrence::rMonthPos> tmpPositions; | 464 | QPtrList<Recurrence::rMonthPos> tmpPositions; |
465 | QPtrList<int> tmpDays; | 465 | QPtrList<int> tmpDays; |
466 | int *tmpDay; | 466 | int *tmpDay; |
467 | Recurrence::rMonthPos *tmpPos; | 467 | Recurrence::rMonthPos *tmpPos; |
468 | QString tmpStr2; | 468 | QString tmpStr2; |
469 | int i; | 469 | int i; |
470 | 470 | ||
471 | switch(anEvent->recurrence()->doesRecur()) { | 471 | switch(anEvent->recurrence()->doesRecur()) { |
472 | case Recurrence::rDaily: | 472 | case Recurrence::rDaily: |
473 | tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency()); | 473 | tmpStr.sprintf("D%i ",anEvent->recurrence()->frequency()); |
474 | // if (anEvent->rDuration > 0) | 474 | // if (anEvent->rDuration > 0) |
475 | //tmpStr += "#"; | 475 | //tmpStr += "#"; |
476 | break; | 476 | break; |
477 | case Recurrence::rWeekly: | 477 | case Recurrence::rWeekly: |
478 | tmpStr.sprintf("W%i ",anEvent->recurrence()->frequency()); | 478 | tmpStr.sprintf("W%i ",anEvent->recurrence()->frequency()); |
479 | for (i = 0; i < 7; i++) { | 479 | for (i = 0; i < 7; i++) { |
480 | if (anEvent->recurrence()->days().testBit(i)) | 480 | if (anEvent->recurrence()->days().testBit(i)) |
481 | tmpStr += dayFromNum(i); | 481 | tmpStr += dayFromNum(i); |
482 | } | 482 | } |
483 | break; | 483 | break; |
484 | case Recurrence::rMonthlyPos: | 484 | case Recurrence::rMonthlyPos: |
485 | tmpStr.sprintf("MP%i ", anEvent->recurrence()->frequency()); | 485 | tmpStr.sprintf("MP%i ", anEvent->recurrence()->frequency()); |
486 | // write out all rMonthPos's | 486 | // write out all rMonthPos's |
487 | tmpPositions = anEvent->recurrence()->monthPositions(); | 487 | tmpPositions = anEvent->recurrence()->monthPositions(); |
488 | for (tmpPos = tmpPositions.first(); | 488 | for (tmpPos = tmpPositions.first(); |
489 | tmpPos; | 489 | tmpPos; |
490 | tmpPos = tmpPositions.next()) { | 490 | tmpPos = tmpPositions.next()) { |
491 | 491 | ||
492 | tmpStr2.sprintf("%i", tmpPos->rPos); | 492 | tmpStr2.sprintf("%i", tmpPos->rPos); |
493 | if (tmpPos->negative) | 493 | if (tmpPos->negative) |
494 | tmpStr2 += "- "; | 494 | tmpStr2 += "- "; |
495 | else | 495 | else |
496 | tmpStr2 += "+ "; | 496 | tmpStr2 += "+ "; |
497 | tmpStr += tmpStr2; | 497 | tmpStr += tmpStr2; |
498 | for (i = 0; i < 7; i++) { | 498 | for (i = 0; i < 7; i++) { |
499 | if (tmpPos->rDays.testBit(i)) | 499 | if (tmpPos->rDays.testBit(i)) |
500 | tmpStr += dayFromNum(i); | 500 | tmpStr += dayFromNum(i); |
501 | } | 501 | } |
502 | } // loop for all rMonthPos's | 502 | } // loop for all rMonthPos's |
503 | break; | 503 | break; |
504 | case Recurrence::rMonthlyDay: | 504 | case Recurrence::rMonthlyDay: |
505 | tmpStr.sprintf("MD%i ", anEvent->recurrence()->frequency()); | 505 | tmpStr.sprintf("MD%i ", anEvent->recurrence()->frequency()); |
506 | // write out all rMonthDays; | 506 | // write out all rMonthDays; |
507 | tmpDays = anEvent->recurrence()->monthDays(); | 507 | tmpDays = anEvent->recurrence()->monthDays(); |
508 | for (tmpDay = tmpDays.first(); | 508 | for (tmpDay = tmpDays.first(); |
509 | tmpDay; | 509 | tmpDay; |
510 | tmpDay = tmpDays.next()) { | 510 | tmpDay = tmpDays.next()) { |
511 | tmpStr2.sprintf("%i ", *tmpDay); | 511 | tmpStr2.sprintf("%i ", *tmpDay); |
512 | tmpStr += tmpStr2; | 512 | tmpStr += tmpStr2; |
513 | } | 513 | } |
514 | break; | 514 | break; |
515 | case Recurrence::rYearlyMonth: | 515 | case Recurrence::rYearlyMonth: |
516 | tmpStr.sprintf("YM%i ", anEvent->recurrence()->frequency()); | 516 | tmpStr.sprintf("YM%i ", anEvent->recurrence()->frequency()); |
517 | // write out all the rYearNums; | 517 | // write out all the rYearNums; |
518 | tmpDays = anEvent->recurrence()->yearNums(); | 518 | tmpDays = anEvent->recurrence()->yearNums(); |
519 | for (tmpDay = tmpDays.first(); | 519 | for (tmpDay = tmpDays.first(); |
520 | tmpDay; | 520 | tmpDay; |
521 | tmpDay = tmpDays.next()) { | 521 | tmpDay = tmpDays.next()) { |
522 | tmpStr2.sprintf("%i ", *tmpDay); | 522 | tmpStr2.sprintf("%i ", *tmpDay); |
523 | tmpStr += tmpStr2; | 523 | tmpStr += tmpStr2; |
524 | } | 524 | } |
525 | break; | 525 | break; |
526 | case Recurrence::rYearlyDay: | 526 | case Recurrence::rYearlyDay: |
diff --git a/libkcal/vcalformat.h b/libkcal/vcalformat.h index c7df017..6dae3d2 100644 --- a/libkcal/vcalformat.h +++ b/libkcal/vcalformat.h | |||
@@ -13,101 +13,101 @@ | |||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #ifndef _VCALFORMAT_H | 22 | #ifndef _VCALFORMAT_H |
23 | #define _VCALFORMAT_H | 23 | #define _VCALFORMAT_H |
24 | 24 | ||
25 | #include "calformat.h" | 25 | #include "calformat.h" |
26 | 26 | ||
27 | #define _VCAL_VERSION "1.0" | 27 | #define _VCAL_VERSION "1.0" |
28 | 28 | ||
29 | class VObject; | 29 | class VObject; |
30 | 30 | ||
31 | namespace KCal { | 31 | namespace KCal { |
32 | 32 | ||
33 | /** | 33 | /** |
34 | This class implements the vCalendar format. It provides methods for | 34 | This class implements the vCalendar format. It provides methods for |
35 | loading/saving/converting vCalendar format data into the internal KOrganizer | 35 | loading/saving/converting vCalendar format data into the internal KOrganizer |
36 | representation as Calendar and Events. | 36 | representation as Calendar and Events. |
37 | 37 | ||
38 | @short vCalendar format implementation | 38 | @short vCalendar format implementation |
39 | */ | 39 | */ |
40 | class VCalFormat : public CalFormat { | 40 | class VCalFormat : public CalFormat { |
41 | public: | 41 | public: |
42 | VCalFormat(); | 42 | VCalFormat(); |
43 | virtual ~VCalFormat(); | 43 | virtual ~VCalFormat(); |
44 | 44 | ||
45 | /** loads a calendar on disk in vCalendar format into the current calendar. | 45 | /** loads a calendar on disk in vCalendar format into the current calendar. |
46 | * any information already present is lost. Returns TRUE if successful, | 46 | * any information already present is lost. Returns TRUE if successful, |
47 | * else returns FALSE. | 47 | * else returns FALSE. |
48 | * @param fileName the name of the calendar on disk. | 48 | * @param fileName the name of the calendar on disk. |
49 | */ | 49 | */ |
50 | bool load(Calendar *,const QString &fileName ); | 50 | bool load(Calendar *,const QString &fileName ); |
51 | /** writes out the calendar to disk in vCalendar format. Returns true if | 51 | /** writes out the calendar to disk in vCalendar format. Returns true if |
52 | * successful and false on error. | 52 | * successful and false on error. |
53 | * @param fileName the name of the file | 53 | * @param fileName the name of the file |
54 | */ | 54 | */ |
55 | bool save(Calendar *,const QString &fileName ); | 55 | bool save(Calendar *,const QString &fileName ); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | Parse string and populate calendar with that information. | 58 | Parse string and populate calendar with that information. |
59 | */ | 59 | */ |
60 | bool fromString( Calendar *, const QString & ); | 60 | bool fromString( Calendar *, const QString & ); |
61 | /** | 61 | /** |
62 | Return calendar information as string. | 62 | Return calendar information as string. |
63 | */ | 63 | */ |
64 | void setLocalTime ( bool ); | 64 | void setLocalTime ( bool ); |
65 | QString toString( Calendar * ); | 65 | QString toString( Calendar * ); |
66 | QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true ); | 66 | QString eventToString( Event *, Calendar *calendar, bool useLocalTime = true ); |
67 | QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true ); | 67 | QString todoToString( Todo * ,Calendar *calendar, bool useLocalTime = true ); |
68 | 68 | ||
69 | protected: | 69 | protected: |
70 | /** translates a VObject of the TODO type into a Event */ | 70 | /** translates a VObject of the TODO type into a Event */ |
71 | Todo *VTodoToEvent(VObject *vtodo); | 71 | Todo *VTodoToEvent(VObject *vtodo); |
72 | /** translates a VObject into a Event and returns a pointer to it. */ | 72 | /** translates a VObject into a Event and returns a pointer to it. */ |
73 | Event *VEventToEvent(VObject *vevent); | 73 | Event *VEventToEvent(VObject *vevent); |
74 | /** translate a Event into a VTodo-type VObject and return pointer */ | 74 | /** translate a Event into a VTodo-type VObject and return pointer */ |
75 | VObject *eventToVTodo(const Todo *anEvent); | 75 | VObject *eventToVTodo(const Todo *anEvent); |
76 | /** translate a Event into a VObject and returns a pointer to it. */ | 76 | /** translate a Event into a VObject and returns a pointer to it. */ |
77 | VObject* eventToVEvent(const Event *anEvent); | 77 | VObject* eventToVEvent(Event *anEvent); |
78 | 78 | ||
79 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ | 79 | /** takes a QDate and returns a string in the format YYYYMMDDTHHMMSS */ |
80 | QString qDateToISO(const QDate &); | 80 | QString qDateToISO(const QDate &); |
81 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ | 81 | /** takes a QDateTime and returns a string in format YYYYMMDDTHHMMSS */ |
82 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); | 82 | QString qDateTimeToISO(const QDateTime &, bool zulu=TRUE); |
83 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a | 83 | /** takes a string in the format YYYYMMDDTHHMMSS and returns a |
84 | * valid QDateTime. */ | 84 | * valid QDateTime. */ |
85 | QDateTime ISOToQDateTime(const QString & dtStr); | 85 | QDateTime ISOToQDateTime(const QString & dtStr); |
86 | /** takes a string in the format YYYYMMDD and returns a | 86 | /** takes a string in the format YYYYMMDD and returns a |
87 | * valid QDate. */ | 87 | * valid QDate. */ |
88 | QDate ISOToQDate(const QString & dtStr); | 88 | QDate ISOToQDate(const QString & dtStr); |
89 | /** takes a vCalendar tree of VObjects, and puts all of them that have | 89 | /** takes a vCalendar tree of VObjects, and puts all of them that have |
90 | * the "event" property into the dictionary, todos in the todo-list, etc. */ | 90 | * the "event" property into the dictionary, todos in the todo-list, etc. */ |
91 | void populate(VObject *vcal); | 91 | void populate(VObject *vcal); |
92 | 92 | ||
93 | /** takes a number 0 - 6 and returns the two letter string of that day, | 93 | /** takes a number 0 - 6 and returns the two letter string of that day, |
94 | * i.e. MO, TU, WE, etc. */ | 94 | * i.e. MO, TU, WE, etc. */ |
95 | const char *dayFromNum(int day); | 95 | const char *dayFromNum(int day); |
96 | /** the reverse of the above function. */ | 96 | /** the reverse of the above function. */ |
97 | int numFromDay(const QString &day); | 97 | int numFromDay(const QString &day); |
98 | Attendee::Role VCalFormat::readRole(const char *s) const; | 98 | Attendee::Role VCalFormat::readRole(const char *s) const; |
99 | QCString writeRole(Attendee::Role role) const; | 99 | QCString writeRole(Attendee::Role role) const; |
100 | Attendee::PartStat readStatus(const char *s) const; | 100 | Attendee::PartStat readStatus(const char *s) const; |
101 | QCString writeStatus(Attendee::PartStat status) const; | 101 | QCString writeStatus(Attendee::PartStat status) const; |
102 | 102 | ||
103 | private: | 103 | private: |
104 | Calendar *mCalendar; | 104 | Calendar *mCalendar; |
105 | bool useLocalTime; | 105 | bool useLocalTime; |
106 | 106 | ||
107 | QPtrList<Event> mEventsRelate; // events with relations | 107 | QPtrList<Event> mEventsRelate; // events with relations |
108 | QPtrList<Todo> mTodosRelate; // todos with relations | 108 | QPtrList<Todo> mTodosRelate; // todos with relations |
109 | }; | 109 | }; |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | #endif | 113 | #endif |