-rw-r--r-- | korganizer/koeventviewer.cpp | 56 | ||||
-rw-r--r-- | korganizer/koeventviewer.h | 3 |
2 files changed, 56 insertions, 3 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 7dc1880..bf41edb 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -127,6 +127,14 @@ void KOEventViewer::setSource(const QString& n) // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); #ifndef DESKTOP_VERSION + if ( n.mid(7,3) == "ALL" ) { + qDebug("all "); + mailToAttendees( true ); + } else if ( n.mid(7,4) == "RSVP" ) { + mailToAttendees( false ); + qDebug("rsvp "); + } else { QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); e << n.mid(7); + } #endif @@ -175,5 +183,24 @@ void KOEventViewer::setSource(const QString& 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; + bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); +} void KOEventViewer::addTag(const QString & tag,const QString & text) { @@ -463,4 +490,7 @@ void KOEventViewer::formatAttendees(Incidence *event) 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 @@ -502,8 +532,12 @@ void KOEventViewer::formatAttendees(Incidence *event) if (iconPath) { mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; - if ( a->RSVP() ) + if ( a->RSVP() ) { + ++a_count; mText += "<IMG src=\"" + iconPath + "\">"; - else + } + else { + ++a_count_nr; mText += "<IMG src=\"" + NOiconPath + "\">"; + } mText += "</a>\n"; } @@ -515,4 +549,22 @@ void KOEventViewer::formatAttendees(Incidence *event) } mText.append("</li></ul>"); + if ( a_count > 1 ) { + mText += "<a href=\"mailto:ALL\">"; + mText += i18n( "Mail to all" ); + mText += "</a> ( "; + mText += "<IMG src=\"" + iconPath + "\">"; + mText += i18n( " and " ); + mText += "<IMG src=\"" + NOiconPath + "\"> )"; + mText += "<br>\n"; + + + } + if ( a_count_nr > 1 ) { + mText += "<a href=\"mailto:RSVP\">"; + mText += i18n( "Mail to selected" ); + mText += "</a> ( "; + mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); + mText += "\n"; + } } diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h index 0cd3f33..cf44284 100644 --- a/korganizer/koeventviewer.h +++ b/korganizer/koeventviewer.h @@ -52,4 +52,5 @@ class KOEventViewer : public QTextBrowser { void setSyncMode( bool ); void setColorMode( int ); + void mailToAttendees( bool all ); protected: @@ -67,5 +68,5 @@ class KOEventViewer : public QTextBrowser { QString mText; QString mMailSubject; - Incidence* mCurrentIncidence; + Incidence* mCurrentIncidence; signals: void launchaddressbook(QString uid); |