summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoeditor.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoeditor.cpp35
1 files changed, 8 insertions, 27 deletions
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index f9f037a..51e2524 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -331,77 +331,58 @@ void KOTodoEditor::checkRecurrence()
331 } 331 }
332} 332}
333void KOTodoEditor::readTodo(Todo *todo) 333void KOTodoEditor::readTodo(Todo *todo)
334{ 334{
335 mGeneral->readTodo(todo); 335 mGeneral->readTodo(todo);
336 mDetails->readEvent(todo); 336 mDetails->readEvent(todo);
337 mRelatedTodo = 0;//todo->relatedTo(); 337 mRelatedTodo = 0;//todo->relatedTo();
338 // categories 338 // categories
339 // mCategoryDialog->setSelected(todo->categories()); 339 // mCategoryDialog->setSelected(todo->categories());
340 340
341 // We should handle read-only events here. 341 // We should handle read-only events here.
342} 342}
343 343
344void KOTodoEditor::writeTodo(Todo *event) 344void KOTodoEditor::writeTodo(Todo *event)
345{ 345{
346 mGeneral->writeTodo(event); 346 mGeneral->writeTodo(event);
347 mDetails->writeEvent(event); 347 mDetails->writeEvent(event);
348 348
349 // set related event, i.e. parent to-do in this case. 349 // set related event, i.e. parent to-do in this case.
350 if (mRelatedTodo) { 350 if (mRelatedTodo) {
351 event->setRelatedTo(mRelatedTodo); 351 event->setRelatedTo(mRelatedTodo);
352 } 352 }
353 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 353 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
354 mRecurrence->writeEvent(event); 354 mRecurrence->writeEvent(event);
355 event->setRecurrenceID( event->dtStart().addSecs(-1) ); 355 if ( event->doesRecur() ) {
356 event->setRecurDates(); 356 event->setRecurrenceID( event->dtStart().addSecs(-1) );
357#if 0 357 event->setRecurDates();
358 bool ok; 358 } else {
359 QDateTime next = event->getNextOccurence( event->dtStart().addSecs(-1), &ok );
360 if ( ok ) {
361 QDateTime from,to;
362 bool time = mGeneral->mTimeButton->isChecked();
363 if ( time ) {
364 to = QDateTime( mGeneral->mDueDateEdit->date(), mGeneral->mDueTimeEdit->getTime() ) ;
365 from = QDateTime( mGeneral->mStartDateEdit->date(),mGeneral->mStartTimeEdit->getTime( )) ;
366 } else {
367 to = QDateTime( mGeneral->mDueDateEdit->date(), QTime( 0,0,0) ) ;
368 from = QDateTime( mGeneral->mStartDateEdit->date(),QTime( 0,0,0) ) ;
369 }
370 if ( to < from )
371 to = from;
372 int secs = from.secsTo( to );
373 event->setRecurrenceID( next );
374 event->setDtStart( next );
375 event->setDtDue( next.addSecs( secs ) );
376 }
377 else {
378 event->setHasRecurrenceID( false ); 359 event->setHasRecurrenceID( false );
379 event->recurrence()->unsetRecurs();
380 } 360 }
381#endif 361 } else {
382 } else 362 event->setHasRecurrenceID( false );
383 event->recurrence()->unsetRecurs(); 363 event->recurrence()->unsetRecurs();
364 }
384} 365}
385 366
386bool KOTodoEditor::validateInput() 367bool KOTodoEditor::validateInput()
387{ 368{
388 if (!mGeneral->validateInput()) return false; 369 if (!mGeneral->validateInput()) return false;
389 if (!mDetails->validateInput()) return false; 370 if (!mDetails->validateInput()) return false;
390 return true; 371 return true;
391} 372}
392 373
393int KOTodoEditor::msgItemDelete() 374int KOTodoEditor::msgItemDelete()
394{ 375{
395 return KMessageBox::warningContinueCancel(this, 376 return KMessageBox::warningContinueCancel(this,
396 i18n("This item will be permanently deleted."), 377 i18n("This item will be permanently deleted."),
397 i18n("KOrganizer Confirmation"),i18n("Delete")); 378 i18n("KOrganizer Confirmation"),i18n("Delete"));
398} 379}
399 380
400void KOTodoEditor::modified (int modification) 381void KOTodoEditor::modified (int modification)
401{ 382{
402 if (modification == KOGlobals::CATEGORY_MODIFIED || 383 if (modification == KOGlobals::CATEGORY_MODIFIED ||
403 KOGlobals::UNKNOWN_MODIFIED == modification ) 384 KOGlobals::UNKNOWN_MODIFIED == modification )
404 // mCategoryDialog->setSelected (mTodo->categories ()); 385 // mCategoryDialog->setSelected (mTodo->categories ());
405 mGeneral->modified (mTodo, modification); 386 mGeneral->modified (mTodo, modification);
406 387
407} 388}