Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 80 |
1 files changed, 56 insertions, 24 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index bac66d3..1f69700 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -47,12 +47,16 @@ #include "koeventviewer.h" #ifndef KORG_NOKABC #include <kabc/stdaddressbook.h> #define size count #endif +#ifndef DESKTOP_VERSION +#include <qtopia/qcopenvelope_qws.h> +#endif + KOEventViewer::KOEventViewer(QWidget *parent,const char *name) : QTextBrowser(parent,name) { mSyncMode = false; mColorMode = 0; } @@ -60,40 +64,52 @@ KOEventViewer::KOEventViewer(QWidget *parent,const char *name) KOEventViewer::~KOEventViewer() { } void KOEventViewer::setSource(const QString& n) { - KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); - KABC::AddressBook::Iterator it; - for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { - // LR I do not understand, why the uid string is different on zaurus and desktop + + if ( n.left(3) == "uid" ) { + KABC::StdAddressBook* AddressBook = KABC::StdAddressBook::self( true ); + KABC::AddressBook::Iterator it; + for( it = AddressBook->begin(); it != AddressBook->end(); ++it ) { + // LR I do not understand, why the uid string is different on zaurus and desktop #ifdef DESKTOP_VERSION - QString uid = "uid://"+(*it).uid(); + QString uid = "uid://"+(*it).uid(); #else - QString uid = "uid:"+(*it).uid(); + QString uid = "uid:"+(*it).uid(); #endif - //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); - if (n == uid ) { - //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); - QDialog dia( this,"dia123", true ); - dia.setCaption( i18n("Details of attendee") ); - QVBoxLayout lay ( &dia ); - KPIM::AddresseeView av ( &dia ); - av.setAddressee( (*it) ); - lay.addWidget( &av ); - if ( QApplication::desktop()->width() < 480 ) - dia.resize( 220, 240); - else { - dia.resize( 400,400); + //qDebug("for *%s* +%s+ ", n.latin1(), uid.latin1()); + if (n == uid ) { + //qDebug("found %s ",(*it).mobileHomePhone().latin1() ); + QDialog dia( this,"dia123", true ); + dia.setCaption( i18n("Details of attendee") ); + QVBoxLayout lay ( &dia ); + KPIM::AddresseeView av ( &dia ); + av.setAddressee( (*it) ); + lay.addWidget( &av ); + if ( QApplication::desktop()->width() < 480 ) + dia.resize( 220, 240); + else { + dia.resize( 400,400); + } + dia.exec(); + break; + } } - dia.exec(); - break; - } - } + return; + } + if ( n.left(6) == "mailto" ) { + // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); +#ifndef DESKTOP_VERSION + QCopEnvelope e("QPE/Application/kmpi", "newMail(QString)" ); + e << n.mid(7); +#endif + + } #ifndef KORG_NODCOP kdDebug() << "KOEventViewer::setSource(): " << n << endl; QString tmpStr; if (n.startsWith("mailto:")) { @@ -167,12 +183,13 @@ void KOEventViewer::addTag(const QString & tag,const QString & text) void KOEventViewer::setColorMode( int m ) { mColorMode = m; } void KOEventViewer::appendEvent(Event *event, int mode ) { + mMailSubject = ""; mCurrentIncidence = event; bool shortDate = KOPrefs::instance()->mShortDateInViewer; topLevelWidget()->setCaption(i18n("Event Viewer")); if ( mode == 0 ) { addTag("h2",event->summary()); } @@ -190,21 +207,24 @@ void KOEventViewer::appendEvent(Event *event, int mode ) addTag("h2",i18n( "Remote: " ) +event->summary()); } addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } + mMailSubject += i18n( "Meeting " )+ event->summary(); if (event->cancelled ()) { mText +="<font color=\"#B00000\">"; addTag("i",i18n("This event has been cancelled!")); mText.append("<br>"); mText += "</font>"; + mMailSubject += i18n("(cancelled)"); } if (!event->location().isEmpty()) { addTag("b",i18n("Location: ")); mText.append(event->location()+"<br>"); + mMailSubject += i18n(" at ") + event->location(); } if (event->doesFloat()) { if (event->isMultiDay()) { mText.append(i18n("<p><b>From:</b> %1 </p><p><b>To:</b> %2</p>") .arg(event->dtStartDateStr(shortDate)) .arg(event->dtEndDateStr(shortDate))); @@ -235,16 +255,22 @@ void KOEventViewer::appendEvent(Event *event, int mode ) QDate next; next = event->recurrence()->getPreviousDate( start , &last ); if ( !last ) { next = event->recurrence()->getNextDate( start.addDays( - 1 ) ); addTag("p",i18n("<b>Next recurrence is on:</b>") ); addTag("p", KGlobal::locale()->formatDate( next, shortDate )); + QDateTime nextdt = QDateTime( next, event->dtStart().time()); + mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( nextdt, true ); + } else { addTag("p",i18n("<b>Last recurrence was on:</b>") ); addTag("p", KGlobal::locale()->formatDate( next, shortDate )); } + } else { + mMailSubject += i18n(" - " )+event->dtStartStr( true ); + } if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); @@ -271,12 +297,13 @@ void KOEventViewer::appendEvent(Event *event, int mode ) //QWhatsThis::add(this,mText); } void KOEventViewer::appendTodo(Todo *event, int mode ) { + mMailSubject = ""; mCurrentIncidence = event; topLevelWidget()->setCaption(i18n("Todo Viewer")); bool shortDate = KOPrefs::instance()->mShortDateInViewer; if (mode == 0 ) addTag("h2",event->summary()); else { @@ -292,25 +319,29 @@ void KOEventViewer::appendTodo(Todo *event, int mode ) addTag("h2",i18n( "Remote: " ) +event->summary()); } addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } + mMailSubject += i18n( "Todo " )+ event->summary(); if (event->cancelled ()) { mText +="<font color=\"#B00000\">"; addTag("i",i18n("This todo has been cancelled!")); mText.append("<br>"); mText += "</font>"; + mMailSubject += i18n("(cancelled)"); } if (!event->location().isEmpty()) { addTag("b",i18n("Location: ")); mText.append(event->location()+"<br>"); + mMailSubject += i18n(" at ") + event->location(); } if (event->hasDueDate()) { mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); + mMailSubject += i18n(" - " )+event->dtDueStr( true ); } addTag("b",i18n("Access: ")); mText.append(event->secrecyStr()+"<br>"); if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",event->description()); @@ -402,15 +433,16 @@ void KOEventViewer::formatAttendees(Incidence *event) mText += "<li><a href=\"uid:" + a->uid() + "\">"; if (!a->name().isEmpty()) mText += a->name(); else mText += a->email(); mText += "</a>\n"; #endif + if (!a->email().isEmpty()) { if (iconPath) { - mText += "<a href=\"mailto:" + a->name() +" "+ "<" + a->email() + ">" + "\">"; + mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; mText += "<IMG src=\"" + iconPath + "\">"; mText += "</a>\n"; } } if (a->status() != Attendee::NeedsAction ) mText +="[" + a->statusStr() + "] "; |