-rw-r--r-- | bin/kdepim/korganizer/germantranslation.txt | 3 | ||||
-rw-r--r-- | korganizer/kotodoview.cpp | 60 | ||||
-rw-r--r-- | korganizer/kotodoview.h | 14 | ||||
-rw-r--r-- | libkcal/calendar.h | 1 | ||||
-rw-r--r-- | libkcal/calendarlocal.cpp | 6 | ||||
-rw-r--r-- | libkcal/calendarlocal.h | 1 | ||||
-rw-r--r-- | libkcal/todo.cpp | 4 |
7 files changed, 78 insertions, 11 deletions
diff --git a/bin/kdepim/korganizer/germantranslation.txt b/bin/kdepim/korganizer/germantranslation.txt index 01c707e..6ac79ad 100644 --- a/bin/kdepim/korganizer/germantranslation.txt +++ b/bin/kdepim/korganizer/germantranslation.txt | |||
@@ -1459,2 +1459,5 @@ | |||
1459 | { "KO/Pi import information!","KO/Pi Import Information!" }, | 1459 | { "KO/Pi import information!","KO/Pi Import Information!" }, |
1460 | { "Start this todo\nand stop all running","Starte dieses Todo\nund stoppe alle Laufenden" }, | ||
1461 | { "Cancel - do not start"," Abbrechen - Todo nicht starten" }, | ||
1462 | { "","" }, | ||
1460 | { "","" }, | 1463 | { "","" }, |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 7349d20..1bfdef9 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -65,2 +65,32 @@ using namespace KOrg; | |||
65 | 65 | ||
66 | KOStartTodoPrefs::KOStartTodoPrefs( QString sum, QWidget *parent, const char *name ) : | ||
67 | QDialog( parent, name, true ) | ||
68 | { | ||
69 | mStopAll = true; | ||
70 | setCaption( i18n("Start todo") ); | ||
71 | QVBoxLayout* lay = new QVBoxLayout( this ); | ||
72 | lay->setSpacing( 3 ); | ||
73 | lay->setMargin( 3 ); | ||
74 | QLabel * lab = new QLabel( i18n("<b>%1\n</b>").arg( sum ), this ); | ||
75 | lay->addWidget( lab ); | ||
76 | lab->setAlignment( AlignCenter ); | ||
77 | |||
78 | QPushButton * ok = new QPushButton( i18n("Start this todo\nand stop all running"), this ); | ||
79 | lay->addWidget( ok ); | ||
80 | ok->setDefault( true ); | ||
81 | QPushButton * start = new QPushButton( i18n("Start todo"), this ); | ||
82 | lay->addWidget( start ); | ||
83 | QPushButton * cancel = new QPushButton( i18n("Cancel - do not start"), this ); | ||
84 | lay->addWidget( cancel ); | ||
85 | connect ( ok,SIGNAL(clicked() ),this , SLOT ( accept() ) ); | ||
86 | connect ( start,SIGNAL(clicked() ),this , SLOT ( doStop() ) ); | ||
87 | connect (cancel, SIGNAL(clicked() ), this, SLOT ( reject()) ); | ||
88 | resize( sizeHint() ); | ||
89 | |||
90 | } | ||
91 | void KOStartTodoPrefs::doStop() | ||
92 | { | ||
93 | mStopAll = false; | ||
94 | accept(); | ||
95 | } | ||
66 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : | 96 | KOStopTodoPrefs::KOStopTodoPrefs( Todo* todo, QWidget *parent, const char *name ) : |
@@ -1201,5 +1231,5 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) | |||
1201 | } else { | 1231 | } else { |
1202 | t->setRunning( true ); | 1232 | t->setRunning( true ); |
1203 | mActiveItem->construct(); | 1233 | mActiveItem->construct(); |
1204 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); | 1234 | topLevelWidget()->setCaption(i18n("Todo started! Double click again to stop!")); |
1205 | return; | 1235 | return; |
@@ -1221,3 +1251,3 @@ void KOTodoView::toggleRunningItem() | |||
1221 | KOStopTodoPrefs tp ( t, this ); | 1251 | KOStopTodoPrefs tp ( t, this ); |
1222 | if (QApplication::desktop()->width() < 800 ){ | 1252 | if (QApplication::desktop()->width() <= 800 ){ |
1223 | int wid = tp.width(); | 1253 | int wid = tp.width(); |
@@ -1231,7 +1261,19 @@ void KOTodoView::toggleRunningItem() | |||
1231 | } else { | 1261 | } else { |
1232 | int result = KMessageBox::warningContinueCancel(this, | 1262 | KOStartTodoPrefs tp ( t->summary(), this ); |
1233 | 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); | 1263 | if (QApplication::desktop()->width() <= 800 ){ |
1234 | if (result != KMessageBox::Continue) return; | 1264 | int wid = tp.width(); |
1235 | t->setRunning( true ); | 1265 | int hei = tp.height(); |
1236 | mActiveItem->construct(); | 1266 | int xx = (QApplication::desktop()->width()-wid)/2; |
1267 | int yy = (QApplication::desktop()->height()-hei)/2; | ||
1268 | tp.setGeometry( xx,yy,wid,hei ); | ||
1269 | } | ||
1270 | if ( !tp.exec() ) return; | ||
1271 | if ( tp.stopAll() ) { | ||
1272 | mCalendar->stopAllTodos(); | ||
1273 | t->setRunning( true ); | ||
1274 | updateView(); | ||
1275 | } else { | ||
1276 | t->setRunning( true ); | ||
1277 | mActiveItem->construct(); | ||
1278 | } | ||
1237 | } | 1279 | } |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 8f0c99e..1b31d0d 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -78,2 +78,16 @@ private: | |||
78 | 78 | ||
79 | class KOStartTodoPrefs : public QDialog | ||
80 | { | ||
81 | Q_OBJECT | ||
82 | public: | ||
83 | KOStartTodoPrefs( QString sum, QWidget *parent=0, const char *name=0 ) ; | ||
84 | |||
85 | bool stopAll() { return mStopAll; } | ||
86 | private slots: | ||
87 | void doStop(); | ||
88 | private: | ||
89 | bool mStopAll; | ||
90 | |||
91 | }; | ||
92 | |||
79 | class KOTodoListView : public KListView | 93 | class KOTodoListView : public KListView |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 3b7b183..2efa355 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -79,2 +79,3 @@ public: | |||
79 | virtual void setSyncEventsReadOnly() = 0; | 79 | virtual void setSyncEventsReadOnly() = 0; |
80 | virtual void stopAllTodos() = 0; | ||
80 | 81 | ||
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 8c4dde1..18f1af8 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -149,2 +149,8 @@ bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | |||
149 | 149 | ||
150 | void CalendarLocal::stopAllTodos() | ||
151 | { | ||
152 | for ( Todo *it = mTodoList.first(); it; it = mTodoList.next() ) | ||
153 | it->setRunning( false ); | ||
154 | |||
155 | } | ||
150 | void CalendarLocal::close() | 156 | void CalendarLocal::close() |
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 0286b48..d32597f 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -48,2 +48,3 @@ class CalendarLocal : public Calendar | |||
48 | void setSyncEventsReadOnly(); | 48 | void setSyncEventsReadOnly(); |
49 | void stopAllTodos(); | ||
49 | /** | 50 | /** |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 9a8b6e4..5260051 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -113,4 +113,4 @@ void Todo::saveRunningInfoToFile( QString comment ) | |||
113 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); | 113 | //qDebug("Todo::saveRunningInfoToFile() %s", summary().latin1()); |
114 | if ( mRunStart.secsTo ( QDateTime::currentDateTime() ) < 10 ) { | 114 | if ( mRunStart.secsTo ( mRunEnd) < 15 ) { |
115 | qDebug("Running time < 30 seconds. Skipped. "); | 115 | qDebug("Running time < 15 seconds. Skipped. "); |
116 | return; | 116 | return; |