From 6b6a28919908134ccbb3badcb24c2dcae0d426a5 Mon Sep 17 00:00:00 2001 From: zautrix Date: Mon, 20 Sep 2004 15:25:04 +0000 Subject: Several bugfixes --- diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp index ba0e6c6..bbed05b 100644 --- a/korganizer/calendarview.cpp +++ b/korganizer/calendarview.cpp @@ -1936,7 +1936,7 @@ void CalendarView::changeTodoDisplay(Todo *which, int action) //mDialogManager->updateSearchDialog(); 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 @@ -223,6 +223,12 @@ void KOViewManager::updateView(const QDate &start, const QDate &end) } +void KOViewManager::updateWNview() +{ + if ( mCurrentView == mWhatsNextView && mWhatsNextView ) + mWhatsNextView->updateView(); + +} void KOViewManager::showWhatsNextView() { if (!mWhatsNextView) { diff --git a/korganizer/koviewmanager.h b/korganizer/koviewmanager.h index f814c36..26b22be 100644 --- a/korganizer/koviewmanager.h +++ b/korganizer/koviewmanager.h @@ -53,7 +53,7 @@ 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); bool showsNextDays(); 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 += ""; diff --git a/libkcal/incidence.cpp b/libkcal/incidence.cpp index 56c9801..55ac6d4 100644 --- a/libkcal/incidence.cpp +++ b/libkcal/incidence.cpp @@ -590,8 +590,12 @@ QDateTime Incidence::getNextOccurence( const QDateTime& dt, bool* ok ) const } else { if ( hasStartDate () ) { incidenceStart = dtStart(); - - } + } + if ( type() =="Todo" ) { + if ( ((Todo*)this)->hasDueDate() ) + incidenceStart = ((Todo*)this)->dtDue(); + + } } if ( incidenceStart > dt ) *ok = true; diff --git a/libkcal/incidencebase.cpp b/libkcal/incidencebase.cpp index 64a343c..b36dc1a 100644 --- a/libkcal/incidencebase.cpp +++ b/libkcal/incidencebase.cpp @@ -271,7 +271,7 @@ 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; } @@ -289,7 +289,7 @@ Attendee *IncidenceBase::attendeeByMails(const QStringList &emails, const QStrin qli.toFirst(); 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(); } -- cgit v0.9.0.2