summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--bin/kdepim/WhatsNew.txt4
-rw-r--r--korganizer/komonthview.cpp2
-rw-r--r--korganizer/kotodoviewitem.cpp26
-rw-r--r--korganizer/mainwindow.cpp11
-rw-r--r--libkcal/incidence.h2
-rw-r--r--libkcal/todo.cpp32
-rw-r--r--libkcal/todo.h12
7 files changed, 69 insertions, 20 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,84 +1,86 @@
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
45edit new mail dialog and press the "save signature" button there. 47edit new mail dialog and press the "save signature" button there.
46Then the signature is saved to the file specified in the smtp account settings. 48Then the signature is saved to the file specified in the smtp account settings.
47If there is no file specified, it is saved automatically to the file 49If there is no file specified, it is saved automatically to the file
48kdepim/apps/kopiemail/<accountname>.sig. 50kdepim/apps/kopiemail/<accountname>.sig.
49 51
50 52
51 53
52********** VERSION 2.0.1 ************ 54********** VERSION 2.0.1 ************
53 55
54Oooops ... I forgot to test on the Zaurus 5500 ... 56Oooops ... I forgot to test on the Zaurus 5500 ...
55 57
56Fixed many problems of new (english) strings (and german translations) 58Fixed many problems of new (english) strings (and german translations)
57introduced in the latest versions, where the text was not fitting on the 59introduced in the latest versions, where the text was not fitting on the
58240x320 display of the Zaurus 5500. 60240x320 display of the Zaurus 5500.
59 61
60KO/Pi: 62KO/Pi:
61Added a popup menu ( press pen and hold to get popup ) to the agenda view 63Added a popup menu ( press pen and hold to get popup ) to the agenda view
62with many useful items (add event/todo, show next week, two weeks, month, journal). 64with many useful items (add event/todo, show next week, two weeks, month, journal).
63 65
64Added items to the todolist popup menu for: 66Added items to the todolist popup menu for:
65Display all opened, all closed or all todos flat. 67Display all opened, all closed or all todos flat.
66The "flat" view makes is possible to sort all todos after ,e.g., prio or date. 68The "flat" view makes is possible to sort all todos after ,e.g., prio or date.
67Made the reparenting of todos on the desktop possible via Drag&Drop. 69Made the reparenting of todos on the desktop possible via Drag&Drop.
68Fixed several bugs in setting the completed datetime for todos. 70Fixed several bugs in setting the completed datetime for todos.
69Added info about completed datetime of todos to the todo viewer. 71Added info about completed datetime of todos to the todo viewer.
70Now displaying a completed todo (with completed datetime set) in the agenda view 72Now displaying a completed todo (with completed datetime set) in the agenda view
71at the time of the completion. Such that now it is possible to see in the agenda view 73at the time of the completion. Such that now it is possible to see in the agenda view
72when what todo was completed. 74when what todo was completed.
73Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos. 75Fixed behaviour of automatic setting completion of todos with sub-todos/parent todos.
74Now the behaviour is: 76Now the behaviour is:
75Setting a parent to complete sets all (sub)childs to complete. 77Setting a parent to complete sets all (sub)childs to complete.
76Setting a parent to uncomplete does not change the childs. 78Setting a parent to uncomplete does not change the childs.
77Setting a child to uncomplete sets all parent to uncomplete. 79Setting a child to uncomplete sets all parent to uncomplete.
78Setting a child to complete does not change the parents. 80Setting a child to complete does not change the parents.
79 81
80Smart updating and double buffering of the daymatrix. 82Smart updating and double buffering of the daymatrix.
81Showing holidays in the day matrix. 83Showing holidays in the day matrix.
82Many other small performance updates. 84Many other small performance updates.
83 85
84Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode. 86Made day labels in agenda clickable. By clicking a label, the day is displayed in single day mode.
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index 31c5659..cb519b2 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -1141,129 +1141,129 @@ void KOMonthView::showEvents(QPtrList<Event>)
1141 1141
1142void KOMonthView::changeEventDisplay(Event *, int) 1142void KOMonthView::changeEventDisplay(Event *, int)
1143{ 1143{
1144 // this should be re-written to be much more efficient, but this 1144 // this should be re-written to be much more efficient, but this
1145 // quick-and-dirty-hack gets the job done for right now. 1145 // quick-and-dirty-hack gets the job done for right now.
1146 updateView(); 1146 updateView();
1147} 1147}
1148 1148
1149void KOMonthView::updateView() 1149void KOMonthView::updateView()
1150{ 1150{
1151 1151
1152 if ( !updatePossible ) 1152 if ( !updatePossible )
1153 return; 1153 return;
1154 //QTime ti; 1154 //QTime ti;
1155 //ti.start(); 1155 //ti.start();
1156 QPtrVector<MonthViewCell> *cells; 1156 QPtrVector<MonthViewCell> *cells;
1157 if ( mShowWeekView ) { 1157 if ( mShowWeekView ) {
1158 cells = &mCellsW; 1158 cells = &mCellsW;
1159 } else { 1159 } else {
1160 cells = &mCells; 1160 cells = &mCells;
1161 } 1161 }
1162#if 1 1162#if 1
1163 int i; 1163 int i;
1164 int timeSpan = (*cells).size()-1; 1164 int timeSpan = (*cells).size()-1;
1165 if ( KOPrefs::instance()->mMonthViewWeek ) 1165 if ( KOPrefs::instance()->mMonthViewWeek )
1166 timeSpan = 6; 1166 timeSpan = 6;
1167 for( i = 0; i < timeSpan + 1; ++i ) { 1167 for( i = 0; i < timeSpan + 1; ++i ) {
1168 (*cells)[i]->startUpdateCell(); 1168 (*cells)[i]->startUpdateCell();
1169 } 1169 }
1170 1170
1171 QPtrList<Event> events = calendar()->events(); 1171 QPtrList<Event> events = calendar()->events();
1172 Event *event; 1172 Event *event;
1173 QDateTime dt; 1173 QDateTime dt;
1174 bool ok; 1174 bool ok;
1175 QDate endDate = mStartDate.addDays( timeSpan ); 1175 QDate endDate = mStartDate.addDays( timeSpan );
1176 for( event = events.first(); event; event = events.next() ) { // for event 1176 for( event = events.first(); event; event = events.next() ) { // for event
1177 if ( event->doesRecur() ) { 1177 if ( event->doesRecur() ) {
1178 bool last; 1178 bool last;
1179 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1179 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1180 QDateTime incidenceEnd; 1180 QDateTime incidenceEnd;
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 }
1230 } 1230 }
1231 } 1231 }
1232 // insert due todos 1232 // insert due todos
1233 QPtrList<Todo> todos = calendar()->todos( ); 1233 QPtrList<Todo> todos = calendar()->todos( );
1234 Todo *todo; 1234 Todo *todo;
1235 for(todo = todos.first(); todo; todo = todos.next()) { 1235 for(todo = todos.first(); todo; todo = todos.next()) {
1236 //insertTodo( todo ); 1236 //insertTodo( todo );
1237 if ( todo->hasDueDate() ) { 1237 if ( todo->hasDueDate() ) {
1238 int day = mStartDate.daysTo( todo->dtDue().date() ); 1238 int day = mStartDate.daysTo( todo->dtDue().date() );
1239 if ( day >= 0 && day < timeSpan + 1) { 1239 if ( day >= 0 && day < timeSpan + 1) {
1240 (*cells)[day]->insertTodo( todo ); 1240 (*cells)[day]->insertTodo( todo );
1241 } 1241 }
1242 } 1242 }
1243 } 1243 }
1244 1244
1245 for( i = 0; i < timeSpan+1; ++i ) { 1245 for( i = 0; i < timeSpan+1; ++i ) {
1246 (*cells)[i]->finishUpdateCell(); 1246 (*cells)[i]->finishUpdateCell();
1247 } 1247 }
1248 processSelectionChange(); 1248 processSelectionChange();
1249 (*cells)[0]->setFocus(); 1249 (*cells)[0]->setFocus();
1250 1250
1251 1251
1252#else 1252#else
1253 // old code 1253 // old code
1254 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ "); 1254 //qDebug("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
1255 int i; 1255 int i;
1256 for( i = 0; i < (*cells).count(); ++i ) { 1256 for( i = 0; i < (*cells).count(); ++i ) {
1257 (*cells)[i]->updateCell(); 1257 (*cells)[i]->updateCell();
1258 } 1258 }
1259 1259
1260 //qDebug("KOMonthView::updateView() "); 1260 //qDebug("KOMonthView::updateView() ");
1261 processSelectionChange(); 1261 processSelectionChange();
1262 // qDebug("---------------------------------------------------------------------+ "); 1262 // qDebug("---------------------------------------------------------------------+ ");
1263 (*cells)[0]->setFocus(); 1263 (*cells)[0]->setFocus();
1264#endif 1264#endif
1265 1265
1266 //qDebug("update time %d ", ti.elapsed()); 1266 //qDebug("update time %d ", ti.elapsed());
1267} 1267}
1268 1268
1269void KOMonthView::resizeEvent(QResizeEvent * e) 1269void KOMonthView::resizeEvent(QResizeEvent * e)
diff --git a/korganizer/kotodoviewitem.cpp b/korganizer/kotodoviewitem.cpp
index 6bdee18..78d4027 100644
--- a/korganizer/kotodoviewitem.cpp
+++ b/korganizer/kotodoviewitem.cpp
@@ -267,143 +267,139 @@ void KOTodoViewItem::stateChange(bool state)
267bool KOTodoViewItem::isAlternate() 267bool KOTodoViewItem::isAlternate()
268{ 268{
269#ifndef KORG_NOLVALTERNATION 269#ifndef KORG_NOLVALTERNATION
270 KOTodoListView *lv = static_cast<KOTodoListView *>(listView()); 270 KOTodoListView *lv = static_cast<KOTodoListView *>(listView());
271 if (lv && lv->alternateBackground().isValid()) 271 if (lv && lv->alternateBackground().isValid())
272 { 272 {
273 KOTodoViewItem *above = 0; 273 KOTodoViewItem *above = 0;
274 above = dynamic_cast<KOTodoViewItem *>(itemAbove()); 274 above = dynamic_cast<KOTodoViewItem *>(itemAbove());
275 m_known = above ? above->m_known : true; 275 m_known = above ? above->m_known : true;
276 if (m_known) 276 if (m_known)
277 { 277 {
278 m_odd = above ? !above->m_odd : false; 278 m_odd = above ? !above->m_odd : false;
279 } 279 }
280 else 280 else
281 { 281 {
282 KOTodoViewItem *item; 282 KOTodoViewItem *item;
283 bool previous = true; 283 bool previous = true;
284 if (QListViewItem::parent()) 284 if (QListViewItem::parent())
285 { 285 {
286 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()); 286 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent());
287 if (item) 287 if (item)
288 previous = item->m_odd; 288 previous = item->m_odd;
289 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild()); 289 item = dynamic_cast<KOTodoViewItem *>(QListViewItem::parent()->firstChild());
290 } 290 }
291 else 291 else
292 { 292 {
293 item = dynamic_cast<KOTodoViewItem *>(lv->firstChild()); 293 item = dynamic_cast<KOTodoViewItem *>(lv->firstChild());
294 } 294 }
295 295
296 while(item) 296 while(item)
297 { 297 {
298 item->m_odd = previous = !previous; 298 item->m_odd = previous = !previous;
299 item->m_known = true; 299 item->m_known = true;
300 item = dynamic_cast<KOTodoViewItem *>(item->nextSibling()); 300 item = dynamic_cast<KOTodoViewItem *>(item->nextSibling());
301 } 301 }
302 } 302 }
303 return m_odd; 303 return m_odd;
304 } 304 }
305 return false; 305 return false;
306#else 306#else
307 return false; 307 return false;
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); 335 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
336 colorToSet = KOPrefs::instance()->mTodoDueTodayColor; 336 setColor = true;
337 setColor = true; 337 } else if ( odue == 1 ) {
338 } 338 colorToSet = KOPrefs::instance()->mTodoDueTodayColor;
339 if (mTodo->dtDue().date() < QDate::currentDate() && 339 setColor = true;
340 !mTodo->isCompleted()) { 340 }
341 //_cg.setColor( role, KOPrefs::instance()->mTodoOverdueColor); 341
342 colorToSet = KOPrefs::instance()->mTodoOverdueColor;
343 setColor = true;
344 }
345 }
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);
370 p->fillRect( 3, 3, progress, height()-6, 366 p->fillRect( 3, 3, progress, height()-6,
371 fc ); 367 fc );
372 p->restore(); 368 p->restore();
373 } else { 369 } else {
374 QCheckListItem::paintCell(p, _cg, column, width, alignment); 370 QCheckListItem::paintCell(p, _cg, column, width, alignment);
375 } 371 }
376 return; 372 return;
377 } 373 }
378 374
379 int align = alignment; 375 int align = alignment;
380 376
381 if ( !p ) 377 if ( !p )
382 return; 378 return;
383 379
384 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) ); 380 p->fillRect( 0, 0, width, height(), _cg.brush( QColorGroup::Base ) );
385 381
386 QListView *lv = listView(); 382 QListView *lv = listView();
387 if ( !lv ) 383 if ( !lv )
388 return; 384 return;
389 int marg = 2;//lv->itemMargin(); 385 int marg = 2;//lv->itemMargin();
390 int r = 0; 386 int r = 0;
391 QCheckListItem::Type myType = QCheckListItem::CheckBox; 387 QCheckListItem::Type myType = QCheckListItem::CheckBox;
392 int BoxSize = 20; 388 int BoxSize = 20;
393 int boxOffset = 2; 389 int boxOffset = 2;
394 int xOffset = 2; 390 int xOffset = 2;
395 if (qApp->desktop()->width() < 300 ) { 391 if (qApp->desktop()->width() < 300 ) {
396 BoxSize = 14; 392 BoxSize = 14;
397 boxOffset = -1; 393 boxOffset = -1;
398 xOffset = 1; 394 xOffset = 1;
399 // marg = 0; 395 // marg = 0;
400 } 396 }
401 if ( height() < BoxSize ) { 397 if ( height() < BoxSize ) {
402 boxOffset = boxOffset - ((BoxSize - height())/2) ; 398 boxOffset = boxOffset - ((BoxSize - height())/2) ;
403 // qDebug("boxOffset %d height %d", boxOffset, height() ); 399 // qDebug("boxOffset %d height %d", boxOffset, height() );
404 BoxSize = height(); 400 BoxSize = height();
405 401
406 } 402 }
407 //bool winStyle = lv->style() == WindowsStyle; 403 //bool winStyle = lv->style() == WindowsStyle;
408 404
409 int lineStart = 5; 405 int lineStart = 5;
diff --git a/korganizer/mainwindow.cpp b/korganizer/mainwindow.cpp
index a2c20a8..5bc8c00 100644
--- a/korganizer/mainwindow.cpp
+++ b/korganizer/mainwindow.cpp
@@ -1285,129 +1285,138 @@ void MainWindow::aboutAutoSaving()
1285 1285
1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text); 1286 KApplication::showText( i18n("Auto Saving in KOrganizer/Pi"), text);
1287 1287
1288} 1288}
1289void MainWindow::aboutKnownBugs() 1289void MainWindow::aboutKnownBugs()
1290{ 1290{
1291 QMessageBox* msg; 1291 QMessageBox* msg;
1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"), 1292 msg = new QMessageBox( i18n("Known Problems in KOrganizer/Pi"),
1293 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+ 1293 i18n("1) Importing *.vcs or *.ics files from\nother applications may not work properly,\nif there are events with properties\nKO/Pi does not support.\n")+
1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+ 1294 i18n("2) Audio alarm daemon\nfor Zaurus is available!\nas an additional small application\n")+
1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") + 1295 i18n("\nPlease report unexpected behaviour to\nlutz@pi-sync.net\n") +
1296 i18n("\nor report them in the bugtracker on\n") + 1296 i18n("\nor report them in the bugtracker on\n") +
1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"), 1297 i18n("\nhttp://sourceforge.net/projects/kdepimpi\n"),
1298 QMessageBox::NoIcon, 1298 QMessageBox::NoIcon,
1299 QMessageBox::Ok, 1299 QMessageBox::Ok,
1300 QMessageBox::NoButton, 1300 QMessageBox::NoButton,
1301 QMessageBox::NoButton); 1301 QMessageBox::NoButton);
1302 msg->exec(); 1302 msg->exec();
1303 delete msg; 1303 delete msg;
1304 1304
1305} 1305}
1306 1306
1307QString MainWindow::defaultFileName() 1307QString MainWindow::defaultFileName()
1308{ 1308{
1309 return locateLocal( "data", "korganizer/mycalendar.ics" ); 1309 return locateLocal( "data", "korganizer/mycalendar.ics" );
1310} 1310}
1311QString MainWindow::syncFileName() 1311QString MainWindow::syncFileName()
1312{ 1312{
1313#ifdef DESKTOP_VERSION 1313#ifdef DESKTOP_VERSION
1314 return locateLocal( "tmp", "synccalendar.ics" ); 1314 return locateLocal( "tmp", "synccalendar.ics" );
1315#else 1315#else
1316 return QString( "/tmp/synccalendar.ics" ); 1316 return QString( "/tmp/synccalendar.ics" );
1317#endif 1317#endif
1318} 1318}
1319 1319
1320void MainWindow::processIncidenceSelection( Incidence *incidence ) 1320void MainWindow::processIncidenceSelection( Incidence *incidence )
1321{ 1321{
1322 if ( !incidence ) { 1322 if ( !incidence ) {
1323 enableIncidenceActions( false ); 1323 enableIncidenceActions( false );
1324 1324
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 startString +=" "+KGlobal::locale()->formatDate( incidence->dtStart().date(), true); 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
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 );
1373 } else { 1382 } else {
1374 mShowAction->setText( i18n("Show...") ); 1383 mShowAction->setText( i18n("Show...") );
1375 mShowAction->setText( i18n("Edit...") ); 1384 mShowAction->setText( i18n("Edit...") );
1376 mShowAction->setText( i18n("Delete...") ); 1385 mShowAction->setText( i18n("Delete...") );
1377 1386
1378 mNewSubTodoAction->setEnabled( false ); 1387 mNewSubTodoAction->setEnabled( false );
1379 } 1388 }
1380} 1389}
1381 1390
1382void MainWindow::enableIncidenceActions( bool enabled ) 1391void MainWindow::enableIncidenceActions( bool enabled )
1383{ 1392{
1384 mShowAction->setEnabled( enabled ); 1393 mShowAction->setEnabled( enabled );
1385 mEditAction->setEnabled( enabled ); 1394 mEditAction->setEnabled( enabled );
1386 mDeleteAction->setEnabled( enabled ); 1395 mDeleteAction->setEnabled( enabled );
1387 1396
1388 mCloneAction->setEnabled( enabled ); 1397 mCloneAction->setEnabled( enabled );
1389 mMoveAction->setEnabled( enabled ); 1398 mMoveAction->setEnabled( enabled );
1390 mBeamAction->setEnabled( enabled ); 1399 mBeamAction->setEnabled( enabled );
1391 mCancelAction->setEnabled( enabled ); 1400 mCancelAction->setEnabled( enabled );
1392} 1401}
1393 1402
1394void MainWindow::importOL() 1403void MainWindow::importOL()
1395{ 1404{
1396#ifdef _OL_IMPORT_ 1405#ifdef _OL_IMPORT_
1397 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this ); 1406 KOImportOLdialog *id = new KOImportOLdialog("Import from OL - select folder!" , mView->calendar(),this );
1398 id->exec(); 1407 id->exec();
1399 delete id; 1408 delete id;
1400 mView->updateView(); 1409 mView->updateView();
1401#endif 1410#endif
1402} 1411}
1403void MainWindow::importBday() 1412void MainWindow::importBday()
1404{ 1413{
1405 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"), 1414 int result = QMessageBox::warning( this, i18n("KO/Pi: Warning!"),
1406 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"), 1415 i18n("When importing birthdays twice\nduplicated events will be ignored,\nif the event has not been\nchanged in KO/Pi!\n"),
1407 i18n("Import!"), i18n("Cancel"), 0, 1416 i18n("Import!"), i18n("Cancel"), 0,
1408 0, 1 ); 1417 0, 1 );
1409 if ( result == 0 ) { 1418 if ( result == 0 ) {
1410 mView->importBday(); 1419 mView->importBday();
1411 1420
1412 } 1421 }
1413 1422
diff --git a/libkcal/incidence.h b/libkcal/incidence.h
index 1807bc4..de2a381 100644
--- a/libkcal/incidence.h
+++ b/libkcal/incidence.h
@@ -205,95 +205,95 @@ class Incidence : public IncidenceBase
205 void setSecrecy(int); 205 void setSecrecy(int);
206 /** return the event's secrecy. */ 206 /** return the event's secrecy. */
207 int secrecy() const; 207 int secrecy() const;
208 /** return the event's secrecy in string format. */ 208 /** return the event's secrecy in string format. */
209 QString secrecyStr() const; 209 QString secrecyStr() const;
210 /** return list of all availbale secrecy classes */ 210 /** return list of all availbale secrecy classes */
211 static QStringList secrecyList(); 211 static QStringList secrecyList();
212 /** return human-readable name of secrecy class */ 212 /** return human-readable name of secrecy class */
213 static QString secrecyName(int); 213 static QString secrecyName(int);
214 214
215 /** returns TRUE if the date specified is one on which the event will 215 /** returns TRUE if the date specified is one on which the event will
216 * recur. */ 216 * recur. */
217 bool recursOn(const QDate &qd) const; 217 bool recursOn(const QDate &qd) const;
218 218
219 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?): 219 // VEVENT and VTODO, but not VJOURNAL (move to EventBase class?):
220 220
221 /** set resources used, such as Office, Car, etc. */ 221 /** set resources used, such as Office, Car, etc. */
222 void setResources(const QStringList &resources); 222 void setResources(const QStringList &resources);
223 /** return list of current resources */ 223 /** return list of current resources */
224 QStringList resources() const; 224 QStringList resources() const;
225 225
226 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */ 226 /** set the event's priority, 0 is undefined, 1 highest (decreasing order) */
227 void setPriority(int priority); 227 void setPriority(int priority);
228 /** get the event's priority */ 228 /** get the event's priority */
229 int priority() const; 229 int priority() const;
230 230
231 /** All alarms that are associated with this incidence */ 231 /** All alarms that are associated with this incidence */
232 QPtrList<Alarm> alarms() const; 232 QPtrList<Alarm> alarms() const;
233 /** Create a new alarm which is associated with this incidence */ 233 /** Create a new alarm which is associated with this incidence */
234 Alarm* newAlarm(); 234 Alarm* newAlarm();
235 /** Add an alarm which is associated with this incidence */ 235 /** Add an alarm which is associated with this incidence */
236 void addAlarm(Alarm*); 236 void addAlarm(Alarm*);
237 /** Remove an alarm that is associated with this incidence */ 237 /** Remove an alarm that is associated with this incidence */
238 void removeAlarm(Alarm*); 238 void removeAlarm(Alarm*);
239 /** Remove all alarms that are associated with this incidence */ 239 /** Remove all alarms that are associated with this incidence */
240 void clearAlarms(); 240 void clearAlarms();
241 /** return whether any alarm associated with this incidence is enabled */ 241 /** return whether any alarm associated with this incidence is enabled */
242 bool isAlarmEnabled() const; 242 bool isAlarmEnabled() const;
243 243
244 /** 244 /**
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
@@ -132,129 +132,159 @@ bool KCal::operator==( const Todo& t1, const Todo& t2 )
132 return false; 132 return false;
133 } else 133 } else
134 return false;// float != 134 return false;// float !=
135 } 135 }
136 136
137 } else 137 } else
138 return false; 138 return false;
139 if ( t1.percentComplete() != t2.percentComplete() ) 139 if ( t1.percentComplete() != t2.percentComplete() )
140 return false; 140 return false;
141 if ( t1.isCompleted() ) { 141 if ( t1.isCompleted() ) {
142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) { 142 if ( t1.hasCompletedDate() == t2.hasCompletedDate() ) {
143 if ( t1.hasCompletedDate() ) { 143 if ( t1.hasCompletedDate() ) {
144 if ( t1.completed() != t2.completed() ) 144 if ( t1.completed() != t2.completed() )
145 return false; 145 return false;
146 } 146 }
147 147
148 } else 148 } else
149 return false; 149 return false;
150 } 150 }
151 return true; 151 return true;
152 152
153} 153}
154 154
155void Todo::setDtDue(const QDateTime &dtDue) 155void Todo::setDtDue(const QDateTime &dtDue)
156{ 156{
157 //int diffsecs = mDtDue.secsTo(dtDue); 157 //int diffsecs = mDtDue.secsTo(dtDue);
158 158
159 /*if (mReadOnly) return; 159 /*if (mReadOnly) return;
160 const QPtrList<Alarm>& alarms = alarms(); 160 const QPtrList<Alarm>& alarms = alarms();
161 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) { 161 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) {
162 if (alarm->enabled()) { 162 if (alarm->enabled()) {
163 alarm->setTime(alarm->time().addSecs(diffsecs)); 163 alarm->setTime(alarm->time().addSecs(diffsecs));
164 } 164 }
165 }*/ 165 }*/
166 mDtDue = getEvenTime(dtDue); 166 mDtDue = getEvenTime(dtDue);
167 167
168 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl; 168 //kdDebug(5800) << "setDtDue says date is " << mDtDue.toString() << endl;
169 169
170 /*const QPtrList<Alarm>& alarms = alarms(); 170 /*const QPtrList<Alarm>& alarms = alarms();
171 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next()) 171 for (Alarm* alarm = alarms.first(); alarm; alarm = alarms.next())
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")
221 mStatus = ACCEPTED; 251 mStatus = ACCEPTED;
222 else if (ss == "SENT") 252 else if (ss == "SENT")
223 mStatus = SENT; 253 mStatus = SENT;
224 else if (ss == "TENTATIVE") 254 else if (ss == "TENTATIVE")
225 mStatus = TENTATIVE; 255 mStatus = TENTATIVE;
226 else if (ss == "CONFIRMED") 256 else if (ss == "CONFIRMED")
227 mStatus = CONFIRMED; 257 mStatus = CONFIRMED;
228 else if (ss == "DECLINED") 258 else if (ss == "DECLINED")
229 mStatus = DECLINED; 259 mStatus = DECLINED;
230 else if (ss == "COMPLETED") 260 else if (ss == "COMPLETED")
231 mStatus = COMPLETED; 261 mStatus = COMPLETED;
232 else if (ss == "DELEGATED") 262 else if (ss == "DELEGATED")
233 mStatus = DELEGATED; 263 mStatus = DELEGATED;
234 264
235 updated(); 265 updated();
236} 266}
237 267
238void Todo::setStatus(int status) 268void Todo::setStatus(int status)
239{ 269{
240 if (mReadOnly) return; 270 if (mReadOnly) return;
241 mStatus = status; 271 mStatus = status;
242 updated(); 272 updated();
243} 273}
244 274
245int Todo::status() const 275int Todo::status() const
246{ 276{
247 return mStatus; 277 return mStatus;
248} 278}
249 279
250QString Todo::statusStr() const 280QString Todo::statusStr() const
251{ 281{
252 switch(mStatus) { 282 switch(mStatus) {
253 case NEEDS_ACTION: 283 case NEEDS_ACTION:
254 return QString("NEEDS ACTION"); 284 return QString("NEEDS ACTION");
255 break; 285 break;
256 case ACCEPTED: 286 case ACCEPTED:
257 return QString("ACCEPTED"); 287 return QString("ACCEPTED");
258 break; 288 break;
259 case SENT: 289 case SENT:
260 return QString("SENT"); 290 return QString("SENT");
diff --git a/libkcal/todo.h b/libkcal/todo.h
index 41f5841..137b252 100644
--- a/libkcal/todo.h
+++ b/libkcal/todo.h
@@ -1,122 +1,134 @@
1/* 1/*
2 This file is part of libkcal. 2 This file is part of libkcal.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> 3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details. 13 Library General Public License for more details.
14 14
15 You should have received a copy of the GNU Library General Public License 15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to 16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. 18 Boston, MA 02111-1307, USA.
19*/ 19*/
20#ifndef TODO_H 20#ifndef TODO_H
21#define TODO_H 21#define TODO_H
22// 22//
23// Todo component, representing a VTODO object 23// Todo component, representing a VTODO object
24// 24//
25 25
26#include "incidence.h" 26#include "incidence.h"
27 27
28namespace KCal { 28namespace KCal {
29 29
30/** 30/**
31 This class provides a Todo in the sense of RFC2445. 31 This class provides a Todo in the sense of RFC2445.
32*/ 32*/
33class Todo : public Incidence 33class Todo : public Incidence
34{ 34{
35 public: 35 public:
36 Todo(); 36 Todo();
37 Todo(const Todo &); 37 Todo(const Todo &);
38 ~Todo(); 38 ~Todo();
39 typedef ListBase<Todo> List; 39 typedef ListBase<Todo> List;
40 QCString type() const { return "Todo"; } 40 QCString type() const { return "Todo"; }
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 /**
89 Set how many percent of the task are completed. Valid values are in the 101 Set how many percent of the task are completed. Valid values are in the
90 range from 0 to 100. 102 range from 0 to 100.
91 */ 103 */
92 void setPercentComplete(int); 104 void setPercentComplete(int);
93 105
94 /** return date and time when todo was completed */ 106 /** return date and time when todo was completed */
95 QDateTime completed() const; 107 QDateTime completed() const;
96 QString completedStr(bool shortF = true) const; 108 QString completedStr(bool shortF = true) const;
97 /** set date and time of completion */ 109 /** set date and time of completion */
98 void setCompleted(const QDateTime &completed); 110 void setCompleted(const QDateTime &completed);
99 111
100 /** Return true, if todo has a date associated with completion */ 112 /** Return true, if todo has a date associated with completion */
101 bool hasCompletedDate() const; 113 bool hasCompletedDate() const;
102 bool contains ( Todo*); 114 bool contains ( Todo*);
103 115
104 private: 116 private:
105 bool accept(Visitor &v) { return v.visit(this); } 117 bool accept(Visitor &v) { return v.visit(this); }
106 118
107 QDateTime mDtDue; // due date of todo 119 QDateTime mDtDue; // due date of todo
108 120
109 bool mHasDueDate; // if todo has associated due date 121 bool mHasDueDate; // if todo has associated due date
110 122
111// int mStatus; // confirmed/delegated/tentative/etc 123// int mStatus; // confirmed/delegated/tentative/etc
112 124
113 QDateTime mCompleted; 125 QDateTime mCompleted;
114 bool mHasCompletedDate; 126 bool mHasCompletedDate;
115 127
116 int mPercentComplete; 128 int mPercentComplete;
117}; 129};
118 130
119 bool operator==( const Todo&, const Todo& ); 131 bool operator==( const Todo&, const Todo& );
120} 132}
121 133
122#endif 134#endif