summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoeditor.cpp
Unidiff
Diffstat (limited to 'korganizer/kotodoeditor.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoeditor.cpp53
1 files changed, 30 insertions, 23 deletions
diff --git a/korganizer/kotodoeditor.cpp b/korganizer/kotodoeditor.cpp
index 6a05cc8..5513e8b 100644
--- a/korganizer/kotodoeditor.cpp
+++ b/korganizer/kotodoeditor.cpp
@@ -101,29 +101,29 @@ void KOTodoEditor::setupGeneral()
101 mGeneral = new KOEditorGeneralTodo(this); 101 mGeneral = new KOEditorGeneralTodo(this);
102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) ); 102 connect ( mGeneral, SIGNAL ( allAccepted() ), this, SLOT ( slotOk () ) );
103 103
104 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show())); 104 // connect(mGeneral,SIGNAL(openCategoryDialog()),mCategoryDialog,SLOT(show()));
105 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)), 105 //connect(mCategoryDialog, SIGNAL(categoriesSelected(const QString &)),
106 // mGeneral,SLOT(setCategories(const QString &))); 106 // mGeneral,SLOT(setCategories(const QString &)));
107 107
108 if (KOPrefs::instance()->mCompactDialogs) { 108 if (KOPrefs::instance()->mCompactDialogs) {
109 QFrame *topFrame = addPage(i18n("General")); 109 QFrame *topFrame = addPage(i18n("General"));
110 110
111 QBoxLayout *topLayout = new QVBoxLayout(topFrame); 111 QBoxLayout *topLayout = new QVBoxLayout(topFrame);
112 if ( QApplication::desktop()->width() < 480 ) { 112 if ( QApplication::desktop()->width() < 480 ) {
113 topLayout->setMargin(1); 113 topLayout->setMargin(marginHintSmall());
114 topLayout->setSpacing(1); 114 topLayout->setSpacing(spacingHintSmall());
115 } else { 115 } else {
116 topLayout->setMargin(marginHint()-1); 116 topLayout->setMargin(marginHint());
117 topLayout->setSpacing(spacingHint()-1); 117 topLayout->setSpacing(spacingHint());
118 } 118 }
119 mGeneral->initHeader(topFrame,topLayout); 119 mGeneral->initHeader(topFrame,topLayout);
120 mGeneral->initTime(topFrame,topLayout); 120 mGeneral->initTime(topFrame,topLayout);
121 mGeneral->initAlarm(topFrame,topLayout); 121 mGeneral->initAlarm(topFrame,topLayout);
122 mGeneral->enableAlarm( false ); 122 mGeneral->enableAlarm( false );
123 123
124 124
125 QBoxLayout *priorityLayout; 125 QBoxLayout *priorityLayout;
126 if ( QApplication::desktop()->width() < 500 ) 126 if ( QApplication::desktop()->width() < 500 )
127 priorityLayout = new QVBoxLayout( topLayout ); 127 priorityLayout = new QVBoxLayout( topLayout );
128 else 128 else
129 priorityLayout = new QHBoxLayout( topLayout ); 129 priorityLayout = new QHBoxLayout( topLayout );
@@ -335,43 +335,50 @@ void KOTodoEditor::readTodo(Todo *todo)
335{ 335{
336 mGeneral->readTodo(todo); 336 mGeneral->readTodo(todo);
337 mDetails->readEvent(todo); 337 mDetails->readEvent(todo);
338 mRelatedTodo = 0;//todo->relatedTo(); 338 mRelatedTodo = 0;//todo->relatedTo();
339 // categories 339 // categories
340 // mCategoryDialog->setSelected(todo->categories()); 340 // mCategoryDialog->setSelected(todo->categories());
341 341
342 // We should handle read-only events here. 342 // We should handle read-only events here.
343} 343}
344 344
345void KOTodoEditor::writeTodo(Todo *event) 345void KOTodoEditor::writeTodo(Todo *event)
346{ 346{
347 mGeneral->writeTodo(event); 347 bool maybeComputeRecurrenceTime = false;
348 mDetails->writeEvent(event); 348 if( event->hasRecurrenceID() && event->percentComplete() < 100)
349 349 maybeComputeRecurrenceTime = true;
350 // set related event, i.e. parent to-do in this case. 350 event->setHasRecurrenceID( false );
351 if (mRelatedTodo) { 351 mGeneral->writeTodo(event);
352 event->setRelatedTo(mRelatedTodo); 352 mDetails->writeEvent(event);
353 } 353
354 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) { 354 // set related event, i.e. parent to-do in this case.
355 mRecurrence->writeEvent(event); 355 if (mRelatedTodo) {
356 if ( event->doesRecur() ) { 356 event->setRelatedTo(mRelatedTodo);
357 event->setRecurrenceID( event->dtStart().addSecs(-1) ); 357 }
358 event->setRecurDates(); 358 if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
359 } else { 359 mRecurrence->writeEvent(event);
360 event->setHasRecurrenceID( false ); 360 if ( event->doesRecur() ) {
361 } 361 int addSec = -1 ;
362 } else { 362 if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
363 event->setHasRecurrenceID( false ); 363 addSec = 1;
364 event->recurrence()->unsetRecurs(); 364 event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
365 } 365 event->setRecurDates();
366 } else {
367 event->setHasRecurrenceID( false );
368 }
369 } else {
370 event->setHasRecurrenceID( false );
371 event->recurrence()->unsetRecurs();
372 }
366} 373}
367 374
368bool KOTodoEditor::validateInput() 375bool KOTodoEditor::validateInput()
369{ 376{
370 if (!mGeneral->validateInput()) return false; 377 if (!mGeneral->validateInput()) return false;
371 if (!mDetails->validateInput()) return false; 378 if (!mDetails->validateInput()) return false;
372 return true; 379 return true;
373} 380}
374 381
375int KOTodoEditor::msgItemDelete() 382int KOTodoEditor::msgItemDelete()
376{ 383{
377 return KMessageBox::warningContinueCancel(this, 384 return KMessageBox::warningContinueCancel(this,