summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-02-05 11:26:35 (UTC)
committer zautrix <zautrix>2005-02-05 11:26:35 (UTC)
commit86c0d35262454a31ed7d50d3e20cbdace954ebdf (patch) (unidiff)
tree7ded091fe9111fe20014f8edbc5f338293e36386
parent3a822a4c4867acb28dc1b3b9557918d0971f732c (diff)
downloadkdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.zip
kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.gz
kdepimpi-86c0d35262454a31ed7d50d3e20cbdace954ebdf.tar.bz2
another fixx
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--korganizer/kotodoviewitem.cpp18
-rw-r--r--korganizer/mainwindow.cpp9
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/todo.cpp32
-rw-r--r--libkcal/todo.h12
7 files changed, 64 insertions, 15 deletions
diff --git a/bin/kdepim/WhatsNew.txt b/bin/kdepim/WhatsNew.txt
index 14dcdac..9ba4f3e 100644
--- a/bin/kdepim/WhatsNew.txt
+++ b/bin/kdepim/WhatsNew.txt
@@ -1,44 +1,46 @@
1Info about the changes in new versions of KDE-Pim/Pi 1Info about the changes in new versions of KDE-Pim/Pi
2 2
3********** VERSION 2.0.3 ************ 3********** VERSION 2.0.3 ************
4 4
5KO/Pi: 5KO/Pi:
6Added feature for changing alarm settings for many items at once: 6Added feature for changing alarm settings for many items at once:
7Open list view (or search dialog), select the desired items and choose in 7Open list view (or search dialog), select the desired items and choose in
8the popup menu: Set alarm for selected... 8the popup menu: Set alarm for selected...
9 9
10Added to the event/todo viewer the option to send an email to 10Added to the event/todo viewer the option to send an email to
11all attendees or all selected (with RSVP) attendees. 11all attendees or all selected (with RSVP) attendees.
12 12
13Made the week-month mode changing in month view faster. 13Made the week-month mode changing in month view faster.
14 14
15Made month view better useable with keyboard. 15Made month view better useable with keyboard.
16Now TAB key jumps to next cell with an event/todo. 16Now TAB key jumps to next cell with an event/todo.
17Scroll in cell with coursor keys, scroll in time (next week) with 17Scroll in cell with coursor keys, scroll in time (next week) with
18Shift/Control + coursorkeys. 18Shift/Control + coursorkeys.
19 19
20Fixeg bug that the todo view flat mode was reset after first view update. 20Fixed bug that the todo view flat mode was reset after first view update.
21
22If a todo is displayed closed in the todo view, it is now displayed in overdue/due today color depending on the subtodos overdue/due today properties.
21 23
22********** VERSION 2.0.2 ************ 24********** VERSION 2.0.2 ************
23 25
24KO/Pi: 26KO/Pi:
25Fixed the layout problem of the day label buttons 27Fixed the layout problem of the day label buttons
26of the agenda view introduced in version 2.0.1. 28of the agenda view introduced in version 2.0.1.
27 29
28Added WhatsThis support for the todo view and the list view. 30Added WhatsThis support for the todo view and the list view.
29 31
30Added a quite useful feature to the montview. 32Added a quite useful feature to the montview.
31Just click on the week numbers on the left. 33Just click on the week numbers on the left.
32And in the top right corner of month view/agenda view 34And in the top right corner of month view/agenda view
33there is now a "week number quick selector". 35there is now a "week number quick selector".
34(Click on the black triangle). 36(Click on the black triangle).
35 37
36Made the quite difficult timezone change in KO/Pi easy. 38Made the quite difficult timezone change in KO/Pi easy.
37 39
38OM/Pi: 40OM/Pi:
39Fixed too small icons on desktop. 41Fixed too small icons on desktop.
40Fixed non visible icons in mainwindow on Z with fastload enabled. 42Fixed non visible icons in mainwindow on Z with fastload enabled.
41Added signature file setting to smtp account config. 43Added signature file setting to smtp account config.
42And the signature can be edited and saved in the edit mail dialog. 44And the signature can be edited and saved in the edit mail dialog.
43That does mean: 45That does mean:
44Simply edit the signature for the selected smtp account in the 46Simply edit the signature for the selected smtp account in the
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 31c5659..cb519b2 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1181,49 +1181,49 @@ void KOMonthView::updateView()
1181 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1181 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1182 bool invalid = false; 1182 bool invalid = false;
1183 while( true ) { 1183 while( true ) {
1184 if ( incidenceStart.isValid() ) { 1184 if ( incidenceStart.isValid() ) {
1185 incidenceEnd = incidenceStart.addDays( eventlen ); 1185 incidenceEnd = incidenceStart.addDays( eventlen );
1186 int st = incidenceStart.date().daysTo( endDate ); 1186 int st = incidenceStart.date().daysTo( endDate );
1187 if ( st >= 0 ) { // start before timeend 1187 if ( st >= 0 ) { // start before timeend
1188 int end = mStartDate.daysTo( incidenceEnd.date() ); 1188 int end = mStartDate.daysTo( incidenceEnd.date() );
1189 if ( end >= 0 ) { // end after timestart --- got one! 1189 if ( end >= 0 ) { // end after timestart --- got one!
1190 //normalize 1190 //normalize
1191 st = timeSpan - st; 1191 st = timeSpan - st;
1192 if ( st < 0 ) st = 0; 1192 if ( st < 0 ) st = 0;
1193 if ( end > timeSpan ) end = timeSpan; 1193 if ( end > timeSpan ) end = timeSpan;
1194 int iii; 1194 int iii;
1195 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1195 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1196 for ( iii = st;iii<= end;++iii) 1196 for ( iii = st;iii<= end;++iii)
1197 (*cells)[iii]->insertEvent( event ); 1197 (*cells)[iii]->insertEvent( event );
1198 } 1198 }
1199 } 1199 }
1200 } else { 1200 } else {
1201 if ( invalid ) 1201 if ( invalid )
1202 break; 1202 break;
1203 invalid = true; 1203 invalid = true;
1204 //qDebug("invalid %s", event->summary().latin1()); 1204 //qDebug("invalid %s", event->summary().latin1());
1205 incidenceStart = QDateTime( mStartDate ); 1205 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1206 } 1206 }
1207 if ( last ) 1207 if ( last )
1208 break; 1208 break;
1209 bool ok; 1209 bool ok;
1210 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1210 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1211 if ( ! ok ) 1211 if ( ! ok )
1212 break; 1212 break;
1213 if ( incidenceStart.date() > endDate ) 1213 if ( incidenceStart.date() > endDate )
1214 break; 1214 break;
1215 } 1215 }
1216 } else { // no recur 1216 } else { // no recur
1217 int st = event->dtStart().date().daysTo( endDate ); 1217 int st = event->dtStart().date().daysTo( endDate );
1218 if ( st >= 0 ) { // start before timeend 1218 if ( st >= 0 ) { // start before timeend
1219 int end = mStartDate.daysTo( event->dtEnd().date() ); 1219 int end = mStartDate.daysTo( event->dtEnd().date() );
1220 if ( end >= 0 ) { // end after timestart --- got one! 1220 if ( end >= 0 ) { // end after timestart --- got one!
1221 //normalize 1221 //normalize
1222 st = timeSpan - st; 1222 st = timeSpan - st;
1223 if ( st < 0 ) st = 0; 1223 if ( st < 0 ) st = 0;
1224 if ( end > timeSpan ) end = timeSpan; 1224 if ( end > timeSpan ) end = timeSpan;
1225 int iii; 1225 int iii;
1226 for ( iii = st;iii<= end;++iii) 1226 for ( iii = st;iii<= end;++iii)
1227 (*cells)[iii]->insertEvent( event ); 1227 (*cells)[iii]->insertEvent( event );
1228 } 1228 }
1229 } 1229 }
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6bdee18..78d4027 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -308,62 +308,58 @@ bool KOTodoViewItem::isAlternate()
308#endif 308#endif
309} 309}
310 310
311void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment) 311void KOTodoViewItem::paintCell(QPainter *p, const QColorGroup &cg, int column, int width, int alignment)
312{ 312{
313 QColorGroup _cg = cg; 313 QColorGroup _cg = cg;
314 QColorGroup::ColorRole role; 314 QColorGroup::ColorRole role;
315 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor ) 315 if ( KOPrefs::instance()->mTodoViewUsesForegroundColor )
316 role = QColorGroup::Text; 316 role = QColorGroup::Text;
317 else 317 else
318 role = QColorGroup::Base; 318 role = QColorGroup::Base;
319 //#ifndef KORG_NOLVALTERNATION 319 //#ifndef KORG_NOLVALTERNATION
320 // if (isAlternate()) 320 // if (isAlternate())
321 // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground()); 321 // _cg.setColor(QColorGroup::Base, static_cast< KOTodoListView* >(listView())->alternateBackground());
322 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors; 322 bool setColor = KOPrefs::instance()->mTodoViewUsesCatColors;
323 QColor colorToSet; 323 QColor colorToSet;
324 if ( setColor ) { 324 if ( setColor ) {
325 QStringList categories = mTodo->categories(); 325 QStringList categories = mTodo->categories();
326 QString cat = categories.first(); 326 QString cat = categories.first();
327 if ( !cat.isEmpty()) { 327 if ( !cat.isEmpty()) {
328 colorToSet = *(KOPrefs::instance()->categoryColor(cat) ); 328 colorToSet = *(KOPrefs::instance()->categoryColor(cat) );
329 } else 329 } else
330 setColor = false; 330 setColor = false;
331 } 331 }
332 if (mTodo->hasDueDate()) { 332
333 if (mTodo->dtDue().date()==QDate::currentDate() && 333 int odue = mTodo->hasDueSubTodo( !isOpen());
334 !mTodo->isCompleted()) { 334 if (odue == 2) {
335 //_cg.setColor( role , KOPrefs::instance()->mTodoDueTodayColor);
336 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
337 setColor = true;
338 }
339 if (mTodo->dtDue().date() < QDate::currentDate() &&
340 !mTodo->isCompleted()) {
341 //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor);
342 colorToSet = KOPrefs::instance()->mTodoOverdueColor; 335 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
343 setColor = true; 336 setColor = true;
337 } else if ( odue == 1 ) {
338 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
339 setColor = true;
344 } 340 }
345 } 341
346 342
347 if ( setColor ) { 343 if ( setColor ) {
348 _cg.setColor(role,colorToSet ); 344 _cg.setColor(role,colorToSet );
349 if ( role == QColorGroup::Base) { 345 if ( role == QColorGroup::Base) {
350 int rgb = colorToSet.red(); 346 int rgb = colorToSet.red();
351 rgb += colorToSet.blue()/2; 347 rgb += colorToSet.blue()/2;
352 rgb += colorToSet.green(); 348 rgb += colorToSet.green();
353 if ( rgb < 200 ) 349 if ( rgb < 200 )
354 _cg.setColor(QColorGroup::Text,Qt::white ); 350 _cg.setColor(QColorGroup::Text,Qt::white );
355 } 351 }
356 } 352 }
357 //#endif 353 //#endif
358 if ( column > 0 ){ 354 if ( column > 0 ){
359 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) { 355 if ( column == 2 && !KOPrefs::instance()->mTodoViewShowsPercentage ) {
360 p->save(); 356 p->save();
361 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5); 357 int progress = (int)(( (width-6)*mTodo->percentComplete())/100.0 + 0.5);
362 358
363 p->fillRect( 0, 0, width, height(), _cg.base() ); // background 359 p->fillRect( 0, 0, width, height(), _cg.base() ); // background
364 // p->setPen(Qt::black ); //border 360 // p->setPen(Qt::black ); //border
365 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling 361 // p->setBrush( KOPrefs::instance()->mHighlightColorKGlobalSettings::baseColor() ); //filling
366 QColor fc = KOPrefs::instance()->mHighlightColor; 362 QColor fc = KOPrefs::instance()->mHighlightColor;
367 if ( mTodo->percentComplete() == 100 ) 363 if ( mTodo->percentComplete() == 100 )
368 fc = darkGreen; 364 fc = darkGreen;
369 p->drawRect( 2, 2, width-4, height()-4); 365 p->drawRect( 2, 2, width-4, height()-4);
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index a2c20a8..5bc8c00 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1325,48 +1325,57 @@ void MainWindow::processIncidenceSelection( Incidence *incidence )
1325 mNewSubTodoAction->setEnabled( false ); 1325 mNewSubTodoAction->setEnabled( false );
1326 setCaptionToDates(); 1326 setCaptionToDates();
1327 return; 1327 return;
1328 1328
1329 } 1329 }
1330 1330
1331 //KGlobal::locale()->formatDateTime(nextA, true); 1331 //KGlobal::locale()->formatDateTime(nextA, true);
1332 QString startString = ""; 1332 QString startString = "";
1333 if ( incidence->type() != "Todo" ) { 1333 if ( incidence->type() != "Todo" ) {
1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) { 1334 if ( incidence->dtStart().date() < incidence->dtEnd().date() ) {
1335 if ( incidence->doesFloat() ) { 1335 if ( incidence->doesFloat() ) {
1336 startString += ": "+incidence->dtStartDateStr( true ); 1336 startString += ": "+incidence->dtStartDateStr( true );
1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true ); 1337 startString += " --- "+((Event*)incidence)->dtEndDateStr( true );
1338 1338
1339 } else { 1339 } else {
1340 startString = ": "+incidence->dtStartStr(true); 1340 startString = ": "+incidence->dtStartStr(true);
1341 startString += " --- "+((Event*)incidence)->dtEndStr(true); 1341 startString += " --- "+((Event*)incidence)->dtEndStr(true);
1342 1342
1343 } 1343 }
1344 1344
1345 } else { 1345 } else {
1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() ) 1346 if ( incidence->dtStart().time() != incidence->dtEnd().time() )
1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+ 1347 startString = ": "+KGlobal::locale()->formatTime(incidence->dtStart().time())+
1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time()); 1348 "-"+KGlobal::locale()->formatTime(incidence->dtEnd().time());
1349 if ( incidence->categories().contains( i18n("Birthday") ) || incidence->categories().contains( i18n("Anniversary") ) ) {
1350 bool ok;
1351 QDateTime noc = incidence->getNextOccurence( mView->startDate().addDays(-1), &ok );
1352 if ( ok ) {
1353 int years = noc.date().year() - incidence->dtStart().date().year();
1354 startString += i18n(" (%1 y.)"). arg( years );
1355 }
1356 }
1357 else
1349 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 1358 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true);
1350 } 1359 }
1351 1360
1352 } 1361 }
1353 else 1362 else
1354 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed"); 1363 startString = i18n(": (Prio ") +QString::number( (( KCal::Todo*)incidence)->priority() ) +") "+QString::number( (( KCal::Todo*)incidence)->percentComplete() ) +i18n("\% completed");
1355 if ( !incidence->location().isEmpty() ) 1364 if ( !incidence->location().isEmpty() )
1356 startString += " (" +incidence->location()+")"; 1365 startString += " (" +incidence->location()+")";
1357 setCaption( incidence->summary()+startString); 1366 setCaption( incidence->summary()+startString);
1358 1367
1359 enableIncidenceActions( true ); 1368 enableIncidenceActions( true );
1360 1369
1361 if ( incidence->type() == "Event" ) { 1370 if ( incidence->type() == "Event" ) {
1362 mShowAction->setText( i18n("Show Event...") ); 1371 mShowAction->setText( i18n("Show Event...") );
1363 mEditAction->setText( i18n("Edit Event...") ); 1372 mEditAction->setText( i18n("Edit Event...") );
1364 mDeleteAction->setText( i18n("Delete Event...") ); 1373 mDeleteAction->setText( i18n("Delete Event...") );
1365 1374
1366 mNewSubTodoAction->setEnabled( false ); 1375 mNewSubTodoAction->setEnabled( false );
1367 } else if ( incidence->type() == "Todo" ) { 1376 } else if ( incidence->type() == "Todo" ) {
1368 mShowAction->setText( i18n("Show Todo...") ); 1377 mShowAction->setText( i18n("Show Todo...") );
1369 mEditAction->setText( i18n("Edit Todo...") ); 1378 mEditAction->setText( i18n("Edit Todo...") );
1370 mDeleteAction->setText( i18n("Delete Todo...") ); 1379 mDeleteAction->setText( i18n("Delete Todo...") );
1371 1380
1372 mNewSubTodoAction->setEnabled( true ); 1381 mNewSubTodoAction->setEnabled( true );
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 1807bc4..de2a381 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -245,55 +245,55 @@ class Incidence : public IncidenceBase
245 Return the recurrence rule associated with this incidence. If there is 245 Return the recurrence rule associated with this incidence. If there is
246 none, returns an appropriate (non-0) object. 246 none, returns an appropriate (non-0) object.
247 */ 247 */
248 Recurrence *recurrence() const; 248 Recurrence *recurrence() const;
249 void setRecurrence(Recurrence * r); 249 void setRecurrence(Recurrence * r);
250 /** 250 /**
251 Forward to Recurrence::doesRecur(). 251 Forward to Recurrence::doesRecur().
252 */ 252 */
253 ushort doesRecur() const; 253 ushort doesRecur() const;
254 254
255 /** set the event's/todo's location. Do _not_ use it with journal */ 255 /** set the event's/todo's location. Do _not_ use it with journal */
256 void setLocation(const QString &location); 256 void setLocation(const QString &location);
257 /** return the event's/todo's location. Do _not_ use it with journal */ 257 /** return the event's/todo's location. Do _not_ use it with journal */
258 QString location() const; 258 QString location() const;
259 /** returns TRUE or FALSE depending on whether the todo has a start date */ 259 /** returns TRUE or FALSE depending on whether the todo has a start date */
260 bool hasStartDate() const; 260 bool hasStartDate() const;
261 /** sets the event's hasStartDate value. */ 261 /** sets the event's hasStartDate value. */
262 void setHasStartDate(bool f); 262 void setHasStartDate(bool f);
263 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const; 263 QDateTime getNextOccurence( const QDateTime& dt, bool* yes ) const;
264 bool cancelled() const; 264 bool cancelled() const;
265 void setCancelled( bool b ); 265 void setCancelled( bool b );
266 266
267protected: 267protected:
268 QPtrList<Alarm> mAlarms; 268 QPtrList<Alarm> mAlarms;
269 QPtrList<Incidence> mRelations;
269 private: 270 private:
270 int mRevision; 271 int mRevision;
271 bool mCancelled; 272 bool mCancelled;
272 273
273 // base components of jounal, event and todo 274 // base components of jounal, event and todo
274 QDateTime mCreated; 275 QDateTime mCreated;
275 QString mDescription; 276 QString mDescription;
276 QString mSummary; 277 QString mSummary;
277 QStringList mCategories; 278 QStringList mCategories;
278 Incidence *mRelatedTo; 279 Incidence *mRelatedTo;
279 QString mRelatedToUid; 280 QString mRelatedToUid;
280 QPtrList<Incidence> mRelations;
281 DateList mExDates; 281 DateList mExDates;
282 QPtrList<Attachment> mAttachments; 282 QPtrList<Attachment> mAttachments;
283 QStringList mResources; 283 QStringList mResources;
284 bool mHasStartDate; // if todo has associated start date 284 bool mHasStartDate; // if todo has associated start date
285 285
286 int mSecrecy; 286 int mSecrecy;
287 int mPriority; // 1 = highest, 2 = less, etc. 287 int mPriority; // 1 = highest, 2 = less, etc.
288 288
289 //QPtrList<Alarm> mAlarms; 289 //QPtrList<Alarm> mAlarms;
290 Recurrence *mRecurrence; 290 Recurrence *mRecurrence;
291 291
292 QString mLocation; 292 QString mLocation;
293}; 293};
294 294
295bool operator==( const Incidence&, const Incidence& ); 295bool operator==( const Incidence&, const Incidence& );
296 296
297} 297}
298 298
299#endif 299#endif
diff --git a/libkcal/todo.cpp b/libkcal/todo.cpp
index 7f1de78..d81a68f 100644
--- a/libkcal/todo.cpp
+++ b/libkcal/todo.cpp
@@ -172,49 +172,79 @@ void Todo::setDtDue(const QDateTime &dtDue)
172 alarm->setAlarmStart(mDtDue);*/ 172 alarm->setAlarmStart(mDtDue);*/
173 173
174 updated(); 174 updated();
175} 175}
176 176
177QDateTime Todo::dtDue() const 177QDateTime Todo::dtDue() const
178{ 178{
179 return mDtDue; 179 return mDtDue;
180} 180}
181 181
182QString Todo::dtDueTimeStr() const 182QString Todo::dtDueTimeStr() const
183{ 183{
184 return KGlobal::locale()->formatTime(mDtDue.time()); 184 return KGlobal::locale()->formatTime(mDtDue.time());
185} 185}
186 186
187QString Todo::dtDueDateStr(bool shortfmt) const 187QString Todo::dtDueDateStr(bool shortfmt) const
188{ 188{
189 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt); 189 return KGlobal::locale()->formatDate(mDtDue.date(),shortfmt);
190} 190}
191 191
192QString Todo::dtDueStr(bool shortfmt) const 192QString Todo::dtDueStr(bool shortfmt) const
193{ 193{
194 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt); 194 return KGlobal::locale()->formatDateTime(mDtDue, shortfmt);
195} 195}
196 196// retval 0 : no found
197// 1 : due for date found
198// 2 : overdue for date found
199int Todo::hasDueSubTodoForDate( const QDate & date, bool checkSubtodos )
200{
201 int retval = 0;
202 if ( isCompleted() )
203 return 0;
204 if ( hasDueDate() ) {
205 if ( dtDue().date() < date )
206 return 2;
207 // we do not return, because we may find an overdue sub todo
208 if ( dtDue().date() == date )
209 retval = 1;
210 }
211 if ( checkSubtodos ) {
212 Incidence *aTodo;
213 for (aTodo = mRelations.first(); aTodo; aTodo = mRelations.next()) {
214 int ret = ((Todo*)aTodo)->hasDueSubTodoForDate( date ,checkSubtodos );
215 if ( ret == 2 )
216 return 2;
217 if ( ret == 1)
218 retval = 1;
219 }
220 }
221 return retval;
222}
223int Todo::hasDueSubTodo( bool checkSubtodos ) //= true
224{
225 return hasDueSubTodoForDate(QDate::currentDate(), checkSubtodos );
226}
197bool Todo::hasDueDate() const 227bool Todo::hasDueDate() const
198{ 228{
199 return mHasDueDate; 229 return mHasDueDate;
200} 230}
201 231
202void Todo::setHasDueDate(bool f) 232void Todo::setHasDueDate(bool f)
203{ 233{
204 if (mReadOnly) return; 234 if (mReadOnly) return;
205 mHasDueDate = f; 235 mHasDueDate = f;
206 updated(); 236 updated();
207} 237}
208 238
209 239
210#if 0 240#if 0
211void Todo::setStatus(const QString &statStr) 241void Todo::setStatus(const QString &statStr)
212{ 242{
213 if (mReadOnly) return; 243 if (mReadOnly) return;
214 QString ss(statStr.upper()); 244 QString ss(statStr.upper());
215 245
216 if (ss == "X-ACTION") 246 if (ss == "X-ACTION")
217 mStatus = NEEDS_ACTION; 247 mStatus = NEEDS_ACTION;
218 else if (ss == "NEEDS ACTION") 248 else if (ss == "NEEDS ACTION")
219 mStatus = NEEDS_ACTION; 249 mStatus = NEEDS_ACTION;
220 else if (ss == "ACCEPTED") 250 else if (ss == "ACCEPTED")
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 41f5841..137b252 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -41,48 +41,60 @@ class Todo : public Incidence
41 41
42 /** Return an exact copy of this todo. */ 42 /** Return an exact copy of this todo. */
43 Incidence *clone(); 43 Incidence *clone();
44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const; 44 QDateTime getNextAlarmDateTime( bool * ok, int * offset ) const;
45 45
46 /** for setting the todo's due date/time with a QDateTime. */ 46 /** for setting the todo's due date/time with a QDateTime. */
47 void setDtDue(const QDateTime &dtDue); 47 void setDtDue(const QDateTime &dtDue);
48 /** returns an event's Due date/time as a QDateTime. */ 48 /** returns an event's Due date/time as a QDateTime. */
49 QDateTime dtDue() const; 49 QDateTime dtDue() const;
50 /** returns an event's due time as a string formatted according to the 50 /** returns an event's due time as a string formatted according to the
51 users locale settings */ 51 users locale settings */
52 QString dtDueTimeStr() const; 52 QString dtDueTimeStr() const;
53 /** returns an event's due date as a string formatted according to the 53 /** returns an event's due date as a string formatted according to the
54 users locale settings */ 54 users locale settings */
55 QString dtDueDateStr(bool shortfmt=true) const; 55 QString dtDueDateStr(bool shortfmt=true) const;
56 /** returns an event's due date and time as a string formatted according 56 /** returns an event's due date and time as a string formatted according
57 to the users locale settings */ 57 to the users locale settings */
58 QString dtDueStr(bool shortfmt=true) const; 58 QString dtDueStr(bool shortfmt=true) const;
59 59
60 /** returns TRUE or FALSE depending on whether the todo has a due date */ 60 /** returns TRUE or FALSE depending on whether the todo has a due date */
61 bool hasDueDate() const; 61 bool hasDueDate() const;
62 /** sets the event's hasDueDate value. */ 62 /** sets the event's hasDueDate value. */
63 void setHasDueDate(bool f); 63 void setHasDueDate(bool f);
64 64
65 /*
66 Looks for a subtodo (including itself ) which is not complete and is
67 - overdue, or
68 - due today.
69 It returns 0 for nothing found,
70 1 for found a todo which is due today and no overdue found
71 2 for found a overdue todo
72 */
73 int hasDueSubTodo( bool checkSubtodos = true );
74 /* same as above, but a specific date can be specified*/
75 int hasDueSubTodoForDate( const QDate & date, bool checkSubtodos );
76
65 77
66 /** sets the event's status to the string specified. The string 78 /** sets the event's status to the string specified. The string
67 * must be a recognized value for the status field, i.e. a string 79 * must be a recognized value for the status field, i.e. a string
68 * equivalent of the possible status enumerations previously described. */ 80 * equivalent of the possible status enumerations previously described. */
69// void setStatus(const QString &statStr); 81// void setStatus(const QString &statStr);
70 /** sets the event's status to the value specified. See the enumeration 82 /** sets the event's status to the value specified. See the enumeration
71 * above for possible values. */ 83 * above for possible values. */
72// void setStatus(int); 84// void setStatus(int);
73 /** return the event's status. */ 85 /** return the event's status. */
74// int status() const; 86// int status() const;
75 /** return the event's status in string format. */ 87 /** return the event's status in string format. */
76// QString statusStr() const; 88// QString statusStr() const;
77 89
78 /** return, if this todo is completed */ 90 /** return, if this todo is completed */
79 bool isCompleted() const; 91 bool isCompleted() const;
80 /** set completed state of this todo */ 92 /** set completed state of this todo */
81 void setCompleted(bool); 93 void setCompleted(bool);
82 94
83 /** 95 /**
84 Return how many percent of the task are completed. Returns a value 96 Return how many percent of the task are completed. Returns a value
85 between 0 and 100. 97 between 0 and 100.
86 */ 98 */
87 int percentComplete() const; 99 int percentComplete() const;
88 /** 100 /**