summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kotodoview.cpp13
-rw-r--r--korganizer/kotodoview.h1
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
@@ -113,26 +113,27 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name
lab = new QLabel( i18n("Start:"), start );
QHBox * end = new QHBox ( this );
lay->addWidget( end );
lab = new QLabel( i18n("End:"), end );
sde = new KDateEdit( start );
ste = new KOTimeEdit( start );
connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) );
ede = new KDateEdit( end );
ete = new KOTimeEdit(end );
connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) );
sde->setDate( mTodo->runStart().date() );
ste->setTime( mTodo->runStart().time() );
- ede->setDate( QDate::currentDate());
- ete->setTime( QTime::currentTime() );
+ mStop = QDateTime::currentDateTime();
+ ede->setDate( mStop.date());
+ ete->setTime( mStop.time() );
QPushButton * ok = new QPushButton( i18n("Stop and save"), this );
lay->addWidget( ok );
ok->setDefault( true );
QPushButton * cancel = new QPushButton( i18n("Continue running"), this );
lay->addWidget( cancel );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) );
connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) );
ok = new QPushButton( i18n("Stop - do not save"), this );
connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) );
lay->addWidget( ok );
if (QApplication::desktop()->width() < 320 )
resize( 240, sizeHint().height() );
@@ -142,24 +143,32 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name
}
void KOStopTodoPrefs::accept()
{
QDateTime start = QDateTime( sde->date(), ste->getTime() );
QDateTime stop = QDateTime( ede->date(), ete->getTime() );
if ( start > stop ) {
KMessageBox::sorry(this,
i18n("The start time is\nafter the end time!"),
i18n("Time mismatch!"));
return;
}
+ // restoring the seconds
+ if ( start == QDateTime( mTodo->runStart().date(),
+ QTime(mTodo->runStart().time().hour() , mTodo->runStart().time().minute() ) ) )
+ start = mTodo->runStart();
+ if ( stop == QDateTime( mStop.date(),
+ QTime( mStop.time().hour() , mStop.time().minute() ) ) )
+ stop = mStop;
+
mTodo->saveRunningInfo( mComment->text(), start, stop );
QDialog::accept();
}
void KOStopTodoPrefs::doNotSave()
{
int result = KMessageBox::warningContinueCancel(this,
i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary(),i18n("Yes, stop todo") );
if (result != KMessageBox::Continue) return;
mTodo->stopRunning();
QDialog::accept();
}
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h
index 9180015..ecd0ad9 100644
--- a/korganizer/kotodoview.h
+++ b/korganizer/kotodoview.h
@@ -62,24 +62,25 @@ class KOStopTodoPrefs : public QDialog
{
Q_OBJECT
public:
KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ;
private slots:
void doNotSave();
void accept();
private:
Todo* mTodo;
QLineEdit* mComment;
+ QDateTime mStop;
KDateEdit *sde, *ede;
KOTimeEdit *ste, *ete;
};
class KOStartTodoPrefs : public QDialog
{
Q_OBJECT
public:
KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ;
bool stopAll() { return mStopAll; }