author | zautrix <zautrix> | 2005-07-27 22:26:08 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-07-27 22:26:08 (UTC) |
commit | 0e38cffd7ba745f237c659e1c48080fcb25b126c (patch) (side-by-side diff) | |
tree | 6069600e18bae5300c6ce427735457dbfed93141 /korganizer/koeventviewer.cpp | |
parent | 136f9082862e7a56abb3a201e96f5e7386c4f1b9 (diff) | |
download | kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.zip kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.gz kdepimpi-0e38cffd7ba745f237c659e1c48080fcb25b126c.tar.bz2 |
rec changes
Diffstat (limited to 'korganizer/koeventviewer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | korganizer/koeventviewer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index a690ab1..db695f5 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -158,519 +158,519 @@ void KOEventViewer::setSource(const QString& n) QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); if (attendees.count()) { Attendee *a; for(a=attendees.first();a;a=attendees.next()) { if ( "uid:"+a->uid() == n ) { bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); return; } } } return; } //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); // the result should now arrive through method insertAttendees //QString uid = "uid:"+(*it).uid(); #endif if ( n.left(6) == "mailto" ) { // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); #ifndef DESKTOP_VERSION if ( n.mid(7,3) == "ALL" ) { mailToAttendees( true ); } else if ( n.mid(7,4) == "RSVP" ) { mailToAttendees( false ); } else { QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); e << n.mid(7); } #endif } #ifndef KORG_NODCOP kdDebug() << "KOEventViewer::setSource(): " << n << endl; QString tmpStr; if (n.startsWith("mailto:")) { KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); //emit showIncidence(n); return; } else if (n.startsWith("uid:")) { DCOPClient *client = KApplication::kApplication()->dcopClient(); const QByteArray noParamData; const QByteArray paramData; QByteArray replyData; QCString replyTypeStr; #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) bool foundAbbrowser = PING_ABBROWSER; if (foundAbbrowser) { //KAddressbook is already running, so just DCOP to it to bring up the contact editor //client->send("kaddressbook","KAddressBookIface", QDataStream arg(paramData, IO_WriteOnly); arg << n.mid(6); client->send("kaddressbook", "KAddressBookIface", "showContactEditor( QString )", paramData); return; } else { /* KaddressBook is not already running. Pass it the UID of the contact via the command line while starting it - its neater. We start it without its main interface */ KIconLoader* iconLoader = new KIconLoader(); QString iconPath = iconLoader->iconPath("go",KIcon::Small); ActionManager::setStartedKAddressBook(true); tmpStr = "kaddressbook --editor-only --uid "; tmpStr += KProcess::quote(n.mid(6)); KRun::runCommand(tmpStr,"KAddressBook",iconPath); return; } } else { //QTextBrowser::setSource(n); } #endif } void KOEventViewer::mailToAttendees( bool all ) { QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); if (attendees.count() == 0) return; QStringList nameList; QStringList emailList; QStringList uidList; Attendee* a; for(a=attendees.first();a;a=attendees.next()) { if ( !all && !a->RSVP() ) continue; if (!a->email().isEmpty()) { nameList.append (a->name() ); emailList.append (a->email() ); uidList.append (a->uid() ); } } QString uid = "ComposeMailUIpick2"+mMailSubject; #ifndef DESKTOP_VERSION bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); #endif } void KOEventViewer::addTag(const QString & tag,const QString & text) { int number=text.contains("\n"); QString str = "<" + tag + ">"; QString tmpText=text; QString tmpStr=str; if(number !=-1) { if (number > 0) { int pos=0; QString tmp; for(int i=0;i<=number;i++) { pos=tmpText.find("\n"); tmp=tmpText.left(pos); tmpText=tmpText.right(tmpText.length()-pos-1); tmpStr+=tmp+"<br>"; } } else tmpStr += tmpText; tmpStr+="</" + tag + ">"; mText.append(tmpStr); } else { str += text + "</" + tag + ">"; mText.append(str); } } void KOEventViewer::setColorMode( int m ) { mColorMode = m; } void KOEventViewer::appendEvent(Event *event, int mode ) { mMailSubject = ""; mCurrentIncidence = event; bool shortDate = KOPrefs::instance()->mShortDateInViewer; bool wideScreen = ( QApplication::desktop()->width() >= 640 ); topLevelWidget()->setCaption(i18n("Event Viewer")); if ( mode == 0 ) { addTag("h2",deTag(event->summary())); formatReadOnly(event); } else { if ( mColorMode == 1 ) { mText +="<font color=\"#00A000\">"; } if ( mColorMode == 2 ) { mText +="<font color=\"#C00000\">"; } // mText +="<font color=\"#F00000\">" + i18n("O-due!") + "</font>"; if ( mode == 1 ) { addTag("h2",i18n( "Local: " ) +deTag(event->summary())); } else { addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); } formatReadOnly(event); 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->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))); } else { mText.append(i18n("<p><b>On:</b> %1</p>").arg(event->dtStartDateStr( shortDate ))); } } else { if (event->isMultiDay()) { mText.append(i18n("<p><b>From:</b> %1</p> ") .arg(event->dtStartStr( shortDate))); mText.append(i18n("<p><b>To:</b> %1</p>") .arg(event->dtEndStr(shortDate))); } else { mText.append(i18n("<p><b>From:</b> %1 <b>To:</b> %2</p>") .arg(event->dtStartTimeStr()) .arg(event->dtEndTimeStr())); mText.append(i18n("<p><b>On:</b> %1</p> ") .arg(event->dtStartDateStr( shortDate ))); } } if (!event->location().isEmpty()) { addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); mMailSubject += i18n(" at ") + event->location(); } - if (event->recurrence()->doesRecur()) { + if (event->doesRecur()) { - QString recurText = event->recurrence()->recurrenceText(); + QString recurText = event->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring event.").arg(recurText ) + "</em>"); bool ok; QDate start = QDate::currentDate(); QDateTime next; next = event->getNextOccurence( QDateTime::currentDateTime() , &ok ); if ( ok ) { if ( wideScreen ){ addTag("p",i18n("<b>Next recurrence is on:</b>") +" " + KGlobal::locale()->formatDate( next.date(), shortDate ) ); } else { addTag("p",i18n("<b>Next recurrence is on:</b>") ); addTag("p", KGlobal::locale()->formatDate( next.date(), shortDate )); } mMailSubject += i18n(" - " )+ KGlobal::locale()->formatDateTime( next, true ); } else { bool last; QDate nextd; nextd = event->recurrence()->getPreviousDate( QDate::currentDate() , &last ); if ( last ) { if ( wideScreen ){ addTag("p",i18n("<b>Last recurrence was on:</b>") +" " + KGlobal::locale()->formatDate( nextd, shortDate )); } else{ addTag("p",i18n("<b>Last recurrence was on:</b>") ); addTag("p", KGlobal::locale()->formatDate( nextd, shortDate )); } } } } else { mMailSubject += i18n(" - " )+event->dtStartStr( true ); } if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); QString s =i18n("( %1 before )").arg( alarm->offsetText() ); if(wideScreen ){ addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); }else{ addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); } //addTag("p",s); } addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); formatCategories(event); formatAttendees(event); if ( KOPrefs::instance()->mEVshowCreated ) { if(wideScreen ){ addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); }else{ addTag("p",i18n("<b>Created: ") +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); } } if ( KOPrefs::instance()->mEVshowChanged ) { if(wideScreen ){ addTag("p",i18n("<b>Last modified: ") +" </b>" + KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); }else{ addTag("p",i18n("<b>Last modified: ") +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); } } if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",deTag(event->description())); } } setText(mText); //QWhatsThis::add(this,mText); } void KOEventViewer::appendTodo(Todo *event, int mode ) { mMailSubject = ""; mCurrentIncidence = event; topLevelWidget()->setCaption(i18n("Todo Viewer")); bool shortDate = KOPrefs::instance()->mShortDateInViewer; bool wideScreen = ( QApplication::desktop()->width() >= 640 ); if (mode == 0 ) { addTag("h2",deTag(event->summary())); formatReadOnly(event); } else { if ( mColorMode == 1 ) { mText +="<font color=\"#00A000\">"; } if ( mColorMode == 2 ) { mText +="<font color=\"#B00000\">"; } if ( mode == 1 ) { addTag("h2",i18n( "Local: " ) +deTag(event->summary())); } else { addTag("h2",i18n( "Remote: " ) +deTag(event->summary())); } formatReadOnly(event); addTag("h3",i18n( "Last modified: " ) + KGlobal::locale()->formatDateTime(event->lastModified(),shortDate, true ) ); if ( mColorMode ) mText += "</font>"; } mMailSubject += i18n( "Todo " )+ event->summary(); if ( event->percentComplete() == 100 && event->hasCompletedDate() ) { mText +="<font color=\"#B00000\">"; addTag("i", i18n("<p><i>Completed on %1</i></p>").arg( event->completedStr(KOPrefs::instance()->mShortDateInViewer) ) ); mText += "</font>"; } else { mText.append(i18n("<p><i>%1 % completed</i></p>") .arg(event->percentComplete())); } 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->recurrence()->doesRecur()) { + if (event->doesRecur()) { QString recurText = event->recurrence()->recurrenceText(); addTag("p","<em>" + i18n("This is a %1 recurring todo.").arg(recurText ) + "</em>"); } if (event->hasStartDate()) { mText.append(i18n("<p><b>Start on:</b> %1</p>").arg(event->dtStartStr(KOPrefs::instance()->mShortDateInViewer))); } if (event->hasDueDate()) { mText.append(i18n("<p><b>Due on:</b> %1</p>").arg(event->dtDueStr(KOPrefs::instance()->mShortDateInViewer))); mMailSubject += i18n(" - " )+event->dtDueStr( true ); } if (!event->location().isEmpty()) { addTag("p","<b>"+i18n("Location: ")+"</b>"+ deTag(event->location() ) ); mMailSubject += i18n(" at ") + event->location(); } mText.append(i18n("<p><b>Priority:</b> %2</p>") .arg(QString::number(event->priority()))); if (event->isAlarmEnabled()) { Alarm *alarm =event->alarms().first() ; QDateTime t = alarm->time(); QString s =i18n("( %1 before )").arg( alarm->offsetText() ); if ( wideScreen ) { addTag("p",i18n("<b>Alarm on: ") + s +" </b>"+ KGlobal::locale()->formatDateTime( t, shortDate )); } else { addTag("p",i18n("<b>Alarm on: ") + s +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( t, shortDate )); } } addTag("p","<b>"+i18n("Access: ") + "</b>" + event->secrecyStr()); formatCategories(event); formatAttendees(event); if ( KOPrefs::instance()->mEVshowCreated ) { if(wideScreen ){ addTag("p",i18n("<b>Created: ") +" </b>"+KGlobal::locale()->formatDateTime( event->created(), shortDate )); } else { addTag("p",i18n("<b>Created: ") +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( event->created(), shortDate )); } } if ( KOPrefs::instance()->mEVshowChanged ) { if(wideScreen ){ addTag("p",i18n("<b>Last modified: ") +" </b>" +KGlobal::locale()->formatDateTime( event->lastModified(), shortDate ) ); } else { addTag("p",i18n("<b>Last modified: ") +" </b>"); addTag("p", KGlobal::locale()->formatDateTime( event->lastModified(), shortDate )); } } if ( event->relatedTo() ) { addTag("b",i18n("Parent todo:<br>")); QString t_name = "[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] ";// +event->relatedTo()->summary()); mText += t_name; mText += "<a href=\"todo_uid:" + event->relatedTo()->uid() + "\">"; mText += deTag(event->relatedTo()->summary()); mText += "</a><br>"; // mText.append(deTag("[" +QString::number(event->relatedTo()->priority()) + "/" + QString::number(((Todo*)event->relatedTo())->percentComplete())+"%] " +event->relatedTo()->summary()) +"<br>"); } QPtrList<Incidence> Relations = event->relations(); Incidence *to; if ( Relations.first() ) addTag("b",i18n("Sub todos:<br>")); for (to=Relations.first();to;to=Relations.next()) { QString t_name = "[" +QString::number(((Todo*)to)->priority()) + "/" + QString::number(((Todo*)to)->percentComplete())+"%] ";// +to->relatedTo()->summary()); mText += t_name; mText += "<a href=\"todo_uid:" + to->uid() + "\">"; mText += deTag(to->summary()); mText += "</a><br>"; } if ( KOPrefs::instance()->mEVshowDetails ) { if (!event->description().isEmpty()) { addTag("p",i18n("<b>Details: </b>")); addTag("p",deTag(event->description())); } } setText(mText); } void KOEventViewer::formatCategories(Incidence *event) { if (!event->categoriesStr().isEmpty()) { if (event->categories().count() == 1) { addTag("p","<b>"+i18n("Category") + ":</b> " + event->categoriesStrWithSpace()); } else { addTag("p","<b>"+i18n("Categories")+":</b> " + event->categoriesStrWithSpace() ) ; } } } void KOEventViewer::formatAttendees(Incidence *event) { QPtrList<Attendee> attendees = event->attendees(); if (attendees.count()) { QString iconPath = KGlobal::iconLoader()->iconPath("mailappt",KIcon::Small); QString NOiconPath = KGlobal::iconLoader()->iconPath("nomailappt",KIcon::Small); addTag("h3",i18n("Organizer")); mText.append("<ul><li>"); #ifndef KORG_NOKABC #ifdef DESKTOP_VERSION KABC::AddressBook *add_book = KABC::StdAddressBook::self(); KABC::Addressee::List addressList; addressList = add_book->findByEmail(event->organizer()); KABC::Addressee o = addressList.first(); if (!o.isEmpty() && addressList.size()<2) { mText += "<a href=\"uid:" + o.uid() + "\">"; mText += o.formattedName(); mText += "</a>\n"; } else { mText.append(event->organizer()); } #else //DESKTOP_VERSION mText += "<a href=\"uid:organizer\">"; mText += event->organizer(); mText += "</a>\n"; #endif //DESKTOP_VERSION #else mText.append(event->organizer()); #endif if (iconPath) { mText += " <a href=\"mailto:" + event->organizer() + "\">"; mText += "<IMG src=\"" + iconPath + "\">"; mText += "</a>\n"; } mText.append("</li></ul>"); addTag("h3",i18n("Attendees")); Attendee *a; mText.append("<ul>"); int a_count = 0; int a_count_nr = 0; for(a=attendees.first();a;a=attendees.next()) { #ifndef KORG_NOKABC #ifdef DESKTOP_VERSION if (a->name().isEmpty()) { addressList = add_book->findByEmail(a->email()); KABC::Addressee o = addressList.first(); if (!o.isEmpty() && addressList.size()<2) { mText += "<a href=\"uid:" + o.uid() + "\">"; mText += o.formattedName(); mText += "</a>\n"; } else { mText += "<li>"; mText.append(a->email()); mText += "\n"; } } else { mText += "<li><a href=\"uid:" + a->uid() + "\">"; if (!a->name().isEmpty()) mText += a->name(); else mText += a->email(); mText += "</a>\n"; } #else //DESKTOP_VERSION mText += "<li><a href=\"uid:" + a->uid() + "\">"; if (!a->name().isEmpty()) mText += a->name(); else mText += a->email(); mText += "</a>\n"; #endif //DESKTOP_VERSION #else //qDebug("nokabc "); 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() + ">:" + mMailSubject + "\">"; if ( a->RSVP() ) { ++a_count_nr; mText += "<IMG src=\"" + iconPath + "\">"; } else { |