-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 | |||
@@ -117,26 +117,34 @@ void KOEventViewer::setSource(const QString& n) | |||
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); | 122 | //requestNameEmailUidListFromKAPI("QPE/Application/kopi", this->name() /* name is here the unique uid*/); |
123 | // the result should now arrive through method insertAttendees | 123 | // the result should now arrive through method insertAttendees |
124 | //QString uid = "uid:"+(*it).uid(); | 124 | //QString uid = "uid:"+(*it).uid(); |
125 | #endif | 125 | #endif |
126 | if ( n.left(6) == "mailto" ) { | 126 | if ( n.left(6) == "mailto" ) { |
127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 127 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
128 | #ifndef DESKTOP_VERSION | 128 | #ifndef DESKTOP_VERSION |
129 | if ( n.mid(7,3) == "ALL" ) { | ||
130 | qDebug("all "); | ||
131 | mailToAttendees( true ); | ||
132 | } else if ( n.mid(7,4) == "RSVP" ) { | ||
133 | mailToAttendees( false ); | ||
134 | qDebug("rsvp "); | ||
135 | } else { | ||
129 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 136 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
130 | e << n.mid(7); | 137 | e << n.mid(7); |
138 | } | ||
131 | #endif | 139 | #endif |
132 | 140 | ||
133 | } | 141 | } |
134 | 142 | ||
135 | 143 | ||
136 | #ifndef KORG_NODCOP | 144 | #ifndef KORG_NODCOP |
137 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; | 145 | kdDebug() << "KOEventViewer::setSource(): " << n << endl; |
138 | QString tmpStr; | 146 | QString tmpStr; |
139 | if (n.startsWith("mailto:")) { | 147 | if (n.startsWith("mailto:")) { |
140 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); | 148 | KApplication::kApplication()->invokeMailer(n.mid(7),QString::null); |
141 | //emit showIncidence(n); | 149 | //emit showIncidence(n); |
142 | return; | 150 | return; |
@@ -165,25 +173,44 @@ void KOEventViewer::setSource(const QString& n) | |||
165 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); | 173 | QString iconPath = iconLoader->iconPath("go",KIcon::Small); |
166 | ActionManager::setStartedKAddressBook(true); | 174 | ActionManager::setStartedKAddressBook(true); |
167 | tmpStr = "kaddressbook --editor-only --uid "; | 175 | tmpStr = "kaddressbook --editor-only --uid "; |
168 | tmpStr += KProcess::quote(n.mid(6)); | 176 | tmpStr += KProcess::quote(n.mid(6)); |
169 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); | 177 | KRun::runCommand(tmpStr,"KAddressBook",iconPath); |
170 | return; | 178 | return; |
171 | } | 179 | } |
172 | } else { | 180 | } else { |
173 | //QTextBrowser::setSource(n); | 181 | //QTextBrowser::setSource(n); |
174 | } | 182 | } |
175 | #endif | 183 | #endif |
176 | } | 184 | } |
185 | void KOEventViewer::mailToAttendees( bool all ) | ||
186 | { | ||
187 | QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); | ||
188 | if (attendees.count() == 0) return; | ||
189 | QStringList nameList; | ||
190 | QStringList emailList; | ||
191 | QStringList uidList; | ||
192 | Attendee* a; | ||
193 | for(a=attendees.first();a;a=attendees.next()) { | ||
194 | if ( !all && !a->RSVP() ) continue; | ||
195 | if (!a->email().isEmpty()) { | ||
196 | nameList.append (a->name() ); | ||
197 | emailList.append (a->email() ); | ||
198 | uidList.append (a->uid() ); | ||
199 | } | ||
200 | } | ||
201 | QString uid = "ComposeMailUIpick2"+mMailSubject; | ||
202 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | ||
177 | 203 | ||
204 | } | ||
178 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 205 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
179 | { | 206 | { |
180 | int number=text.contains("\n"); | 207 | int number=text.contains("\n"); |
181 | QString str = "<" + tag + ">"; | 208 | QString str = "<" + tag + ">"; |
182 | QString tmpText=text; | 209 | QString tmpText=text; |
183 | QString tmpStr=str; | 210 | QString tmpStr=str; |
184 | if(number !=-1) | 211 | if(number !=-1) |
185 | { | 212 | { |
186 | if (number > 0) { | 213 | if (number > 0) { |
187 | int pos=0; | 214 | int pos=0; |
188 | QString tmp; | 215 | QString tmp; |
189 | for(int i=0;i<=number;i++) { | 216 | for(int i=0;i<=number;i++) { |
@@ -453,24 +480,27 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
453 | #endif | 480 | #endif |
454 | 481 | ||
455 | if (iconPath) { | 482 | if (iconPath) { |
456 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; | 483 | mText += " <a href=\"mailto:" + event->organizer() + "\">"; |
457 | mText += "<IMG src=\"" + iconPath + "\">"; | 484 | mText += "<IMG src=\"" + iconPath + "\">"; |
458 | mText += "</a>\n"; | 485 | mText += "</a>\n"; |
459 | } | 486 | } |
460 | mText.append("</li></ul>"); | 487 | mText.append("</li></ul>"); |
461 | 488 | ||
462 | addTag("h3",i18n("Attendees")); | 489 | addTag("h3",i18n("Attendees")); |
463 | Attendee *a; | 490 | Attendee *a; |
464 | mText.append("<ul>"); | 491 | mText.append("<ul>"); |
492 | int a_count = 0; | ||
493 | int a_count_nr = 0; | ||
494 | |||
465 | for(a=attendees.first();a;a=attendees.next()) { | 495 | for(a=attendees.first();a;a=attendees.next()) { |
466 | #ifndef KORG_NOKABC | 496 | #ifndef KORG_NOKABC |
467 | #ifdef DESKTOP_VERSION | 497 | #ifdef DESKTOP_VERSION |
468 | if (a->name().isEmpty()) { | 498 | if (a->name().isEmpty()) { |
469 | addressList = add_book->findByEmail(a->email()); | 499 | addressList = add_book->findByEmail(a->email()); |
470 | KABC::Addressee o = addressList.first(); | 500 | KABC::Addressee o = addressList.first(); |
471 | if (!o.isEmpty() && addressList.size()<2) { | 501 | if (!o.isEmpty() && addressList.size()<2) { |
472 | mText += "<a href=\"uid:" + o.uid() + "\">"; | 502 | mText += "<a href=\"uid:" + o.uid() + "\">"; |
473 | mText += o.formattedName(); | 503 | mText += o.formattedName(); |
474 | mText += "</a>\n"; | 504 | mText += "</a>\n"; |
475 | } else { | 505 | } else { |
476 | mText += "<li>"; | 506 | mText += "<li>"; |
@@ -492,37 +522,59 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
492 | #else | 522 | #else |
493 | //qDebug("nokabc "); | 523 | //qDebug("nokabc "); |
494 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; | 524 | mText += "<li><a href=\"uid:" + a->uid() + "\">"; |
495 | if (!a->name().isEmpty()) mText += a->name(); | 525 | if (!a->name().isEmpty()) mText += a->name(); |
496 | else mText += a->email(); | 526 | else mText += a->email(); |
497 | mText += "</a>\n"; | 527 | mText += "</a>\n"; |
498 | #endif | 528 | #endif |
499 | 529 | ||
500 | 530 | ||
501 | if (!a->email().isEmpty()) { | 531 | if (!a->email().isEmpty()) { |
502 | if (iconPath) { | 532 | if (iconPath) { |
503 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 533 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
504 | if ( a->RSVP() ) | 534 | if ( a->RSVP() ) { |
535 | ++a_count; | ||
505 | mText += "<IMG src=\"" + iconPath + "\">"; | 536 | mText += "<IMG src=\"" + iconPath + "\">"; |
506 | else | 537 | } |
538 | else { | ||
539 | ++a_count_nr; | ||
507 | mText += "<IMG src=\"" + NOiconPath + "\">"; | 540 | mText += "<IMG src=\"" + NOiconPath + "\">"; |
541 | } | ||
508 | mText += "</a>\n"; | 542 | mText += "</a>\n"; |
509 | } | 543 | } |
510 | } | 544 | } |
511 | if (a->status() != Attendee::NeedsAction ) | 545 | if (a->status() != Attendee::NeedsAction ) |
512 | mText +="[" + a->statusStr() + "] "; | 546 | mText +="[" + a->statusStr() + "] "; |
513 | if (a->role() == Attendee::Chair ) | 547 | if (a->role() == Attendee::Chair ) |
514 | mText +="(" + a->roleStr().left(1) + ".)"; | 548 | mText +="(" + a->roleStr().left(1) + ".)"; |
515 | } | 549 | } |
516 | mText.append("</li></ul>"); | 550 | mText.append("</li></ul>"); |
551 | if ( a_count > 1 ) { | ||
552 | mText += "<a href=\"mailto:ALL\">"; | ||
553 | mText += i18n( "Mail to all" ); | ||
554 | mText += "</a> ( "; | ||
555 | mText += "<IMG src=\"" + iconPath + "\">"; | ||
556 | mText += i18n( " and " ); | ||
557 | mText += "<IMG src=\"" + NOiconPath + "\"> )"; | ||
558 | mText += "<br>\n"; | ||
559 | |||
560 | |||
561 | } | ||
562 | if ( a_count_nr > 1 ) { | ||
563 | mText += "<a href=\"mailto:RSVP\">"; | ||
564 | mText += i18n( "Mail to selected" ); | ||
565 | mText += "</a> ( "; | ||
566 | mText += i18n( "<IMG src=\"%1\"> only )").arg ( iconPath ); | ||
567 | mText += "\n"; | ||
568 | } | ||
517 | } | 569 | } |
518 | 570 | ||
519 | } | 571 | } |
520 | void KOEventViewer::appendJournal(Journal *jour, int mode ) | 572 | void KOEventViewer::appendJournal(Journal *jour, int mode ) |
521 | { | 573 | { |
522 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; | 574 | bool shortDate = KOPrefs::instance()->mShortDateInViewer; |
523 | if (mode == 0 ) { | 575 | if (mode == 0 ) { |
524 | addTag("h2",i18n("Journal from: ")); | 576 | addTag("h2",i18n("Journal from: ")); |
525 | } | 577 | } |
526 | else { | 578 | else { |
527 | if ( mode == 1 ) { | 579 | if ( mode == 1 ) { |
528 | addTag("h2",i18n( "Local: " ) +i18n("Journal from: ")); | 580 | 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,33 +42,34 @@ class KOEventViewer : public QTextBrowser { | |||
42 | void setTodo(Todo *event, bool clearV = true ); | 42 | void setTodo(Todo *event, bool clearV = true ); |
43 | void setJournal(Journal *jour, bool clearV = true ); | 43 | void setJournal(Journal *jour, bool clearV = true ); |
44 | 44 | ||
45 | void appendEvent(Event *event, int mode = 0 ); | 45 | void appendEvent(Event *event, int mode = 0 ); |
46 | void appendTodo(Todo *event, int mode = 0 ); | 46 | void appendTodo(Todo *event, int mode = 0 ); |
47 | void appendJournal(Journal *jour, int mode = 0 ); | 47 | void appendJournal(Journal *jour, int mode = 0 ); |
48 | 48 | ||
49 | void clearEvents(bool now=false); | 49 | void clearEvents(bool now=false); |
50 | 50 | ||
51 | void addText(QString text); | 51 | void addText(QString text); |
52 | void setSyncMode( bool ); | 52 | void setSyncMode( bool ); |
53 | void setColorMode( int ); | 53 | void setColorMode( int ); |
54 | void mailToAttendees( bool all ); | ||
54 | 55 | ||
55 | protected: | 56 | protected: |
56 | int mColorMode; | 57 | int mColorMode; |
57 | void addTag(const QString & tag,const QString & text); | 58 | void addTag(const QString & tag,const QString & text); |
58 | 59 | ||
59 | void formatCategories(Incidence *event); | 60 | void formatCategories(Incidence *event); |
60 | void formatAttendees(Incidence *event); | 61 | void formatAttendees(Incidence *event); |
61 | void formatReadOnly(Incidence *event); | 62 | void formatReadOnly(Incidence *event); |
62 | 63 | ||
63 | private: | 64 | private: |
64 | QTextBrowser *mEventTextView; | 65 | QTextBrowser *mEventTextView; |
65 | bool mSyncMode; | 66 | bool mSyncMode; |
66 | 67 | ||
67 | QString mText; | 68 | QString mText; |
68 | QString mMailSubject; | 69 | QString mMailSubject; |
69 | Incidence* mCurrentIncidence; | 70 | Incidence* mCurrentIncidence; |
70 | signals: | 71 | signals: |
71 | void launchaddressbook(QString uid); | 72 | void launchaddressbook(QString uid); |
72 | }; | 73 | }; |
73 | 74 | ||
74 | #endif | 75 | #endif |