author | zautrix <zautrix> | 2005-06-27 04:48:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-06-27 04:48:41 (UTC) |
commit | 9b2bf31715226dfa8210f31843616a04f810f012 (patch) (unidiff) | |
tree | b502c4a379b26f74621ba8fabb59fcb53f5a5679 | |
parent | 2e566a307bb50ac595fe729ebed0f5336f2af5a8 (diff) | |
download | kdepimpi-9b2bf31715226dfa8210f31843616a04f810f012.zip kdepimpi-9b2bf31715226dfa8210f31843616a04f810f012.tar.gz kdepimpi-9b2bf31715226dfa8210f31843616a04f810f012.tar.bz2 |
strat stop tod fixes
-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 | |||
@@ -1454,11 +1454,14 @@ | |||
1454 | { "Backup globally disabled","Backup global abgeschaltet" }, | 1454 | { "Backup globally disabled","Backup global abgeschaltet" }, |
1455 | { "Backup succesfully finished","Backup erfolgreich beendet" }, | 1455 | { "Backup succesfully finished","Backup erfolgreich beendet" }, |
1456 | { "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, | 1456 | { "(Hint: You can enable automatic backup in the global settings!)","(Hinweis: Sie können ein automatisches Backup in den globalen Einstellungen konfigurieren!)" }, |
1457 | { "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, | 1457 | { "This will <b>backup all calendar files</b> to the directory %1 %2","Das schreibt ein <b>Backup aller Kalenderdateien</b> in das Verzeichnis %1 %2" }, |
1458 | { "Birthdays","Geburtstage" }, | 1458 | { "Birthdays","Geburtstage" }, |
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 | { "","" }, |
1461 | { "","" }, | 1464 | { "","" }, |
1462 | { "","" }, | 1465 | { "","" }, |
1463 | { "","" }, | 1466 | { "","" }, |
1464 | { "","" }, \ No newline at end of file | 1467 | { "","" }, \ No newline at end of file |
diff --git a/korganizer/kotodoview.cpp b/korganizer/kotodoview.cpp index 7349d20..1bfdef9 100644 --- a/korganizer/kotodoview.cpp +++ b/korganizer/kotodoview.cpp | |||
@@ -60,12 +60,42 @@ | |||
60 | #include "docprefs.h" | 60 | #include "docprefs.h" |
61 | 61 | ||
62 | #include "kotodoview.h" | 62 | #include "kotodoview.h" |
63 | using namespace KOrg; | 63 | using namespace KOrg; |
64 | 64 | ||
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 ) : |
67 | QDialog( parent, name, true ) | 97 | QDialog( parent, name, true ) |
68 | { | 98 | { |
69 | mTodo = todo; | 99 | mTodo = todo; |
70 | setCaption( i18n("Stop todo") ); | 100 | setCaption( i18n("Stop todo") ); |
71 | QVBoxLayout* lay = new QVBoxLayout( this ); | 101 | QVBoxLayout* lay = new QVBoxLayout( this ); |
@@ -1196,15 +1226,15 @@ void KOTodoView::itemDoubleClicked(QListViewItem *item) | |||
1196 | return; | 1226 | return; |
1197 | } | 1227 | } |
1198 | else | 1228 | else |
1199 | toggleRunningItem(); | 1229 | toggleRunningItem(); |
1200 | return; | 1230 | return; |
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; |
1206 | } | 1236 | } |
1207 | } | 1237 | } |
1208 | } | 1238 | } |
1209 | if ( KOPrefs::instance()->mEditOnDoubleClick ) | 1239 | if ( KOPrefs::instance()->mEditOnDoubleClick ) |
1210 | editItem( item ); | 1240 | editItem( item ); |
@@ -1216,27 +1246,39 @@ void KOTodoView::toggleRunningItem() | |||
1216 | // qDebug("KOTodoView::toggleRunning() "); | 1246 | // qDebug("KOTodoView::toggleRunning() "); |
1217 | if ( ! mActiveItem ) | 1247 | if ( ! mActiveItem ) |
1218 | return; | 1248 | return; |
1219 | Todo * t = mActiveItem->todo(); | 1249 | Todo * t = mActiveItem->todo(); |
1220 | if ( t->isRunning() ) { | 1250 | if ( t->isRunning() ) { |
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(); |
1224 | int hei = tp.height(); | 1254 | int hei = tp.height(); |
1225 | int xx = (QApplication::desktop()->width()-wid)/2; | 1255 | int xx = (QApplication::desktop()->width()-wid)/2; |
1226 | int yy = (QApplication::desktop()->height()-hei)/2; | 1256 | int yy = (QApplication::desktop()->height()-hei)/2; |
1227 | tp.setGeometry( xx,yy,wid,hei ); | 1257 | tp.setGeometry( xx,yy,wid,hei ); |
1228 | } | 1258 | } |
1229 | tp.exec(); | 1259 | tp.exec(); |
1230 | mActiveItem->construct(); | 1260 | mActiveItem->construct(); |
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 | } |
1238 | } | 1280 | } |
1239 | 1281 | ||
1240 | void KOTodoView::itemClicked(QListViewItem *item) | 1282 | void KOTodoView::itemClicked(QListViewItem *item) |
1241 | { | 1283 | { |
1242 | //qDebug("KOTodoView::itemClicked %d", item); | 1284 | //qDebug("KOTodoView::itemClicked %d", item); |
diff --git a/korganizer/kotodoview.h b/korganizer/kotodoview.h index 8f0c99e..1b31d0d 100644 --- a/korganizer/kotodoview.h +++ b/korganizer/kotodoview.h | |||
@@ -73,12 +73,26 @@ private: | |||
73 | QLineEdit* mComment; | 73 | QLineEdit* mComment; |
74 | KDateEdit *sde, *ede; | 74 | KDateEdit *sde, *ede; |
75 | KOTimeEdit *ste, *ete; | 75 | KOTimeEdit *ste, *ete; |
76 | 76 | ||
77 | }; | 77 | }; |
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 |
80 | { | 94 | { |
81 | Q_OBJECT | 95 | Q_OBJECT |
82 | public: | 96 | public: |
83 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); | 97 | KOTodoListView(Calendar *,QWidget *parent=0,const char *name=0); |
84 | virtual ~KOTodoListView() {} | 98 | virtual ~KOTodoListView() {} |
diff --git a/libkcal/calendar.h b/libkcal/calendar.h index 3b7b183..2efa355 100644 --- a/libkcal/calendar.h +++ b/libkcal/calendar.h | |||
@@ -74,12 +74,13 @@ public: | |||
74 | Clears out the current calendar, freeing all used memory etc. | 74 | Clears out the current calendar, freeing all used memory etc. |
75 | */ | 75 | */ |
76 | virtual void close() = 0; | 76 | virtual void close() = 0; |
77 | virtual void addCalendar( Calendar* ) = 0; | 77 | virtual void addCalendar( Calendar* ) = 0; |
78 | virtual bool addCalendarFile( QString name, int id ) = 0; | 78 | virtual bool addCalendarFile( QString name, int id ) = 0; |
79 | virtual void setSyncEventsReadOnly() = 0; | 79 | virtual void setSyncEventsReadOnly() = 0; |
80 | virtual void stopAllTodos() = 0; | ||
80 | 81 | ||
81 | /** | 82 | /** |
82 | Sync changes in memory to persistant storage. | 83 | Sync changes in memory to persistant storage. |
83 | */ | 84 | */ |
84 | virtual void save() = 0; | 85 | virtual void save() = 0; |
85 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; | 86 | virtual QPtrList<Event> getExternLastSyncEvents() = 0; |
diff --git a/libkcal/calendarlocal.cpp b/libkcal/calendarlocal.cpp index 8c4dde1..18f1af8 100644 --- a/libkcal/calendarlocal.cpp +++ b/libkcal/calendarlocal.cpp | |||
@@ -144,12 +144,18 @@ bool CalendarLocal::load( const QString &fileName ) | |||
144 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) | 144 | bool CalendarLocal::save( const QString &fileName, CalFormat *format ) |
145 | { | 145 | { |
146 | FileStorage storage( this, fileName, format ); | 146 | FileStorage storage( this, fileName, format ); |
147 | return storage.save(); | 147 | return storage.save(); |
148 | } | 148 | } |
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() |
151 | { | 157 | { |
152 | 158 | ||
153 | Todo * i; | 159 | Todo * i; |
154 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); | 160 | for( i = mTodoList.first(); i; i = mTodoList.next() ) i->setRunning(false); |
155 | 161 | ||
diff --git a/libkcal/calendarlocal.h b/libkcal/calendarlocal.h index 0286b48..d32597f 100644 --- a/libkcal/calendarlocal.h +++ b/libkcal/calendarlocal.h | |||
@@ -43,12 +43,13 @@ class CalendarLocal : public Calendar | |||
43 | */ | 43 | */ |
44 | CalendarLocal( const QString &timeZoneId ); | 44 | CalendarLocal( const QString &timeZoneId ); |
45 | ~CalendarLocal(); | 45 | ~CalendarLocal(); |
46 | void addCalendar( Calendar* ); | 46 | void addCalendar( Calendar* ); |
47 | bool addCalendarFile( QString name, int id ); | 47 | bool addCalendarFile( QString name, int id ); |
48 | void setSyncEventsReadOnly(); | 48 | void setSyncEventsReadOnly(); |
49 | void stopAllTodos(); | ||
49 | /** | 50 | /** |
50 | Loads a calendar on disk in vCalendar or iCalendar format into the current | 51 | Loads a calendar on disk in vCalendar or iCalendar format into the current |
51 | calendar. Any information already present is lost. | 52 | calendar. Any information already present is lost. |
52 | @return true, if successfull, false on error. | 53 | @return true, if successfull, false on error. |
53 | @param fileName the name of the calendar on disk. | 54 | @param fileName the name of the calendar on disk. |
54 | */ | 55 | */ |
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp index 9a8b6e4..5260051 100644 --- a/libkcal/todo.cpp +++ b/libkcal/todo.cpp | |||
@@ -108,14 +108,14 @@ void Todo::saveRunningInfoToFile() | |||
108 | mRunEnd = QDateTime::currentDateTime(); | 108 | mRunEnd = QDateTime::currentDateTime(); |
109 | saveRunningInfoToFile( QString::null ); | 109 | saveRunningInfoToFile( QString::null ); |
110 | } | 110 | } |
111 | void Todo::saveRunningInfoToFile( QString comment ) | 111 | void Todo::saveRunningInfoToFile( QString comment ) |
112 | { | 112 | { |
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; |
117 | } | 117 | } |
118 | QString dir = KGlobalSettings::timeTrackerDir(); | 118 | QString dir = KGlobalSettings::timeTrackerDir(); |
119 | //qDebug("%s ", dir.latin1()); | 119 | //qDebug("%s ", dir.latin1()); |
120 | QString file = "%1%2%3-%4%5%6-"; | 120 | QString file = "%1%2%3-%4%5%6-"; |
121 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); | 121 | file = file.arg( mRunStart.date().year(), 4).arg( mRunStart.date().month(),2 ).arg( mRunStart.date().day(), 2 ).arg( mRunStart.time().hour(),2 ).arg( mRunStart.time().minute(),2 ).arg( mRunStart.time().second(),2 ); |