summaryrefslogtreecommitdiffabout
path: root/korganizer
Side-by-side diff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp56
-rw-r--r--korganizer/koeventviewer.h3
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
@@ -126,8 +126,16 @@ void KOEventViewer::setSource(const QString& n)
if ( n.left(6) == "mailto" ) {
// 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
}
@@ -174,7 +182,26 @@ 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)
{
int number=text.contains("\n");
@@ -462,6 +489,9 @@ void KOEventViewer::formatAttendees(Incidence *event)
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
@@ -501,10 +531,14 @@ void KOEventViewer::formatAttendees(Incidence *event)
if (!a->email().isEmpty()) {
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";
}
}
@@ -514,6 +548,24 @@ void KOEventViewer::formatAttendees(Incidence *event)
mText +="(" + a->roleStr().left(1) + ".)";
}
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
@@ -51,6 +51,7 @@ class KOEventViewer : public QTextBrowser {
void addText(QString text);
void setSyncMode( bool );
void setColorMode( int );
+ void mailToAttendees( bool all );
protected:
int mColorMode;
@@ -66,7 +67,7 @@ class KOEventViewer : public QTextBrowser {
QString mText;
QString mMailSubject;
- Incidence* mCurrentIncidence;
+ Incidence* mCurrentIncidence;
signals:
void launchaddressbook(QString uid);
};