Diffstat (limited to 'korganizer/kowhatsnextview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/kowhatsnextview.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 0547a2e..b2001ec 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp @@ -389,251 +389,245 @@ void KOWhatsNextView::changeEventDisplay(Event *, int action) default: updateView(); kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; } } void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) { if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(21) == QString("last-syncEvent-device") ) return; QDateTime cdt = QDateTime::currentDateTime(); mText += "<tr><td><b>"; if (ev->type()=="Event") { 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(); } 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>"; else mText += dateText; } } 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()->setIntDateFormat( 3 ); KGlobal::locale()->setDateFormatShort("%d.%b"); - mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "</font>"; - + mText +="<font color=\"#F00000\">" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "</font>"; KGlobal::locale()->setDateFormatShort(dfs); - KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate ); } 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 ); } } mText += "</b></td><td>"; bool needClose = false; if ( ev->cancelled() ) { mText += "<font color=\"#F00000\">[c"; needClose =true; } if ( ev->isAlarmEnabled() ) { if ( !needClose) mText +="["; mText += "a"; needClose =true; } if ( ev->description().length() > 0 ) { if ( !needClose) mText +="["; mText += "i"; needClose =true; } if ( ev->recurrence()->doesRecur() ) { if ( !needClose) mText +="["; mText += "r"; needClose =true; } if ( needClose ) { mText += "] "; } if ( ev->cancelled() ) mText += "</font>"; mText += "<a "; if (ev->type()=="Event") mText += "href=\"event:"; if (ev->type()=="Todo") mText += "href=\"todo:"; mText += ev->uid() + "\">"; if ( ev->summary().length() > 0 ) mText += ev->summary(); else mText += i18n("-no summary-"); mText += "</a>"; if ( KOPrefs::instance()->mWNViewShowLocation ) if ( !ev->location().isEmpty() ) mText += " ("+ev->location() +")"; if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) mText += " ["+ev->relatedTo()->summary() +"]"; mText += "</td></tr>\n"; } bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) { if ( mTodos.find( ev ) != mTodos.end() ) return false; mTodos.append( ev ); if ( !isSub ) mText += "<p>"; else mText += "<li>"; mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; mText += ind; bool needClose = false; if ( ev->cancelled() ) { mText += "<font color=\"#F00000\">[c"; needClose =true; } if ( ev->isAlarmEnabled() ) { if ( !needClose) mText +="["; mText += "a"; needClose =true; } if ( ev->description().length() > 0 ) { if ( !needClose) mText +="["; mText += "i"; needClose =true; } // if ( ev->recurrence()->doesRecur() ) { // if ( !needClose) // mText +="("; // mText += "r"; // needClose =true; // } if ( needClose ) mText += "] "; if ( ev->cancelled() ) mText += "</font>"; mText += "<a href=\"todo:" + ev->uid() + "\">"; mText += ev->summary(); mText += "</a>"; if ( ((Todo*)ev)->hasDueDate () ) { QString year = ""; int ye = ((Todo*)ev)->dtDue().date().year(); if ( QDateTime::currentDateTime().date().year() != ye ) year = QString::number( ye ); QString dfs = KGlobal::locale()->dateFormatShort(); - KGlobal::locale()->setIntDateFormat( 3 ); KGlobal::locale()->setDateFormatShort("%d.%b"); - mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true) + "."+ year +"]</font>"; - + mText +="<font color=\"#00A000\"> [" + KGlobal::locale()->formatDate(((Todo*)ev)->dtDue().date(), true, KLocale::Userdefined) + "."+ year +"]</font>"; KGlobal::locale()->setDateFormatShort(dfs); - KGlobal::locale()->setIntDateFormat( KOPrefs::instance()->mPreferredDate ); } if ( KOPrefs::instance()->mWNViewShowLocation ) if ( !ev->location().isEmpty() ) mText += " ("+ev->location() +")"; if ( !isSub ) { if ( ((Todo*)ev)->relatedTo()&& KOPrefs::instance()->mWNViewShowsParents) mText += " ["+ev->relatedTo()->summary() +"]"; mText += "</p>\n"; } else { ind += "-"; mText += "</li>\n"; } QPtrList<Incidence> Relations = ev->relations(); Incidence *to; for (to=Relations.first();to;to=Relations.next()) { if (!((Todo*)to)->isCompleted()) appendTodo( to, ind , true ); } return true; } /* void KOWhatsNextView::createEventViewer() { if (!mEventViewer) { mEventViewer = new KOEventViewerDialog(this); } } */ void KOWhatsNextView::setEventViewer(KOEventViewerDialog* v ) { if ( mEventViewer ) delete mEventViewer; mEventViewer = v; } // TODO: Create this function in CalendarView and remove it from here void KOWhatsNextView::showIncidence(const QString &uid) { if ( !mEventViewer ) { qDebug("KOWhatsNextView::showIncidence::sorry, no event viewer set "); return; } //kdDebug() << "KOWhatsNextView::showIncidence(): " << uid << endl; //qDebug("KOWhatsNextView::showIncidence %s ", uid.latin1()); if (uid.startsWith("event:")) { #ifdef DESKTOP_VERSION Event *event = calendar()->event(uid.mid(8)); #else Event *event = calendar()->event(uid.mid(6)); #endif //qDebug("event %d uid %s ", event, uid.mid(6).latin1()); if (!event) return; //createEventViewer(); mEventViewer->setEvent(event); } else if (uid.startsWith("todo:")) { #ifdef DESKTOP_VERSION Todo *todo = calendar()->todo(uid.mid(7)); #else Todo *todo = calendar()->todo(uid.mid(5)); #endif |