-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 |
11 files changed, 108 insertions, 99 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index a76f2ed..a9d42f0 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -3756,13 +3756,13 @@ void CalendarView::deleteEvent(Event *anEvent) { if (!anEvent) { KNotifyClient::beep(); return; } - if (anEvent->recurrence()->doesRecur()) { + if (anEvent->doesRecur()) { QDate itemDate = mViewManager->currentSelectionDate(); int km; if (!itemDate.isValid()) { //kdDebug() << "Date Not Valid" << endl; if (KOPrefs::instance()->mConfirm) { km = KMessageBox::warningContinueCancel(this,KGlobal::formatMessage ( anEvent->summary(),0 ) + diff --git a/korganizer/koagenda.cpp b/korganizer/koagenda.cpp index 0dd5ef5..c738f7e 100644 --- a/korganizer/koagenda.cpp +++ b/korganizer/koagenda.cpp @@ -576,13 +576,13 @@ bool KOAgenda::eventFilter_mouse(QObject *object, QMouseEvent *me) mActionItem = (KOAgendaItem *)object; if (mActionItem) { emit signalClearSelection(); slotClearSelection(); selectItem(mActionItem); Incidence *incidence = mActionItem->incidence(); - if ( incidence->isReadOnly() /*|| incidence->recurrence()->doesRecur() */) { + if ( incidence->isReadOnly() /*|| incidence->doesRecur() */) { mActionItem = 0; } else { startItemAction(viewportPos); } } } @@ -996,13 +996,13 @@ void KOAgenda::endItemAction() if ( mItemMoved ) { KOAgendaItem *placeItem = mActionItem->firstMultiItem(); if ( !placeItem ) { placeItem = mActionItem; } - if ( placeItem->incidence()->recurrence()->doesRecur() ) { + if ( placeItem->incidence()->doesRecur() ) { Incidence* oldInc = placeItem->incidence(); placeItem->recreateIncidence(); emit addToCalSignal(placeItem->incidence(), oldInc ); } int type = mActionType; if ( mAllDayMode ) diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 303a92a..49ad9b8 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -231,13 +231,13 @@ bool KOAgendaItem::updateIcons(QPainter * p, bool horLayout) p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, red ); if ( horLayout ) ++xOff; else ++yOff; } - if (mIncidence->recurrence()->doesRecur()) { + if (mIncidence->doesRecur()) { p->fillRect ( xOff*( 1 +AGENDA_ICON_SIZE )+x, yOff*( 1 +AGENDA_ICON_SIZE)+y, AGENDA_ICON_SIZE, AGENDA_ICON_SIZE, blue ); if ( horLayout ) ++xOff; else ++yOff; } diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index a01323a..04f30bb 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -1198,13 +1198,13 @@ void KOAgendaView::fillAgenda() int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; if (event->doesFloat()) { - if (event->recurrence()->doesRecur()) { + if (event->doesRecur()) { if (event->isMultiDay() ) { endX = endX - beginX;// endX is now number of days if ( event->recursOn( currentDate ) ) { endX += curCol; beginX = curCol; mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index ec1154a..057df0d 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -450,13 +450,13 @@ void KODayMatrix::updateViewTimed() hDays.fill( false); eDays.fill( false); mHolidays.clear(); QDate mStartDate = days[0]; QDate endDate = mStartDate.addDays( timeSpan ); for( event = events.first(); event; event = events.next() ) { // for event - ushort recurType = event->recurrence()->doesRecur(); + ushort recurType = event->doesRecur(); if ((recurType == Recurrence::rDaily && !KOPrefs::instance()->mDailyRecur) || (recurType == Recurrence::rWeekly && !KOPrefs::instance()->mWeeklyRecur)) { continue; } if ( event->doesRecur() ) { bool last; diff --git a/korganizer/koeditorrecurrence.cpp b/korganizer/koeditorrecurrence.cpp index de4e4f7..89504db 100644 --- a/korganizer/koeditorrecurrence.cpp +++ b/korganizer/koeditorrecurrence.cpp @@ -894,106 +894,108 @@ void KOEditorRecurrence::readEvent(Incidence *event) QPtrList<int> rmd; int day = 0; int count = 0; int month = 0; setDateTimes( event->dtStart(), dtEnd ); - Recurrence *r = event->recurrence(); - int f = r->frequency(); + - int recurs = r->doesRecur(); + int recurs = event->doesRecur(); mEnabledCheck->setChecked( recurs ); setEnabled( recurs ); int recurrenceType = RecurrenceChooser::Weekly; - - switch ( recurs ) { - case Recurrence::rNone: - setDefaults( event->dtStart(), dtEnd ); - break; - case Recurrence::rDaily: - recurrenceType = RecurrenceChooser::Daily; - mDaily->setFrequency( f ); - break; - case Recurrence::rWeekly: - recurrenceType = RecurrenceChooser::Weekly; - mWeekly->setFrequency( f ); - mWeekly->setDays( r->days() ); - break; - case Recurrence::rMonthlyPos: - // we only handle one possibility in the list right now, - // so I have hardcoded calls with first(). If we make the GUI - // more extended, this can be changed. - recurrenceType = RecurrenceChooser::Monthly; - - rmp = r->monthPositions(); - if ( rmp.first()->negative ) - count = 5 - rmp.first()->rPos - 1; - else - count = rmp.first()->rPos - 1; - day = 0; - while ( !rmp.first()->rDays.testBit( day ) ) ++day; - mMonthly->setByPos( count, day ); - - mMonthly->setFrequency( f ); - - break; - case Recurrence::rMonthlyDay: - recurrenceType = RecurrenceChooser::Monthly; - - rmd = r->monthDays(); - day = *rmd.first() - 1; - mMonthly->setByDay( day ); - - mMonthly->setFrequency( f ); - - break; - case Recurrence::rYearlyMonth: - { - recurrenceType = RecurrenceChooser::Yearly; - //qDebug("Recurrence::rYearlyMonth: "); - day = event->dtStart().date().day(); - rmd = r->yearNums(); - if ( rmd.count() > 0 ) - month = *rmd.first(); - else - month = event->dtStart().date().month() ; - mYearly->setByMonth( month, day ); + if ( recurs ) { + Recurrence *r = event->recurrence(); + int f = r->frequency(); + switch ( recurs ) { + case Recurrence::rNone: + setDefaults( event->dtStart(), dtEnd ); + break; + case Recurrence::rDaily: + recurrenceType = RecurrenceChooser::Daily; + mDaily->setFrequency( f ); + break; + case Recurrence::rWeekly: + recurrenceType = RecurrenceChooser::Weekly; + mWeekly->setFrequency( f ); + mWeekly->setDays( r->days() ); + break; + case Recurrence::rMonthlyPos: + // we only handle one possibility in the list right now, + // so I have hardcoded calls with first(). If we make the GUI + // more extended, this can be changed. + recurrenceType = RecurrenceChooser::Monthly; + + rmp = r->monthPositions(); + if ( rmp.first()->negative ) + count = 5 - rmp.first()->rPos - 1; + else + count = rmp.first()->rPos - 1; + day = 0; + while ( !rmp.first()->rDays.testBit( day ) ) ++day; + mMonthly->setByPos( count, day ); + + mMonthly->setFrequency( f ); + + break; + case Recurrence::rMonthlyDay: + recurrenceType = RecurrenceChooser::Monthly; + + rmd = r->monthDays(); + day = *rmd.first() - 1; + mMonthly->setByDay( day ); + + mMonthly->setFrequency( f ); + + break; + case Recurrence::rYearlyMonth: + { + recurrenceType = RecurrenceChooser::Yearly; + //qDebug("Recurrence::rYearlyMonth: "); + day = event->dtStart().date().day(); + rmd = r->yearNums(); + if ( rmd.count() > 0 ) + month = *rmd.first(); + else + month = event->dtStart().date().month() ; + mYearly->setByMonth( month, day ); #if 0 - //qDebug("2day = %d ",day ); - QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); - int month; - if ( !monthlist.isEmpty() ) { - month = monthlist.first()->rPos ; - } else { - month = event->dtStart().date().month() ; - } - mYearly->setByMonth( day, month ); + //qDebug("2day = %d ",day ); + QPtrList<Recurrence::rMonthPos> monthlist = r->yearMonthPositions(); + int month; + if ( !monthlist.isEmpty() ) { + month = monthlist.first()->rPos ; + } else { + month = event->dtStart().date().month() ; + } + mYearly->setByMonth( day, month ); #endif - mYearly->setFrequency( f ); - } + mYearly->setFrequency( f ); + } - break; - case Recurrence::rYearlyDay: - //qDebug("Recurrence::rYearlyDay: "); - recurrenceType = RecurrenceChooser::Yearly; - mYearly->setByDay( event->dtStart().date().dayOfYear() ); - mYearly->setFrequency( f ); - break; - default: - setDefaults( event->dtStart(), dtEnd ); - break; + break; + case Recurrence::rYearlyDay: + //qDebug("Recurrence::rYearlyDay: "); + recurrenceType = RecurrenceChooser::Yearly; + mYearly->setByDay( event->dtStart().date().dayOfYear() ); + mYearly->setFrequency( f ); + break; + default: + setDefaults( event->dtStart(), dtEnd ); + break; + } } - mRecurrenceChooser->setType( recurrenceType ); showCurrentRule( recurrenceType ); mRecurrenceRange->setDateTimes( event->dtStart() ); - if ( r->doesRecur() ) { + if ( event->doesRecur() ) { + Recurrence *r = event->recurrence(); mRecurrenceRange->setDuration( r->duration() ); if ( r->duration() == 0 ) { if ( r->endDate() < event->dtStart().date() ) mRecurrenceRange->setEndDate( event->dtStart().date() ); else @@ -1004,18 +1006,22 @@ void KOEditorRecurrence::readEvent(Incidence *event) mExceptions->setDates( event->exDates() ); } void KOEditorRecurrence::writeEvent( Incidence *event ) { - Recurrence *r = event->recurrence(); + - // clear out any old settings; - r->unsetRecurs(); + if ( !mEnabledCheck->isChecked() ) { + if ( event->doesRecur() ) + event->recurrence()->unsetRecurs(); + } else { + Recurrence *r = event->recurrence(); - if ( mEnabledCheck->isChecked() ) { + // clear out any old settings; + r->unsetRecurs(); int duration = mRecurrenceRange->duration(); QDate endDate; if ( duration == 0 ) endDate = mRecurrenceRange->endDate(); int recurrenceType = mRecurrenceChooser->type(); diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index a690ab1..db695f5 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -344,15 +344,15 @@ void KOEventViewer::appendEvent(Event *event, int mode ) } } if (!event->location().isEmpty()) { addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); mMailSubject += i18n(" at ") + event->location(); } - if (event->recurrence()->doesRecur()) { + if (event->doesRecur()) { - QString recurText = event->recurrence()->recurrenceText(); + QString recurText = event->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); bool ok; QDate start = QDate::currentDate(); QDateTime next; next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); if ( ok ) { @@ -478,13 +478,13 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) mText += "</font>"; mMailSubject += i18n("(cancelled)"); } - if (event->recurrence()->doesRecur()) { + if (event->doesRecur()) { QString recurText = event->recurrence()->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); } if (event->hasStartDate()) { diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index d25f671..e7a5e0e 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -130,13 +130,13 @@ bool ListItemVisitor::visit(Event *e) mItem->setText(4,e->dtEndTimeStr()); if ( e->isAlarmEnabled() ) { mItem->setText(5,e->alarms().first()->offsetText() ); } else { mItem->setText(5, i18n("No")); } - mItem->setText(6, e->recurrence()->recurrenceText()); + mItem->setText(6, e->recurrenceText()); if( ! e->doesRecur() ) mItem->setSortKey( 6, "-" ); mItem->setText(7,"---"); mItem->setText(8,"---"); mItem->setText(9, e->cancelled() ? i18n("Yes") : i18n("No")); mItem->setText(10,e->categoriesStr()); @@ -181,13 +181,13 @@ bool ListItemVisitor::visit(Todo *t) mItem->setText(4,"---"); if ( t->isAlarmEnabled() ) { mItem->setText(5,t->alarms().first()->offsetText() ); } else { mItem->setText(5, i18n("No")); } - mItem->setText(6, t->recurrence()->recurrenceText()); + mItem->setText(6, t->recurrenceText()); if( ! t->doesRecur() ) mItem->setSortKey( 6, "-" ); if (t->hasDueDate()) { mItem->setText(7,t->dtDueDateStr()); if (t->doesFloat()) { mItem->setText(8,"---"); diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 498d9b0..eea9a4d 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -784,13 +784,13 @@ int MonthViewCell::insertEvent(Event *event) } else { pal = mStandardPalette ; } pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); item->setPalette( pal ); - item->setRecur( event->recurrence()->doesRecur() ); + item->setRecur( event->doesRecur() ); item->setAlarm( event->isAlarmEnabled() && multiday < 2 && event->alarmEnabled() ); item->setMoreInfo( event->description().length() > 0 ); #ifdef DESKTOP_VERSION Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, KOPrefs::instance()->email()); if ( me != 0 ) { @@ -875,13 +875,13 @@ void MonthViewCell::insertTodo(Todo *todo) } else { pal = mStandardPalette ; } pal.setColor(QColorGroup::Highlight, KOPrefs::instance()->mHighlightColor); item->setPalette( pal ); - item->setRecur( todo->recurrence()->doesRecur() ); + item->setRecur( todo->doesRecur() ); item->setAlarm( todo->isAlarmEnabled() && todo->alarmEnabled() ); item->setMoreInfo( todo->description().length() > 0 ); insertItem( item , count()); #ifdef DESKTOP_VERSION mToolTip.append( text ); #endif @@ -1102,12 +1102,14 @@ void MonthViewCell::contextMenu( QListBoxItem *item ) { mMonthView->setPopupCell( this ); if ( !item ) { mMonthView->showContextMenu( 0 ); return; } + //selection( item ); + //qApp->processEvents(); MonthViewItem *eventItem = static_cast<MonthViewItem *>( item ); Incidence *incidence = eventItem->incidence(); if ( incidence ) mMonthView->showContextMenu( incidence ); } void MonthViewCell::selection( QListBoxItem *item ) diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp index 100a81b..682f83b 100644 --- a/korganizer/kotodoeditor.cpp +++ b/korganizer/kotodoeditor.cpp @@ -374,13 +374,14 @@ void KOTodoEditor::writeTodo(Todo *event) event->setRecurDates(); } else { event->setHasRecurrenceID( false ); } } else { event->setHasRecurrenceID( false ); - event->recurrence()->unsetRecurs(); + if ( event->doesRecur() ) + event->recurrence()->unsetRecurs(); } } bool KOTodoEditor::validateInput() { if (!mGeneral->validateInput()) return false; diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index fafcb58..f88403c 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -504,13 +504,13 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; } else { if (!ev->doesFloat()) { Event *event = static_cast<Event *>(ev); QDateTime st,end; - if ( event->recurrence()->doesRecur() ) { + if ( event->doesRecur() ) { QDate recDate= mEventDate; int days = event->dtStart().date().daysTo (event->dtEnd().date() ); while ( ! event->recursOn( recDate ) ) { recDate = recDate.addDays( -1 ); } @@ -619,13 +619,13 @@ bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool a if ( ev->description().length() > 0 ) { if ( !needClose) tempText +="["; tempText += "i"; needClose =true; } - if ( ev->recurrence()->doesRecur() ) { + if ( ev->doesRecur() ) { if ( !needClose) tempText +="["; tempText += "r"; needClose =true; } if ( needClose ) { |