summaryrefslogtreecommitdiffabout
path: root/korganizer/kowhatsnextview.cpp
Unidiff
Diffstat (limited to 'korganizer/kowhatsnextview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp159
1 files changed, 88 insertions, 71 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index b2001ec..2a8a7c1 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -263,11 +263,12 @@ void KOWhatsNextView::updateView()
263 if (replys == 0) { 263 if (replys == 0) {
264 mText += "<p></p>"; 264 mText += "<p></p>";
265 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 265 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
266 mText += "<h2>"; 266 //mText += "<h2>";
267 //<img src=\""; 267 //<img src=\"";
268 // mText += ipath; 268 // mText += ipath;
269 // mText += "\">"; 269 // mText += "\">";
270 mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; 270 //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
271 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
271 mText += "<table>\n"; 272 mText += "<table>\n";
272 } 273 }
273 replys++; 274 replys++;
@@ -281,24 +282,19 @@ void KOWhatsNextView::updateView()
281 if (todos.count() > 0) { 282 if (todos.count() > 0) {
282 Todo *to = todos.first(); 283 Todo *to = todos.first();
283 while(to) { 284 while(to) {
284 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 285 if ( !to->isCompleted() ){
285 if (me!=0) { 286 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
286 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 287 if (me!=0) {
287 if (replys == 0) { 288 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
288 mText += "<p></p>"; 289 if (replys == 0) {
289 // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 290 mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n";
290 mText += "<h2>"; 291 mText += "<table>\n";
291 //<img src=\""; 292 }
292 // mText += ipath; 293 replys++;
293 // mText += "\">"; 294 appendEvent(to, true);
294 mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n";
295 mText += "<table>\n";
296 } 295 }
297 replys++;
298 appendEvent(to);
299 } 296 }
300 } 297 }
301 kdDebug () << "check for todo-replys..." << endl;
302 to = todos.next(); 298 to = todos.next();
303 } 299 }
304 } 300 }
@@ -307,7 +303,6 @@ void KOWhatsNextView::updateView()
307 303
308 mText += "</td></tr>\n</table>\n"; 304 mText += "</td></tr>\n</table>\n";
309 305
310 kdDebug() << "KOWhatsNextView::updateView: text: " << mText << endl;
311 mView->setText(mText); 306 mView->setText(mText);
312 mView->setFocus(); 307 mView->setFocus();
313 308
@@ -394,74 +389,96 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action)
394 389
395void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 390void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
396{ 391{
397 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") ) 392 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
398 return; 393 return;
399 QDateTime cdt = QDateTime::currentDateTime(); 394 QDateTime cdt = QDateTime::currentDateTime();
395 QDateTime noc;
396 bool ok = true;
397 if ( reply ) {
398 noc = ev->getNextOccurence( cdt, &ok );
399 if (! ok && ev->type() == "Event")
400 return;
401 }
400 mText += "<tr><td><b>"; 402 mText += "<tr><td><b>";
401 if (ev->type()=="Event") { 403 if (ev->type()=="Event") {
404 if (reply) {
405 if (!ev->doesFloat())
406 mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
407 else
408 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
409
410 } else {
411 if (!ev->doesFloat()) {
412 Event *event = static_cast<Event *>(ev);
413 QDateTime st,end;
414 if ( event->recurrence()->doesRecur() ) {
415 QDate recDate= mEventDate;
416 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
417 while ( ! event->recursOn( recDate ) ) {
418 recDate = recDate.addDays( -1 );
402 419
403 if (!ev->doesFloat()) { 420 }
404 Event *event = static_cast<Event *>(ev); 421 st = QDateTime ( recDate, event->dtStart().time() );
405 QDateTime st,end; 422 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
406 if ( event->recurrence()->doesRecur() ) { 423 }
407 QDate recDate= mEventDate; 424 else {
408 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 425 st = event->dtStart();
409 while ( ! event->recursOn( recDate ) ) { 426 end = event->dtEnd();
410 recDate = recDate.addDays( -1 );
411
412 } 427 }
413 st = QDateTime ( recDate, event->dtStart().time() );
414 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
415 }
416 else {
417 st = event->dtStart();
418 end = event->dtEnd();
419 }
420 428
421 if (reply) mText += "on " + event->dtStartDateStr() + ": "; 429
422 QString dateText; 430 QString dateText;
423 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); 431 // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() );
424 if ( st.date() < mEventDate ) 432 if ( st.date() < mEventDate )
425 dateText = "++:++-"; 433 dateText = "++:++-";
426 else 434 else
427 dateText = event->dtStartTimeStr() + "-"; 435 dateText = event->dtStartTimeStr() + "-";
428 if ( end.date() > mEventDate ) 436 if ( end.date() > mEventDate )
429 dateText += "++:++"; 437 dateText += "++:++";
430 else
431 dateText += event->dtEndTimeStr();
432 if ( notRed )
433 mText += dateText;
434 else {
435 if ( end < cdt )
436 mText += "<font color=\"#F00000\">" + dateText + "</font>";
437 else if ( st < cdt )
438 mText += "<font color=\"#008000\">" + dateText + "</font>";
439 else 438 else
439 dateText += event->dtEndTimeStr();
440 if ( notRed )
440 mText += dateText; 441 mText += dateText;
441 } 442 else {
443 if ( end < cdt )
444 mText += "<font color=\"#F00000\">" + dateText + "</font>";
445 else if ( st < cdt )
446 mText += "<font color=\"#008000\">" + dateText + "</font>";
447 else
448 mText += dateText;
449
450 }
442 451
443 } else { 452 } else {
444 mText += i18n("Allday:"); 453 mText += i18n("Allday:");
445 454
455 }
446 } 456 }
447 } else { 457 } else {
448 mTodos.append( ev ); 458 mTodos.append( ev );
449 mText += i18n("ToDo:"); 459 mText += i18n("ToDo:");
450 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 460 if (reply) {
451 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; 461 mText += " ";
452 QString dfs = KGlobal::locale()->dateFormatShort(); 462 if ( noc != cdt ) {
453 KGlobal::locale()->setDateFormatShort("%d.%b"); 463 mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
454 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; 464 }
455 KGlobal::locale()->setDateFormatShort(dfs);
456 } else { 465 } else {
457 if (!ev->doesFloat() ) 466 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
458 if( ( (Todo*)ev)->dtDue() < cdt ) { 467 // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>";
459 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; 468 QString dfs = KGlobal::locale()->dateFormatShort();
460 469 KGlobal::locale()->setDateFormatShort("%d.%b");
461 470 mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>";
462 } else 471 KGlobal::locale()->setDateFormatShort(dfs);
463 mText +=((Todo*)ev)->dtDueTimeStr(); 472 } else {
464 mTodos.append( ev ); 473 if (!ev->doesFloat() )
474 if( ( (Todo*)ev)->dtDue() < cdt ) {
475 mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>";
476
477
478 } else
479 mText +=((Todo*)ev)->dtDueTimeStr();
480 mTodos.append( ev );
481 }
465 } 482 }
466 } 483 }
467 mText += "</b></td><td>"; 484 mText += "</b></td><td>";