author | zautrix <zautrix> | 2005-02-05 13:29:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-05 13:29:28 (UTC) |
commit | 7be6218eaf6bd29d4bc09d0bb79bb0dec6da9ae5 (patch) (side-by-side diff) | |
tree | 468b1c9fa182e1be58e098c7c809afefe14a7b6c /korganizer | |
parent | f5902d0e08e0b10321c555e8846a8a8ce2087d30 (diff) | |
download | kdepimpi-7be6218eaf6bd29d4bc09d0bb79bb0dec6da9ae5.zip kdepimpi-7be6218eaf6bd29d4bc09d0bb79bb0dec6da9ae5.tar.gz kdepimpi-7be6218eaf6bd29d4bc09d0bb79bb0dec6da9ae5.tar.bz2 |
comp fix
-rw-r--r-- | korganizer/koeditorgeneraltodo.cpp | 46 | ||||
-rw-r--r-- | korganizer/koeditorgeneraltodo.h | 2 |
2 files changed, 41 insertions, 7 deletions
diff --git a/korganizer/koeditorgeneraltodo.cpp b/korganizer/koeditorgeneraltodo.cpp index b9a028b..ce0d7a9 100644 --- a/korganizer/koeditorgeneraltodo.cpp +++ b/korganizer/koeditorgeneraltodo.cpp @@ -140,34 +140,47 @@ void KOEditorGeneralTodo::initCompletion(QWidget *parent, QBoxLayout *topLayout) mCompletedCombo->insertItem(i18n(" 40 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 60 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n(" 80 %")); // xgettext:no-c-format mCompletedCombo->insertItem(i18n("100 %")); connect(mCompletedCombo,SIGNAL(activated(int)),SLOT(completedChanged(int))); topLayout->addWidget(mCompletedCombo); mCompletedLabel = new QLabel(i18n("completed"),parent); 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 ); + } } void KOEditorGeneralTodo::initPriority(QWidget *parent, QBoxLayout *topLayout) { QHBox* h = new QHBox ( parent ); topLayout->addWidget( h ); QLabel *priorityLabel = new QLabel(i18n("Priority:"), h); // topLayout->addWidget(priorityLabel); - mPriorityCombo = new QComboBox( h ); mPriorityCombo->insertItem(i18n("1 (high)")); mPriorityCombo->insertItem(i18n("2")); mPriorityCombo->insertItem(i18n("3")); mPriorityCombo->insertItem(i18n("4")); mPriorityCombo->insertItem(i18n("5 (low)")); //topLayout->addWidget(mPriorityCombo); } void KOEditorGeneralTodo::initStatus(QWidget *parent,QBoxLayout *topLayout) { QBoxLayout *statusLayout = new QHBoxLayout(topLayout); @@ -303,33 +316,42 @@ void KOEditorGeneralTodo::writeTodo(Todo *todo) tmpDate = mDueDateEdit->date(); tmpTime.setHMS(0,0,0); tmpDT.setDate(tmpDate); tmpDT.setTime(tmpTime); todo->setDtDue(tmpDT); tmpDate = mStartDateEdit->date(); tmpTime.setHMS(0,0,0); tmpDT.setDate(tmpDate); tmpDT.setTime(tmpTime); todo->setDtStart(tmpDT); } - todo->setPriority(mPriorityCombo->currentItem()+1); // set completion state - todo->setPercentComplete(mCompletedCombo->currentItem() * 20); - - if (mCompletedCombo->currentItem() == 5 && mCompleted.isValid()) { + 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); } void KOEditorGeneralTodo::enableDueEdit(bool enable) { mDueDateEdit->setEnabled( enable ); if(mDueCheck->isChecked() || mStartCheck->isChecked()) { mTimeButton->setEnabled(true); } else { mTimeButton->setEnabled(false); @@ -411,36 +433,46 @@ bool KOEditorGeneralTodo::validateInput() KMessageBox::sorry(0, i18n("The start date cannot be after the due date.")); return false; } } return KOEditorGeneral::validateInput(); } void KOEditorGeneralTodo::completedChanged(int index) { if (index == 5) { + //get rid of milli sec mCompleted = QDateTime::currentDateTime(); } setCompletedDate(); } 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(); } } void KOEditorGeneralTodo::modified (Todo* todo, int modification) { switch (modification) { case KOGlobals::PRIORITY_MODIFIED: mPriorityCombo->setCurrentItem(todo->priority()-1); break; case KOGlobals::COMPLETION_MODIFIED: mCompletedCombo->setCurrentItem(todo->percentComplete() / 20); if (todo->isCompleted() && todo->hasCompletedDate()) { diff --git a/korganizer/koeditorgeneraltodo.h b/korganizer/koeditorgeneraltodo.h index 5f1c3cc..98f43dd 100644 --- a/korganizer/koeditorgeneraltodo.h +++ b/korganizer/koeditorgeneraltodo.h @@ -79,24 +79,26 @@ class KOEditorGeneralTodo : public KOEditorGeneral void enableDueEdit( bool enable ); void enableStartEdit( bool enable ); void enableTimeEdits( bool enable ); void showAlarm(); protected: void setCompletedDate(); private: friend class KOTodoEditor; KDateEdit *mStartDateEdit; KOTimeEdit *mStartTimeEdit; + KDateEdit *mCompleteDateEdit; + KOTimeEdit *mCompleteTimeEdit; QCheckBox *mTimeButton; QCheckBox *mDueCheck; KDateEdit *mDueDateEdit; KOTimeEdit *mDueTimeEdit; QComboBox *mCompletedCombo; QLabel *mCompletedLabel; QLabel *mPriorityLabel; QComboBox *mPriorityCombo; QCheckBox *mStartCheck; QDateTime mCompleted; |