summaryrefslogtreecommitdiffabout
path: root/korganizer
authorzautrix <zautrix>2005-02-04 10:23:55 (UTC)
committer zautrix <zautrix>2005-02-04 10:23:55 (UTC)
commit83256090c493dab56f1afba4829e864598bf70d2 (patch) (side-by-side diff)
tree8d5b7ee0c6fe42f0f14c53b80c924ccddd5a1599 /korganizer
parenta96872e5ecff3a8fb1785aff71f5f7f150ef8604 (diff)
downloadkdepimpi-83256090c493dab56f1afba4829e864598bf70d2.zip
kdepimpi-83256090c493dab56f1afba4829e864598bf70d2.tar.gz
kdepimpi-83256090c493dab56f1afba4829e864598bf70d2.tar.bz2
mail send
Diffstat (limited to 'korganizer') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/koeventviewer.cpp56
-rw-r--r--korganizer/koeventviewer.h1
2 files changed, 55 insertions, 2 deletions
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 7dc1880..bf41edb 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -117,26 +117,34 @@ void KOEventViewer::setSource(const QString& n)
}
}
}
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" ) {
+ 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
}
#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;
@@ -165,25 +173,44 @@ void KOEventViewer::setSource(const QString& n)
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;
+ 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");
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++) {
@@ -453,24 +480,27 @@ void KOEventViewer::formatAttendees(Incidence *event)
#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>";
@@ -492,37 +522,59 @@ void KOEventViewer::formatAttendees(Incidence *event)
#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() )
+ if ( a->RSVP() ) {
+ ++a_count;
mText += "<IMG src=\"" + iconPath + "\">";
- else
+ }
+ else {
+ ++a_count_nr;
mText += "<IMG src=\"" + NOiconPath + "\">";
+ }
mText += "</a>\n";
}
}
if (a->status() != Attendee::NeedsAction )
mText +="[" + a->statusStr() + "] ";
if (a->role() == Attendee::Chair )
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";
+ }
}
}
void KOEventViewer::appendJournal(Journal *jour, int mode )
{
bool shortDate = KOPrefs::instance()->mShortDateInViewer;
if (mode == 0 ) {
addTag("h2",i18n("Journal from: "));
}
else {
if ( mode == 1 ) {
addTag("h2",i18n( "Local: " ) +i18n("Journal from: "));
diff --git a/korganizer/koeventviewer.h b/korganizer/koeventviewer.h
index 0cd3f33..cf44284 100644
--- a/korganizer/koeventviewer.h
+++ b/korganizer/koeventviewer.h
@@ -42,24 +42,25 @@ class KOEventViewer : public QTextBrowser {
void setTodo(Todo *event, bool clearV = true );
void setJournal(Journal *jour, bool clearV = true );
void appendEvent(Event *event, int mode = 0 );
void appendTodo(Todo *event, int mode = 0 );
void appendJournal(Journal *jour, int mode = 0 );
void clearEvents(bool now=false);
void addText(QString text);
void setSyncMode( bool );
void setColorMode( int );
+ void mailToAttendees( bool all );
protected:
int mColorMode;
void addTag(const QString & tag,const QString & text);
void formatCategories(Incidence *event);
void formatAttendees(Incidence *event);
void formatReadOnly(Incidence *event);
private:
QTextBrowser *mEventTextView;
bool mSyncMode;