summaryrefslogtreecommitdiffabout
path: root/korganizer/kotodoeditor.cpp
Side-by-side diff
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
@@ -107,17 +107,17 @@ void KOTodoEditor::setupGeneral()
if (KOPrefs::instance()->mCompactDialogs) {
QFrame *topFrame = addPage(i18n("General"));
QBoxLayout *topLayout = new QVBoxLayout(topFrame);
if ( QApplication::desktop()->width() < 480 ) {
- topLayout->setMargin(1);
- topLayout->setSpacing(1);
+ topLayout->setMargin(marginHintSmall());
+ topLayout->setSpacing(spacingHintSmall());
} else {
- topLayout->setMargin(marginHint()-1);
- topLayout->setSpacing(spacingHint()-1);
+ topLayout->setMargin(marginHint());
+ topLayout->setSpacing(spacingHint());
}
mGeneral->initHeader(topFrame,topLayout);
mGeneral->initTime(topFrame,topLayout);
mGeneral->initAlarm(topFrame,topLayout);
mGeneral->enableAlarm( false );
@@ -341,31 +341,38 @@ void KOTodoEditor::readTodo(Todo *todo)
// We should handle read-only events here.
}
void KOTodoEditor::writeTodo(Todo *event)
{
- mGeneral->writeTodo(event);
- mDetails->writeEvent(event);
-
- // set related event, i.e. parent to-do in this case.
- if (mRelatedTodo) {
- event->setRelatedTo(mRelatedTodo);
- }
- if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
- mRecurrence->writeEvent(event);
- if ( event->doesRecur() ) {
- event->setRecurrenceID( event->dtStart().addSecs(-1) );
- event->setRecurDates();
- } else {
- event->setHasRecurrenceID( false );
- }
- } else {
- event->setHasRecurrenceID( false );
- event->recurrence()->unsetRecurs();
- }
+ bool maybeComputeRecurrenceTime = false;
+ if( event->hasRecurrenceID() && event->percentComplete() < 100)
+ maybeComputeRecurrenceTime = true;
+ event->setHasRecurrenceID( false );
+ mGeneral->writeTodo(event);
+ mDetails->writeEvent(event);
+
+ // set related event, i.e. parent to-do in this case.
+ if (mRelatedTodo) {
+ event->setRelatedTo(mRelatedTodo);
+ }
+ if ( mGeneral->mDueCheck->isChecked() && mGeneral->mStartCheck->isChecked()) {
+ mRecurrence->writeEvent(event);
+ if ( event->doesRecur() ) {
+ int addSec = -1 ;
+ if ( maybeComputeRecurrenceTime && event->percentComplete() == 100 )
+ addSec = 1;
+ event->setRecurrenceID( event->dtStart().addSecs( addSec ) );
+ event->setRecurDates();
+ } else {
+ event->setHasRecurrenceID( false );
+ }
+ } else {
+ event->setHasRecurrenceID( false );
+ event->recurrence()->unsetRecurs();
+ }
}
bool KOTodoEditor::validateInput()
{
if (!mGeneral->validateInput()) return false;
if (!mDetails->validateInput()) return false;