-rw-r--r-- | korganizer/calendarview.cpp | 2 | ||||
-rw-r--r-- | korganizer/koviewmanager.cpp | 6 | ||||
-rw-r--r-- | korganizer/koviewmanager.h | 2 | ||||
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 159 | ||||
-rw-r--r-- | libkcal/incidence.cpp | 8 | ||||
-rw-r--r-- | libkcal/incidencebase.cpp | 4 |
6 files changed, 104 insertions, 77 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ba0e6c6..bbed05b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1937,5 +1937,5 @@ void CalendarView::changeTodoDisplay(Todo *which, int action) if (which) { - //mViewManager->currentView()->updateView();//LR + mViewManager->updateWNview(); //mTodoList->updateView(); } diff --git a/korganizer/koviewmanager.cpp b/korganizer/koviewmanager.cpp index fc2bc77..ba77b45 100644 --- a/korganizer/koviewmanager.cpp +++ b/korganizer/koviewmanager.cpp @@ -224,4 +224,10 @@ void KOViewManager::updateView(const QDate &start, const QDate &end) +void KOViewManager::updateWNview() +{ + if ( mCurrentView == mWhatsNextView && mWhatsNextView ) + mWhatsNextView->updateView(); + +} void KOViewManager::showWhatsNextView() { diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index f814c36..26b22be 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -54,5 +54,5 @@ class KOViewManager : public QObject /** changes the view to be the currently selected view */ void showView(KOrg::BaseView *, bool fullScreen = false ); - + void updateWNview(); void readSettings(KConfig *config); void writeSettings(KConfig *config); diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index b2001ec..2a8a7c1 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -264,9 +264,10 @@ void KOWhatsNextView::updateView() mText += "<p></p>"; // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); - mText += "<h2>"; + //mText += "<h2>"; //<img src=\""; // mText += ipath; // mText += "\">"; - mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; + //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; + mText +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; mText += "<table>\n"; } @@ -282,22 +283,17 @@ void KOWhatsNextView::updateView() 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 += "<p></p>"; - // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); - mText += "<h2>"; - //<img src=\""; - // mText += ipath; - // mText += "\">"; - mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; - mText += "<table>\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 +="<big><big><strong><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></strong></big></big>\n"; + mText += "<table>\n"; + } + replys++; + appendEvent(to, true); } - replys++; - appendEvent(to); } } - kdDebug () << "check for todo-replys..." << endl; to = todos.next(); } @@ -308,5 +304,4 @@ void KOWhatsNextView::updateView() mText += "</td></tr>\n</table>\n"; - kdDebug() << "KOWhatsNextView::updateView: text: " << mText << endl; mView->setText(mText); mView->setFocus(); @@ -395,72 +390,94 @@ 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 += "<tr><td><b>"; 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<Event *>(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<Event *>(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 += "<font color=\"#F00000\">" + dateText + "</font>"; - else if ( st < cdt ) - mText += "<font color=\"#008000\">" + dateText + "</font>"; + + 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 += "<font color=\"#F00000\">" + dateText + "</font>"; + else if ( st < cdt ) + mText += "<font color=\"#008000\">" + dateText + "</font>"; + 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 +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; - QString dfs = KGlobal::locale()->dateFormatShort(); - KGlobal::locale()->setDateFormatShort("%d.%b"); - mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; - 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 +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; - - - } else - mText +=((Todo*)ev)->dtDueTimeStr(); - mTodos.append( ev ); + if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { + // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; + QString dfs = KGlobal::locale()->dateFormatShort(); + KGlobal::locale()->setDateFormatShort("%d.%b"); + mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; + KGlobal::locale()->setDateFormatShort(dfs); + } else { + if (!ev->doesFloat() ) + if( ( (Todo*)ev)->dtDue() < cdt ) { + mText +="<font color=\"#F00000\">" + ((Todo*)ev)->dtDueTimeStr() + "</font>"; + + + } else + mText +=((Todo*)ev)->dtDueTimeStr(); + mTodos.append( ev ); + } } } diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 56c9801..55ac6d4 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -591,6 +591,10 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const if ( hasStartDate () ) { incidenceStart = dtStart(); - - } + } + if ( type() =="Todo" ) { + if ( ((Todo*)this)->hasDueDate() ) + incidenceStart = ((Todo*)this)->dtDue(); + + } } if ( incidenceStart > dt ) diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 64a343c..b36dc1a 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -272,5 +272,5 @@ Attendee *IncidenceBase::attendeeByMail(const QString &email) qli.toFirst(); while (qli) { - if (qli.current()->email() == email) + if (qli.current()->email().lower() == email.lower()) return qli.current(); ++qli; @@ -290,5 +290,5 @@ Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QStrin while (qli) { for ( QStringList::Iterator it = mails.begin(); it != mails.end(); ++it ) { - if (qli.current()->email() == *it) + if (qli.current()->email().lower() == (*it).lower()) return qli.current(); } |