summaryrefslogtreecommitdiffabout
path: root/korganizer/calendarview.cpp
Unidiff
Diffstat (limited to 'korganizer/calendarview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7c8316f..3dac20b 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -2250,41 +2250,53 @@ void CalendarView::edit_options()
2250 } 2250 }
2251 else 2251 else
2252 qDebug("KO: No tz change "); 2252 qDebug("KO: No tz change ");
2253 2253
2254} 2254}
2255 2255
2256 2256
2257void CalendarView::slotSelectPickerDate( QDate d) 2257void CalendarView::slotSelectPickerDate( QDate d)
2258{ 2258{
2259 mDateFrame->hide(); 2259 mDateFrame->hide();
2260 if ( mDatePickerMode == 1 ) { 2260 if ( mDatePickerMode == 1 ) {
2261 mNavigator->slotDaySelect( d ); 2261 mNavigator->slotDaySelect( d );
2262 } else if ( mDatePickerMode == 2 ) { 2262 } else if ( mDatePickerMode == 2 ) {
2263 if ( mMoveIncidence->type() == "Todo" ) { 2263 if ( mMoveIncidence->type() == "Todo" ) {
2264 Todo * to = (Todo *) mMoveIncidence; 2264 Todo * to = (Todo *) mMoveIncidence;
2265 QTime tim; 2265 QTime tim;
2266 int len = 0;
2267 if ( to->hasStartDate() && to->hasDueDate() )
2268 len = to->dtStart().secsTo( to->dtDue());
2266 if ( to->hasDueDate() ) 2269 if ( to->hasDueDate() )
2267 tim = to->dtDue().time(); 2270 tim = to->dtDue().time();
2268 else { 2271 else {
2269 tim = QTime ( 0,0,0 ); 2272 tim = QTime ( 0,0,0 );
2270 to->setFloats( true ); 2273 to->setFloats( true );
2271 to->setHasDueDate( true ); 2274 to->setHasDueDate( true );
2272 } 2275 }
2273 QDateTime dt ( d,tim ); 2276 QDateTime dt ( d,tim );
2274 to->setDtDue( dt ); 2277 to->setDtDue( dt );
2278
2279 if ( to->hasStartDate() ) {
2280 if ( len>0 )
2281 to->setDtStart(to->dtDue().addSecs( -len ));
2282 else
2283 if (to->dtStart() > to->dtDue() )
2284 to->setDtStart(to->dtDue().addDays( -3 ));
2285 }
2286
2275 todoChanged( to ); 2287 todoChanged( to );
2276 } else { 2288 } else {
2277 if ( mMoveIncidence->doesRecur() ) { 2289 if ( mMoveIncidence->doesRecur() ) {
2278#if 0 2290#if 0
2279 // PENDING implement this 2291 // PENDING implement this
2280 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate ); 2292 Incidence* newInc = mMoveIncidence->recreateCloneException( mMoveIncidenceOldDate );
2281 mCalendar()->addIncidence( newInc ); 2293 mCalendar()->addIncidence( newInc );
2282 if ( mMoveIncidence->type() == "Todo" ) 2294 if ( mMoveIncidence->type() == "Todo" )
2283 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED ); 2295 emit todoMoved((Todo*)mMoveIncidence, KOGlobals::EVENTEDITED );
2284 else 2296 else
2285 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED); 2297 emit incidenceChanged(mMoveIncidence, KOGlobals::EVENTEDITED);
2286 mMoveIncidence = newInc; 2298 mMoveIncidence = newInc;
2287 2299
2288#endif 2300#endif
2289 } 2301 }
2290 QTime tim = mMoveIncidence->dtStart().time(); 2302 QTime tim = mMoveIncidence->dtStart().time();
@@ -3797,33 +3809,33 @@ void CalendarView::lookForIncomingMessages()
3797{ 3809{
3798 IncomingDialog *icd = mDialogManager->incomingDialog(); 3810 IncomingDialog *icd = mDialogManager->incomingDialog();
3799 icd->retrieve(); 3811 icd->retrieve();
3800} 3812}
3801 3813
3802bool CalendarView::removeCompletedSubTodos( Todo* t ) 3814bool CalendarView::removeCompletedSubTodos( Todo* t )
3803{ 3815{
3804 bool deleteTodo = true; 3816 bool deleteTodo = true;
3805 QPtrList<Incidence> subTodos; 3817 QPtrList<Incidence> subTodos;
3806 Incidence *aTodo; 3818 Incidence *aTodo;
3807 subTodos = t->relations(); 3819 subTodos = t->relations();
3808 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) { 3820 for (aTodo = subTodos.first(); aTodo; aTodo = subTodos.next()) {
3809 if (! removeCompletedSubTodos( (Todo*) aTodo )) 3821 if (! removeCompletedSubTodos( (Todo*) aTodo ))
3810 deleteTodo = false; 3822 deleteTodo = false;
3811 } 3823 }
3812 if ( deleteTodo ) { 3824 if ( deleteTodo ) {
3813 if ( t->isCompleted() ) { 3825 if ( t->isCompleted() && !t->doesRecur()) {
3814 checkExternalId( t ); 3826 checkExternalId( t );
3815 mCalendar->deleteTodo( t ); 3827 mCalendar->deleteTodo( t );
3816 changeTodoDisplay( t,KOGlobals::EVENTDELETED ); 3828 changeTodoDisplay( t,KOGlobals::EVENTDELETED );
3817 } 3829 }
3818 else 3830 else
3819 deleteTodo = false; 3831 deleteTodo = false;
3820 } 3832 }
3821 return deleteTodo; 3833 return deleteTodo;
3822 3834
3823} 3835}
3824void CalendarView::purgeCompleted() 3836void CalendarView::purgeCompleted()
3825{ 3837{
3826 int result = KMessageBox::warningContinueCancel(this, 3838 int result = KMessageBox::warningContinueCancel(this,
3827 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge")); 3839 i18n("Delete all\ncompleted To-Dos?"),i18n("Purge To-Dos"),i18n("Purge"));
3828 3840
3829 if (result == KMessageBox::Continue) { 3841 if (result == KMessageBox::Continue) {