summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeditorgeneraltodo.cpp52
-rw-r--r--korganizer/koeditorgeneraltodo.h2
2 files changed, 44 insertions, 10 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp
index b9a028b..ce0d7a9 100644
--- a/korganizer/koeditorgeneraltodo.cpp
+++ b/korganizer/koeditorgeneraltodo.cpp
@@ -150,3 +150,17 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout)
mCompletedLabel = new QLabel(i18n("completed"),parent);
- topLayout->addWidget(mCompletedLabel);
+ topLayout->addWidget(mCompletedLabel);
+
+ mCompleteDateEdit = new KDateEdit(parent);
+ topLayout->addWidget(mCompleteDateEdit );
+
+ mCompleteTimeEdit = new KOTimeEdit(parent);
+ topLayout->addWidget( mCompleteTimeEdit);
+
+ mCompletedCombo->setSizePolicy( QSizePolicy( QSizePolicy::Preferred,QSizePolicy::Preferred) );
+ mCompletedLabel->setSizePolicy( QSizePolicy( QSizePolicy::Expanding,QSizePolicy::Preferred) );
+
+ if ( QApplication::desktop()->width() < 320 ) {
+ mCompleteDateEdit->setMaximumWidth( 85 );
+ topLayout->setSpacing( 0 );
+ }
}
@@ -160,3 +174,2 @@ void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout)
// topLayout->addWidget(priorityLabel);
-
mPriorityCombo = new QComboBox( h );
@@ -314,3 +327,2 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo)
}
-
todo->setPriority(mPriorityCombo->currentItem()+1);
@@ -318,7 +330,17 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo)
// set completion state
- todo->setPercentComplete(mCompletedCombo->currentItem() * 20);
-
- if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) {
- todo->setCompleted(mCompleted);
+ if ( mCompletedCombo->currentItem() == 5 ) {
+ QDateTime comp ( mCompleteDateEdit->date(), mCompleteTimeEdit->getTime() );
+ if ( comp.isValid () ) {
+ todo->setPercentComplete(0);
+ todo->setPercentComplete(100);
+ todo->setCompleted(comp);
+ } else {
+ todo->setPercentComplete( 100 );
+ if ( mCompleted.isValid() )
+ todo->setCompleted(mCompleted);
+ }
+ } else {
+ todo->setPercentComplete(mCompletedCombo->currentItem() * 20);
}
+
mSummaryEdit->save(KOLocationBox::SUMMARYTODO);
@@ -422,3 +444,4 @@ void KOEditorGeneralTodo::completedChanged(int index)
if (index == 5) {
- mCompleted = QDateTime::currentDateTime();
+ //get rid of milli sec
+ mCompleted = QDateTime::currentDateTime();
}
@@ -430,6 +453,15 @@ void KOEditorGeneralTodo::setCompletedDate()
if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) {
- mCompletedLabel->setText(i18n("completed on %1")
- .arg(KGlobal::locale()->formatDateTime(mCompleted)));
+ if ( QApplication::desktop()->width() < 480 ) {
+ mCompletedLabel->setText(i18n(" on"));
+ }
+ else
+ mCompletedLabel->setText(i18n(" completed on "));
+ mCompleteDateEdit->show();
+ mCompleteTimeEdit->show();
+ mCompleteTimeEdit->setTime( mCompleted.time() );
+ mCompleteDateEdit->setDate( mCompleted.date() );
} else {
mCompletedLabel->setText(i18n("completed"));
+ mCompleteDateEdit->hide();
+ mCompleteTimeEdit->hide();
}
diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h
index 5f1c3cc..98f43dd 100644
--- a/korganizer/koeditorgeneraltodo.h
+++ b/korganizer/koeditorgeneraltodo.h
@@ -90,2 +90,4 @@ class KOEditorGeneralTodo : public KOEditorGeneral
KOTimeEdit *mStartTimeEdit;
+ KDateEdit *mCompleteDateEdit;
+ KOTimeEdit *mCompleteTimeEdit;
QCheckBox *mTimeButton;