-rw-r--r-- | korganizer/kotodoview.cpp | 49 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 5 | ||||
-rw-r--r-- | libkcal/todo.cpp | 2 | ||||
-rw-r--r-- | libkcal/todo.h | 2 |
4 files changed, 45 insertions, 13 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index c5fae17..13e88ef 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -36,6 +36,8 @@ | |||
36 | #include "koprefs.h" | 36 | #include "koprefs.h" |
37 | #include <klocale.h> | 37 | #include <klocale.h> |
38 | #include <kglobal.h> | 38 | #include <kglobal.h> |
39 | #include <kdateedit.h> | ||
40 | #include "ktimeedit.h" | ||
39 | #include <kiconloader.h> | 41 | #include <kiconloader.h> |
40 | #include <kmessagebox.h> | 42 | #include <kmessagebox.h> |
41 | 43 | ||
@@ -72,7 +74,26 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name | |||
72 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); | 74 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); |
73 | lay->addWidget( lab ); | 75 | lay->addWidget( lab ); |
74 | lab->setAlignment( AlignHCenter ); | 76 | lab->setAlignment( AlignHCenter ); |
75 | 77 | lab = new QLabel( i18n("Additional Comment:"), this ); | |
78 | lay->addWidget( lab ); | ||
79 | mComment = new QLineEdit( this ); | ||
80 | lay->addWidget( mComment ); | ||
81 | QHBox * start = new QHBox ( this ); | ||
82 | lay->addWidget( start ); | ||
83 | lab = new QLabel( i18n("Start:"), start ); | ||
84 | QHBox * end = new QHBox ( this ); | ||
85 | lay->addWidget( end ); | ||
86 | lab = new QLabel( i18n("End:"), end ); | ||
87 | sde = new KDateEdit( start ); | ||
88 | ste = new KOTimeEdit( start ); | ||
89 | connect ( sde,SIGNAL(setTimeTo( QTime ) ),ste , SLOT ( setTime(QTime ) ) ); | ||
90 | ede = new KDateEdit( end ); | ||
91 | ete = new KOTimeEdit(end ); | ||
92 | connect ( ede,SIGNAL(setTimeTo( QTime ) ),ete , SLOT ( setTime(QTime ) ) ); | ||
93 | sde->setDate( mTodo->runStart().date() ); | ||
94 | ste->setTime( mTodo->runStart().time() ); | ||
95 | ede->setDate( QDate::currentDate()); | ||
96 | ete->setTime( QTime::currentTime() ); | ||
76 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | 97 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); |
77 | lay->addWidget( ok ); | 98 | lay->addWidget( ok ); |
78 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | 99 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); |
@@ -82,20 +103,24 @@ KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name | |||
82 | ok = new QPushButton( i18n("Stop - do not save"), this ); | 103 | ok = new QPushButton( i18n("Stop - do not save"), this ); |
83 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); | 104 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); |
84 | lay->addWidget( ok ); | 105 | lay->addWidget( ok ); |
85 | resize( 200, 200 ); | 106 | if (QApplication::desktop()->width() < 320 ) |
107 | resize( 240, 200 ); | ||
108 | else | ||
109 | resize( 320, 200 ); | ||
110 | |||
86 | } | 111 | } |
87 | 112 | ||
88 | void KOStopTodoPrefs::accept() | 113 | void KOStopTodoPrefs::accept() |
89 | { | 114 | { |
90 | qDebug("KOStopTodoPrefs::accept() "); | 115 | QDateTime start = QDateTime( sde->date(), ste->getTime() ); |
91 | 116 | QDateTime stop = QDateTime( ede->date(), ete->getTime() ); | |
92 | 117 | if ( start > stop ) { | |
93 | #if 0 | 118 | KMessageBox::sorry(this, |
94 | t->setRunningFalse( comment ); | 119 | i18n("The start time is\nafter the end time!"), |
95 | 120 | i18n("Time mismatch!")); | |
96 | t->setRunning( false ); | 121 | return; |
97 | #endif | 122 | } |
98 | 123 | mTodo->saveRunningInfo( mComment->text(), start, stop ); | |
99 | QDialog::accept(); | 124 | QDialog::accept(); |
100 | } | 125 | } |
101 | void KOStopTodoPrefs::doNotSave() | 126 | void KOStopTodoPrefs::doNotSave() |
@@ -1199,7 +1224,7 @@ void KOTodoView::toggleRunningItem() | |||
1199 | #endif | 1224 | #endif |
1200 | } else { | 1225 | } else { |
1201 | int result = KMessageBox::warningContinueCancel(this, | 1226 | int result = KMessageBox::warningContinueCancel(this, |
1202 | i18n("The todo\n%1\nis stopped.\nDo you want to set\nthe state to started?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is stopped"),i18n("Start todo"),i18n("Cancel"), true); | 1227 | i18n("<center>%1</center> <center>is not running. Do you want to set\nthe state to running?</center>").arg(mActiveItem->text(0).left( 25 ) ),i18n("Start todo"),i18n("Start todo"),i18n("Cancel"), true); |
1203 | if (result != KMessageBox::Continue) return; | 1228 | if (result != KMessageBox::Continue) return; |
1204 | t->setRunning( true ); | 1229 | t->setRunning( true ); |
1205 | mActiveItem->construct(); | 1230 | mActiveItem->construct(); |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index ceabdba..8f0c99e 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -52,6 +52,8 @@ class QDragMoveEvent; | |||
52 | class QDragLeaveEvent; | 52 | class QDragLeaveEvent; |
53 | class QDropEvent; | 53 | class QDropEvent; |
54 | class KOTodoViewWhatsThis; | 54 | class KOTodoViewWhatsThis; |
55 | class KDateEdit; | ||
56 | class KOTimeEdit; | ||
55 | 57 | ||
56 | class DocPrefs; | 58 | class DocPrefs; |
57 | 59 | ||
@@ -68,6 +70,9 @@ private slots: | |||
68 | void accept(); | 70 | void accept(); |
69 | private: | 71 | private: |
70 | Todo* mTodo; | 72 | Todo* mTodo; |
73 | QLineEdit* mComment; | ||
74 | KDateEdit *sde, *ede; | ||
75 | KOTimeEdit *ste, *ete; | ||
71 | 76 | ||
72 | }; | 77 | }; |
73 | 78 | ||
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 62b74f1..9a8b6e4 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -97,6 +97,8 @@ void Todo::setRunning( bool run ) | |||
97 | } | 97 | } |
98 | void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) | 98 | void Todo::saveRunningInfo( QString comment, QDateTime start, QDateTime end ) |
99 | { | 99 | { |
100 | if ( !mRunning) return; | ||
101 | mRunning = false; | ||
100 | mRunStart = start; | 102 | mRunStart = start; |
101 | mRunEnd = end; | 103 | mRunEnd = end; |
102 | saveRunningInfoToFile( comment ); | 104 | saveRunningInfoToFile( comment ); |
diff --git a/libkcal/todo.h b/libkcal/todo.h index 11f848e..425dfad 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -42,7 +42,6 @@ namespace KCal { | |||
42 | typedef ListBase<Todo> List; | 42 | typedef ListBase<Todo> List; |
43 | QCString type() const { return "Todo"; } | 43 | QCString type() const { return "Todo"; } |
44 | IncTypeID typeID() const { return todoID; } | 44 | IncTypeID typeID() const { return todoID; } |
45 | void saveRunningInfo( QString comment, QDateTime start, QDateTime end ); | ||
46 | 45 | ||
47 | /** Return an exact copy of this todo. */ | 46 | /** Return an exact copy of this todo. */ |
48 | Incidence *clone(); | 47 | Incidence *clone(); |
@@ -126,6 +125,7 @@ namespace KCal { | |||
126 | void stopRunning(); | 125 | void stopRunning(); |
127 | int runTime(); | 126 | int runTime(); |
128 | QDateTime runStart () const { return mRunStart;} | 127 | QDateTime runStart () const { return mRunStart;} |
128 | void saveRunningInfo( QString comment, QDateTime start, QDateTime end ); | ||
129 | public slots: | 129 | public slots: |
130 | void saveRunningInfoToFile( QString st ); | 130 | void saveRunningInfoToFile( QString st ); |
131 | void saveRunningInfoToFile( ); | 131 | void saveRunningInfoToFile( ); |