From 6b6a28919908134ccbb3badcb24c2dcae0d426a5 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 20 Sep 2004 15:25:04 +0000 Subject: Several bugfixes --- (limited to 'korganizer/kowhatsnextview.cpp') 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() if (replys == 0) { mText += "

"; // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); - mText += "

"; + //mText += "

"; //"; - mText += i18n("Events and To-Dos that need a reply:") + "

\n"; + //mText += i18n("Events and To-Dos that need a reply:") + "\n"; + mText +="" + i18n("Events and To-Dos that need a reply:") + "\n"; mText += "\n"; } replys++; @@ -281,24 +282,19 @@ void KOWhatsNextView::updateView() if (todos.count() > 0) { Todo *to = todos.first(); while(to) { - Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); - if (me!=0) { - if (me->status()==Attendee::NeedsAction && me->RSVP()) { - if (replys == 0) { - mText += "

"; - // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); - mText += "

"; - //"; - mText += i18n("Events and To-Dos that need a reply:") + "

\n"; - mText += "
\n"; + if ( !to->isCompleted() ){ + Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); + if (me!=0) { + if (me->status()==Attendee::NeedsAction && me->RSVP()) { + if (replys == 0) { + mText +="" + i18n("Events and To-Dos that need a reply:") + "\n"; + mText += "
\n"; + } + replys++; + appendEvent(to, true); } - replys++; - appendEvent(to); } } - kdDebug () << "check for todo-replys..." << endl; to = todos.next(); } } @@ -307,7 +303,6 @@ void KOWhatsNextView::updateView() mText += "\n
\n"; - kdDebug() << "KOWhatsNextView::updateView: text: " << mText << endl; mView->setText(mText); mView->setFocus(); @@ -394,74 +389,96 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action) void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) { - if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") ) - return; + if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) + return; QDateTime cdt = QDateTime::currentDateTime(); + QDateTime noc; + bool ok = true; + if ( reply ) { + noc = ev->getNextOccurence( cdt, &ok ); + if (! ok && ev->type() == "Event") + return; + } mText += ""; if (ev->type()=="Event") { + if (reply) { + if (!ev->doesFloat()) + mText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; + else + mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; + + } else { + if (!ev->doesFloat()) { + Event *event = static_cast(ev); + QDateTime st,end; + if ( event->recurrence()->doesRecur() ) { + QDate recDate= mEventDate; + int days = event->dtStart().date().daysTo (event->dtEnd().date() ); + while ( ! event->recursOn( recDate ) ) { + recDate = recDate.addDays( -1 ); - if (!ev->doesFloat()) { - Event *event = static_cast(ev); - QDateTime st,end; - if ( event->recurrence()->doesRecur() ) { - QDate recDate= mEventDate; - int days = event->dtStart().date().daysTo (event->dtEnd().date() ); - while ( ! event->recursOn( recDate ) ) { - recDate = recDate.addDays( -1 ); - + } + st = QDateTime ( recDate, event->dtStart().time() ); + end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); + } + else { + st = event->dtStart(); + end = event->dtEnd(); } - st = QDateTime ( recDate, event->dtStart().time() ); - end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); - } - else { - st = event->dtStart(); - end = event->dtEnd(); - } - if (reply) mText += "on " + event->dtStartDateStr() + ": "; - QString dateText; - // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); - if ( st.date() < mEventDate ) - dateText = "++:++-"; - else - dateText = event->dtStartTimeStr() + "-"; - if ( end.date() > mEventDate ) - dateText += "++:++"; - else - dateText += event->dtEndTimeStr(); - if ( notRed ) - mText += dateText; - else { - if ( end < cdt ) - mText += "" + dateText + ""; - else if ( st < cdt ) - mText += "" + dateText + ""; + + QString dateText; + // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); + if ( st.date() < mEventDate ) + dateText = "++:++-"; + else + dateText = event->dtStartTimeStr() + "-"; + if ( end.date() > mEventDate ) + dateText += "++:++"; else + dateText += event->dtEndTimeStr(); + if ( notRed ) mText += dateText; - } + else { + if ( end < cdt ) + mText += "" + dateText + ""; + else if ( st < cdt ) + mText += "" + dateText + ""; + else + mText += dateText; + + } - } else { - mText += i18n("Allday:"); + } else { + mText += i18n("Allday:"); + } } } else { mTodos.append( ev ); mText += i18n("ToDo:"); - if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { - // mText +="" + i18n("O-due!") + ""; - QString dfs = KGlobal::locale()->dateFormatShort(); - KGlobal::locale()->setDateFormatShort("%d.%b"); - mText +="" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + ""; - KGlobal::locale()->setDateFormatShort(dfs); + if (reply) { + mText += " "; + if ( noc != cdt ) { + mText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; + } } else { - if (!ev->doesFloat() ) - if( ( (Todo*)ev)->dtDue() < cdt ) { - mText +="" + ((Todo*)ev)->dtDueTimeStr() + ""; - - - } else - mText +=((Todo*)ev)->dtDueTimeStr(); - mTodos.append( ev ); + if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { + // mText +="" + i18n("O-due!") + ""; + QString dfs = KGlobal::locale()->dateFormatShort(); + KGlobal::locale()->setDateFormatShort("%d.%b"); + mText +="" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + ""; + KGlobal::locale()->setDateFormatShort(dfs); + } else { + if (!ev->doesFloat() ) + if( ( (Todo*)ev)->dtDue() < cdt ) { + mText +="" + ((Todo*)ev)->dtDueTimeStr() + ""; + + + } else + mText +=((Todo*)ev)->dtDueTimeStr(); + mTodos.append( ev ); + } } } mText += ""; -- cgit v0.9.0.2