-rw-r--r-- | korganizer/kotodoview.cpp | 13 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 1 |
2 files changed, 12 insertions, 2 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 07bfdbf..a12c43e 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -117,18 +117,19 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name | |||
117 | sde = new KDateEdit( start ); | 117 | sde = new KDateEdit( start ); |
118 | ste = new KOTimeEdit( start ); | 118 | ste = new KOTimeEdit( start ); |
119 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | 119 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); |
120 | ede = new KDateEdit( end ); | 120 | ede = new KDateEdit( end ); |
121 | ete = new KOTimeEdit(end ); | 121 | ete = new KOTimeEdit(end ); |
122 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | 122 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); |
123 | sde->setDate( mTodo->runStart().date() ); | 123 | sde->setDate( mTodo->runStart().date() ); |
124 | ste->setTime( mTodo->runStart().time() ); | 124 | ste->setTime( mTodo->runStart().time() ); |
125 | ede->setDate( QDate::currentDate()); | 125 | mStop = QDateTime::currentDateTime(); |
126 | ete->setTime( QTime::currentTime() ); | 126 | ede->setDate( mStop.date()); |
127 | ete->setTime( mStop.time() ); | ||
127 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 128 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
128 | lay->addWidget( ok ); | 129 | lay->addWidget( ok ); |
129 | ok->setDefault( true ); | 130 | ok->setDefault( true ); |
130 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | 131 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); |
131 | lay->addWidget( cancel ); | 132 | lay->addWidget( cancel ); |
132 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | 133 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); |
133 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | 134 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); |
134 | ok = new QPushButton( i18n("Stop - do not save"), this ); | 135 | ok = new QPushButton( i18n("Stop - do not save"), this ); |
@@ -146,16 +147,24 @@ void KOStopTodoPrefs::accept() | |||
146 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); | 147 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); |
147 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); | 148 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); |
148 | if ( start > stop ) { | 149 | if ( start > stop ) { |
149 | KMessageBox::sorry(this, | 150 | KMessageBox::sorry(this, |
150 | i18n("The start time is\nafter the end time!"), | 151 | i18n("The start time is\nafter the end time!"), |
151 | i18n("Time mismatch!")); | 152 | i18n("Time mismatch!")); |
152 | return; | 153 | return; |
153 | } | 154 | } |
155 | // restoring the seconds | ||
156 | if ( start == QDateTime( mTodo->runStart().date(), | ||
157 | QTime(mTodo->runStart().time().hour() , mTodo->runStart().time().minute() ) ) ) | ||
158 | start = mTodo->runStart(); | ||
159 | if ( stop == QDateTime( mStop.date(), | ||
160 | QTime( mStop.time().hour() , mStop.time().minute() ) ) ) | ||
161 | stop = mStop; | ||
162 | |||
154 | mTodo->saveRunningInfo( mComment->text(), start, stop ); | 163 | mTodo->saveRunningInfo( mComment->text(), start, stop ); |
155 | QDialog::accept(); | 164 | QDialog::accept(); |
156 | } | 165 | } |
157 | void KOStopTodoPrefs::doNotSave() | 166 | void KOStopTodoPrefs::doNotSave() |
158 | { | 167 | { |
159 | int result = KMessageBox::warningContinueCancel(this, | 168 | int result = KMessageBox::warningContinueCancel(this, |
160 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); | 169 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") ); |
161 | if (result != KMessageBox::Continue) return; | 170 | if (result != KMessageBox::Continue) return; |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 9180015..ecd0ad9 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -66,16 +66,17 @@ class KOStopTodoPrefs : public QDialog | |||
66 | 66 | ||
67 | 67 | ||
68 | private slots: | 68 | private slots: |
69 | void doNotSave(); | 69 | void doNotSave(); |
70 | void accept(); | 70 | void accept(); |
71 | private: | 71 | private: |
72 | Todo* mTodo; | 72 | Todo* mTodo; |
73 | QLineEdit* mComment; | 73 | QLineEdit* mComment; |
74 | QDateTime mStop; | ||
74 | KDateEdit *sde, *ede; | 75 | KDateEdit *sde, *ede; |
75 | KOTimeEdit *ste, *ete; | 76 | KOTimeEdit *ste, *ete; |
76 | 77 | ||
77 | }; | 78 | }; |
78 | 79 | ||
79 | class KOStartTodoPrefs : public QDialog | 80 | class KOStartTodoPrefs : public QDialog |
80 | { | 81 | { |
81 | Q_OBJECT | 82 | Q_OBJECT |