-rw-r--r-- | korganizer/kotodoview.cpp | 56 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 18 | ||||
-rw-r--r-- | korganizer/kotodoviewitem.cpp | 2 | ||||
-rw-r--r-- | libkcal/todo.cpp | 10 | ||||
-rw-r--r-- | libkcal/todo.h | 1 |
5 files changed, 81 insertions, 6 deletions
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index b2ff33b..99e6a3a 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -24,8 +24,11 @@ | |||
24 | #include <qlayout.h> | 24 | #include <qlayout.h> |
25 | #include <qheader.h> | 25 | #include <qheader.h> |
26 | #include <qcursor.h> | 26 | #include <qcursor.h> |
27 | #include <qwhatsthis.h> | 27 | #include <qwhatsthis.h> |
28 | #include <qdialog.h> | ||
29 | #include <qlabel.h> | ||
30 | #include <qpushbutton.h> | ||
28 | 31 | ||
29 | #include <qinputdialog.h> | 32 | #include <qinputdialog.h> |
30 | 33 | ||
31 | #include <qvbox.h> | 34 | #include <qvbox.h> |
@@ -57,8 +60,48 @@ | |||
57 | #include "kotodoview.h" | 60 | #include "kotodoview.h" |
58 | using namespace KOrg; | 61 | using namespace KOrg; |
59 | 62 | ||
60 | 63 | ||
64 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | ||
65 | QDialog( parent, name, true ) | ||
66 | { | ||
67 | mTodo = todo; | ||
68 | setCaption( i18n("Stop todo") ); | ||
69 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
70 | lay->setSpacing( 3 ); | ||
71 | lay->setMargin( 3 ); | ||
72 | QLabel * lab = new QLabel( i18n("%1\nis running!").arg( todo->summary() ), this ); | ||
73 | lay->addWidget( lab ); | ||
74 | lab->setAlignment( AlignHCenter ); | ||
75 | |||
76 | QPushButton * ok = new QPushButton( i18n("Stop and save"), this ); | ||
77 | lay->addWidget( ok ); | ||
78 | QPushButton * cancel = new QPushButton( i18n("Continue running"), this ); | ||
79 | lay->addWidget( cancel ); | ||
80 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
81 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
82 | ok = new QPushButton( i18n("Stop - do not save"), this ); | ||
83 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( doNotSave() ) ); | ||
84 | lay->addWidget( ok ); | ||
85 | resize( 200, 200 ); | ||
86 | } | ||
87 | |||
88 | void KOStopTodoPrefs::accept() | ||
89 | { | ||
90 | qDebug("KOStopTodoPrefs::accept() "); | ||
91 | QDialog::accept(); | ||
92 | } | ||
93 | void KOStopTodoPrefs::doNotSave() | ||
94 | { | ||
95 | |||
96 | int result = KMessageBox::warningContinueCancel(this, | ||
97 | i18n("Do you really want to set\nthe state to stopped\nwithout saving the data?"),mTodo->summary() ); | ||
98 | if (result != KMessageBox::Continue) return; | ||
99 | mTodo->stopRunning(); | ||
100 | QDialog::accept(); | ||
101 | } | ||
102 | |||
103 | |||
61 | class KOTodoViewWhatsThis :public QWhatsThis | 104 | class KOTodoViewWhatsThis :public QWhatsThis |
62 | { | 105 | { |
63 | public: | 106 | public: |
64 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; | 107 | KOTodoViewWhatsThis( QWidget *wid, KOTodoView* view ) : QWhatsThis( wid ), _wid(wid),_view (view) { }; |
@@ -1126,13 +1169,15 @@ void KOTodoView::toggleRunningItem() | |||
1126 | if ( ! mActiveItem ) | 1169 | if ( ! mActiveItem ) |
1127 | return; | 1170 | return; |
1128 | Todo * t = mActiveItem->todo(); | 1171 | Todo * t = mActiveItem->todo(); |
1129 | if ( t->isRunning() ) { | 1172 | if ( t->isRunning() ) { |
1130 | #if 0 | ||
1131 | int result = KMessageBox::warningContinueCancel(this, | ||
1132 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop todo"),i18n("Cancel"), true); | ||
1133 | #endif | ||
1134 | 1173 | ||
1174 | |||
1175 | KOStopTodoPrefs tp ( t, this ); | ||
1176 | tp.exec(); | ||
1177 | |||
1178 | |||
1179 | #if 0 | ||
1135 | int result = KMessageBox::warningYesNoCancel(this, | 1180 | int result = KMessageBox::warningYesNoCancel(this, |
1136 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); | 1181 | i18n("The todo\n%1\nis started.\nDo you want to set\nthe state to stopped?").arg(mActiveItem->text(0).left( 25 ) ),i18n("Todo is started"),i18n("Stop"),i18n("Stop+note")); |
1137 | if (result == KMessageBox::Cancel) return; | 1182 | if (result == KMessageBox::Cancel) return; |
1138 | if ( result == KMessageBox::No ) { | 1183 | if ( result == KMessageBox::No ) { |
@@ -1141,8 +1186,11 @@ void KOTodoView::toggleRunningItem() | |||
1141 | } else { | 1186 | } else { |
1142 | t->setRunning( false ); | 1187 | t->setRunning( false ); |
1143 | } | 1188 | } |
1144 | mActiveItem->construct(); | 1189 | mActiveItem->construct(); |
1190 | |||
1191 | |||
1192 | #endif | ||
1145 | } else { | 1193 | } else { |
1146 | int result = KMessageBox::warningContinueCancel(this, | 1194 | int result = KMessageBox::warningContinueCancel(this, |
1147 | 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); | 1195 | 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); |
1148 | if (result != KMessageBox::Continue) return; | 1196 | if (result != KMessageBox::Continue) return; |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 1ffc34a..ceabdba 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -31,8 +31,10 @@ | |||
31 | #include <qlistbox.h> | 31 | #include <qlistbox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qlabel.h> | 33 | #include <qlabel.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | #include <qdialog.h> | ||
36 | #include <qlabel.h> | ||
35 | #include <qlistview.h> | 37 | #include <qlistview.h> |
36 | #include <klistview.h> | 38 | #include <klistview.h> |
37 | 39 | ||
38 | #include <libkcal/calendar.h> | 40 | #include <libkcal/calendar.h> |
@@ -52,8 +54,24 @@ class QDropEvent; | |||
52 | class KOTodoViewWhatsThis; | 54 | class KOTodoViewWhatsThis; |
53 | 55 | ||
54 | class DocPrefs; | 56 | class DocPrefs; |
55 | 57 | ||
58 | |||
59 | class KOStopTodoPrefs : public QDialog | ||
60 | { | ||
61 | Q_OBJECT | ||
62 | public: | ||
63 | KOStopTodoPrefs( Todo* todo, QWidget *parent=0, const char *name=0 ) ; | ||
64 | |||
65 | |||
66 | private slots: | ||
67 | void doNotSave(); | ||
68 | void accept(); | ||
69 | private: | ||
70 | Todo* mTodo; | ||
71 | |||
72 | }; | ||
73 | |||
56 | class KOTodoListView : public KListView | 74 | class KOTodoListView : public KListView |
57 | { | 75 | { |
58 | Q_OBJECT | 76 | Q_OBJECT |
59 | public: | 77 | public: |
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp index f62aab8..0cf6e4c 100644 --- a/korganizer/kotodoviewitem.cpp +++ b/korganizer/kotodoviewitem.cpp | |||
@@ -359,9 +359,9 @@ bool KOTodoViewItem::isAlternate() | |||
359 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) | 359 | void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) |
360 | { | 360 | { |
361 | QColorGroup _cg = cg; | 361 | QColorGroup _cg = cg; |
362 | QColorGroup::ColorRole role; | 362 | QColorGroup::ColorRole role; |
363 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) | 363 | if ( KOPrefs::instance()->mTodoViewUsesForegroundColor && !mTodo->isRunning()) |
364 | role = QColorGroup::Text; | 364 | role = QColorGroup::Text; |
365 | else | 365 | else |
366 | role = QColorGroup::Base; | 366 | role = QColorGroup::Base; |
367 | //#ifndef KORG_NOLVALTERNATION | 367 | //#ifndef KORG_NOLVALTERNATION |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index e98af3c..d062492 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -68,8 +68,16 @@ void Todo::setRunningFalse( QString s ) | |||
68 | mRunning = false; | 68 | mRunning = false; |
69 | mRunSaveTimer->stop(); | 69 | mRunSaveTimer->stop(); |
70 | saveRunningInfoToFile( s ); | 70 | saveRunningInfoToFile( s ); |
71 | } | 71 | } |
72 | void Todo::stopRunning() | ||
73 | { | ||
74 | if ( !mRunning ) | ||
75 | return; | ||
76 | if ( mRunSaveTimer ) | ||
77 | mRunSaveTimer->stop(); | ||
78 | mRunning = false; | ||
79 | } | ||
72 | void Todo::setRunning( bool run ) | 80 | void Todo::setRunning( bool run ) |
73 | { | 81 | { |
74 | if ( run == mRunning ) | 82 | if ( run == mRunning ) |
75 | return; | 83 | return; |
@@ -94,9 +102,9 @@ void Todo::saveRunningInfoToFile() | |||
94 | } | 102 | } |
95 | void Todo::saveRunningInfoToFile( QString comment ) | 103 | void Todo::saveRunningInfoToFile( QString comment ) |
96 | { | 104 | { |
97 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 105 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
98 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 30 ) { | 106 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 10 ) { |
99 | qDebug("Running time < 30 seconds. Skipped. "); | 107 | qDebug("Running time < 30 seconds. Skipped. "); |
100 | return; | 108 | return; |
101 | } | 109 | } |
102 | QString dir = KGlobalSettings::timeTrackerDir(); | 110 | QString dir = KGlobalSettings::timeTrackerDir(); |
diff --git a/libkcal/todo.h b/libkcal/todo.h index 6fc4d4b..42db025 100644 --- a/libkcal/todo.h +++ b/libkcal/todo.h | |||
@@ -121,8 +121,9 @@ namespace KCal { | |||
121 | bool isRunning() {return mRunning;} | 121 | bool isRunning() {return mRunning;} |
122 | bool hasRunningSub(); | 122 | bool hasRunningSub(); |
123 | void setRunning( bool ); | 123 | void setRunning( bool ); |
124 | void setRunningFalse( QString ); | 124 | void setRunningFalse( QString ); |
125 | void stopRunning(); | ||
125 | int runTime(); | 126 | int runTime(); |
126 | QDateTime runStart () const { return mRunStart;} | 127 | QDateTime runStart () const { return mRunStart;} |
127 | public slots: | 128 | public slots: |
128 | void saveRunningInfoToFile( QString st ); | 129 | void saveRunningInfoToFile( QString st ); |