-rw-r--r-- | kabc/addresseeview.cpp | 6 | ||||
-rw-r--r-- | korganizer/koeventviewer.cpp | 24 | ||||
-rw-r--r-- | libkcal/person.cpp | 8 | ||||
-rw-r--r-- | libkcal/person.h | 1 | ||||
-rw-r--r-- | libkdepim/externalapphandler.cpp | 111 |
5 files changed, 125 insertions, 25 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index aae923c..5c24acf 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -139,9 +139,11 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
139 | mAddressee.formattedName() : mAddressee.assembledName() ); | 139 | mAddressee.formattedName() : mAddressee.assembledName() ); |
140 | #endif | 140 | #endif |
141 | 141 | ||
142 | QString name = mAddressee.realName(); | 142 | QString name = mAddressee.realName(); |
143 | 143 | QString assName = mAddressee.assembledName(); | |
144 | if ( assName.isEmpty() ) | ||
145 | assName = name; | ||
144 | QString dynamicPart; | 146 | QString dynamicPart; |
145 | 147 | ||
146 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); | 148 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); |
147 | QStringList emails = mAddressee.emails(); | 149 | QStringList emails = mAddressee.emails(); |
@@ -153,9 +155,9 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | |||
153 | dynamicPart += QString( | 155 | dynamicPart += QString( |
154 | "<tr><td align=\"right\"><b>%1</b></td>" | 156 | "<tr><td align=\"right\"><b>%1</b></td>" |
155 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 157 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
156 | .arg( type ) | 158 | .arg( type ) |
157 | .arg( name ) | 159 | .arg( assName ) |
158 | .arg( *emailIt ) | 160 | .arg( *emailIt ) |
159 | .arg( *emailIt ); | 161 | .arg( *emailIt ); |
160 | ++emailIt; | 162 | ++emailIt; |
161 | } else { | 163 | } else { |
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 976ee2c..02b54da 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp | |||
@@ -56,11 +56,11 @@ | |||
56 | #include <qprinter.h> | 56 | #include <qprinter.h> |
57 | #include <qpainter.h> | 57 | #include <qpainter.h> |
58 | #include <qpaintdevicemetrics.h> | 58 | #include <qpaintdevicemetrics.h> |
59 | #else //DESKTOP_VERSION | 59 | #else //DESKTOP_VERSION |
60 | #include <externalapphandler.h> | ||
61 | #include <qtopia/qcopenvelope_qws.h> | 60 | #include <qtopia/qcopenvelope_qws.h> |
62 | #endif //DESKTOP_VERSION | 61 | #endif //DESKTOP_VERSION |
62 | #include <externalapphandler.h> | ||
63 | 63 | ||
64 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) | 64 | KOEventViewer::KOEventViewer(QWidget *parent,const char *name) |
65 | : QTextBrowser(parent,name) | 65 | : QTextBrowser(parent,name) |
66 | { | 66 | { |
@@ -172,18 +172,19 @@ void KOEventViewer::setSource(const QString& n) | |||
172 | //QString uid = "uid:"+(*it).uid(); | 172 | //QString uid = "uid:"+(*it).uid(); |
173 | #endif | 173 | #endif |
174 | if ( n.left(6) == "mailto" ) { | 174 | if ( n.left(6) == "mailto" ) { |
175 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); | 175 | // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); |
176 | #ifndef DESKTOP_VERSION | 176 | //#ifndef DESKTOP_VERSION |
177 | if ( n.mid(7,3) == "ALL" ) { | 177 | if ( n.mid(7,3) == "ALL" ) { |
178 | mailToAttendees( true ); | 178 | mailToAttendees( true ); |
179 | } else if ( n.mid(7,4) == "RSVP" ) { | 179 | } else if ( n.mid(7,4) == "RSVP" ) { |
180 | mailToAttendees( false ); | 180 | mailToAttendees( false ); |
181 | } else { | 181 | } else { |
182 | QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); | 182 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
183 | e << n.mid(7); | 183 | //QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); |
184 | //e << n.mid(7); | ||
184 | } | 185 | } |
185 | #endif | 186 | //#endif |
186 | 187 | ||
187 | } | 188 | } |
188 | 189 | ||
189 | 190 | ||
@@ -238,16 +239,23 @@ void KOEventViewer::mailToAttendees( bool all ) | |||
238 | Attendee* a; | 239 | Attendee* a; |
239 | for(a=attendees.first();a;a=attendees.next()) { | 240 | for(a=attendees.first();a;a=attendees.next()) { |
240 | if ( !all && !a->RSVP() ) continue; | 241 | if ( !all && !a->RSVP() ) continue; |
241 | if (!a->email().isEmpty()) { | 242 | if (!a->email().isEmpty()) { |
242 | nameList.append (a->name() ); | 243 | #ifndef DESKTOP_VERSION |
244 | nameList.append (a->realName() ); | ||
243 | emailList.append (a->email() ); | 245 | emailList.append (a->email() ); |
244 | uidList.append (a->uid() ); | 246 | uidList.append (a->uid() ); |
247 | #else | ||
248 | emailList.append(a->realName() +" <" + a->email() +">"); | ||
249 | #endif | ||
245 | } | 250 | } |
246 | } | 251 | } |
247 | QString uid = "ComposeMailUIpick2"+mMailSubject; | ||
248 | #ifndef DESKTOP_VERSION | 252 | #ifndef DESKTOP_VERSION |
253 | QString uid = "ComposeMailUIpick2"+mMailSubject; | ||
249 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); | 254 | bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); |
255 | |||
256 | #else | ||
257 | ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject ); | ||
250 | #endif | 258 | #endif |
251 | 259 | ||
252 | } | 260 | } |
253 | void KOEventViewer::addTag(const QString & tag,const QString & text) | 261 | void KOEventViewer::addTag(const QString & tag,const QString & text) |
@@ -669,9 +677,9 @@ void KOEventViewer::formatAttendees(Incidence *event) | |||
669 | 677 | ||
670 | 678 | ||
671 | if (!a->email().isEmpty()) { | 679 | if (!a->email().isEmpty()) { |
672 | if (iconPath) { | 680 | if (iconPath) { |
673 | mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; | 681 | mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">"; |
674 | if ( a->RSVP() ) { | 682 | if ( a->RSVP() ) { |
675 | ++a_count_nr; | 683 | ++a_count_nr; |
676 | mText += "<IMG src=\"" + iconPath + "\">"; | 684 | mText += "<IMG src=\"" + iconPath + "\">"; |
677 | } | 685 | } |
diff --git a/libkcal/person.cpp b/libkcal/person.cpp index aca28c2..858805d 100644 --- a/libkcal/person.cpp +++ b/libkcal/person.cpp | |||
@@ -48,9 +48,15 @@ bool KCal::operator==( const Person& p1, const Person& p2 ) | |||
48 | return ( p1.name() == p2.name() && | 48 | return ( p1.name() == p2.name() && |
49 | p1.email() == p2.email() ); | 49 | p1.email() == p2.email() ); |
50 | } | 50 | } |
51 | 51 | ||
52 | 52 | QString Person::realName() const | |
53 | { | ||
54 | int ccc = mName.find (','); | ||
55 | if ( ccc < 0 ) | ||
56 | return mName; | ||
57 | return mName.mid( ccc+1 ).stripWhiteSpace() + " " + mName.left( ccc ).stripWhiteSpace(); | ||
58 | } | ||
53 | QString Person::fullName() const | 59 | QString Person::fullName() const |
54 | { | 60 | { |
55 | if( mName.isEmpty() ) { | 61 | if( mName.isEmpty() ) { |
56 | return mEmail; | 62 | return mEmail; |
diff --git a/libkcal/person.h b/libkcal/person.h index c46c5f0..3cec153 100644 --- a/libkcal/person.h +++ b/libkcal/person.h | |||
@@ -34,8 +34,9 @@ class Person | |||
34 | QString fullName( ) const; | 34 | QString fullName( ) const; |
35 | 35 | ||
36 | void setName(const QString &); | 36 | void setName(const QString &); |
37 | QString name() const { return mName; } | 37 | QString name() const { return mName; } |
38 | QString realName() const; | ||
38 | 39 | ||
39 | void setEmail(const QString &); | 40 | void setEmail(const QString &); |
40 | QString email() const { return mEmail; } | 41 | QString email() const { return mEmail; } |
41 | 42 | ||
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 2ce6926..edefda4 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -38,8 +38,9 @@ $Id$ | |||
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include <qtopia/qcopenvelope_qws.h> | 39 | #include <qtopia/qcopenvelope_qws.h> |
40 | #else | 40 | #else |
41 | #include <qapplication.h> | 41 | #include <qapplication.h> |
42 | #include <qprocess.h> | ||
42 | #endif | 43 | #endif |
43 | 44 | ||
44 | #include <kstaticdeleter.h> | 45 | #include <kstaticdeleter.h> |
45 | #include <kmessagebox.h> | 46 | #include <kmessagebox.h> |
@@ -433,8 +434,27 @@ void ExternalAppHandler::loadConfig() | |||
433 | 434 | ||
434 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 435 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
435 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 436 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
436 | 437 | ||
438 | #ifdef DESKTOP_VERSION | ||
439 | QString appPath; | ||
440 | #ifdef _WIN32_ | ||
441 | appPath = "C:\\Programme\\Mozilla Thunderbird\\thunderbird.exe"; | ||
442 | #else | ||
443 | appPath = "/usr/bin/thunderbird"; | ||
444 | #endif | ||
445 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "Mozilla Thunderbird", appPath, "-compose", "to=%1 <%2>", ",", "subject=%1"); | ||
446 | |||
447 | #ifdef _WIN32_ | ||
448 | appPath = "C:\\Programme\\Mozilla\\mozilla.exe"; | ||
449 | #else | ||
450 | appPath = "/usr/bin/mozilla"; | ||
451 | #endif | ||
452 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Mozilla Suite", appPath, "-mail -compose", "to=%1 <%2>", ",", "subject=%1"); | ||
453 | |||
454 | |||
455 | |||
456 | #else | ||
437 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 457 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
438 | ( QFile::exists( opiepath + "/bin/ompi" )) || | 458 | ( QFile::exists( opiepath + "/bin/ompi" )) || |
439 | ( QFile::exists( qtpath + "/bin/ompi" ))) | 459 | ( QFile::exists( qtpath + "/bin/ompi" ))) |
440 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 460 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
@@ -447,9 +467,9 @@ void ExternalAppHandler::loadConfig() | |||
447 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 467 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
448 | 468 | ||
449 | if ( QFile::exists( opiepath + "/bin/mailit" )) | 469 | if ( QFile::exists( opiepath + "/bin/mailit" )) |
450 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 470 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
451 | 471 | #endif | |
452 | 472 | ||
453 | 473 | ||
454 | //phoneclients | 474 | //phoneclients |
455 | 475 | ||
@@ -527,9 +547,9 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | |||
527 | } | 547 | } |
528 | 548 | ||
529 | bool ExternalAppHandler::isEmailAppAvailable() | 549 | bool ExternalAppHandler::isEmailAppAvailable() |
530 | { | 550 | { |
531 | #ifndef DESKTOP_VERSION | 551 | |
532 | if (mEmailAppAvailable == UNDEFINED) | 552 | if (mEmailAppAvailable == UNDEFINED) |
533 | { | 553 | { |
534 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 554 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
535 | if (client == KPimGlobalPrefs::NONE_EMC) | 555 | if (client == KPimGlobalPrefs::NONE_EMC) |
@@ -538,11 +558,8 @@ bool ExternalAppHandler::isEmailAppAvailable() | |||
538 | mEmailAppAvailable = AVAILABLE; | 558 | mEmailAppAvailable = AVAILABLE; |
539 | } | 559 | } |
540 | return (mEmailAppAvailable == AVAILABLE); | 560 | return (mEmailAppAvailable == AVAILABLE); |
541 | 561 | ||
542 | #else //DESKTOP_VERSION | ||
543 | return false; | ||
544 | #endif //DESKTOP_VERSION | ||
545 | } | 562 | } |
546 | 563 | ||
547 | bool ExternalAppHandler::isSMSAppAvailable() | 564 | bool ExternalAppHandler::isSMSAppAvailable() |
548 | { | 565 | { |
@@ -687,9 +704,63 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
687 | 704 | ||
688 | 705 | ||
689 | 706 | ||
690 | #else | 707 | #else |
691 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 708 | //qDebug("mtmc %s %s ", emails.latin1(), urls.latin1()); |
709 | |||
710 | QString channel; | ||
711 | QString message2; | ||
712 | QString parameters2; | ||
713 | QString message; | ||
714 | QString parameters; | ||
715 | |||
716 | |||
717 | int client = KPimGlobalPrefs::instance()->mEmailClient; | ||
718 | if (client == KPimGlobalPrefs::OTHER_EMC) | ||
719 | { | ||
720 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | ||
721 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | ||
722 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | ||
723 | } | ||
724 | else | ||
725 | { | ||
726 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | ||
727 | if (!dai) | ||
728 | { | ||
729 | qDebug("could not find configured email application."); | ||
730 | return false; | ||
731 | } | ||
732 | channel = dai->_channel; | ||
733 | message2 = dai->_message2; | ||
734 | parameters2 = dai->_parameters2; | ||
735 | message = dai->_message; | ||
736 | parameters = dai->_parameters; | ||
737 | } | ||
738 | |||
739 | //first check if one of the mailers need the emails right in the message. | ||
740 | message2 = translateMessage(message2, emails, urls); | ||
741 | #ifdef DEBUG_EXT_APP_HANDLER | ||
742 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | ||
743 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | ||
744 | #endif | ||
745 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); | ||
746 | //KMessageBox::sorry( 0, message2 ); | ||
747 | QProcess * proc = new QProcess( this ); | ||
748 | QStringList list = QStringList::split( " ", message ); | ||
749 | int i = 0; | ||
750 | proc->addArgument( channel ); | ||
751 | while ( i < list.count ( ) ) { | ||
752 | //qDebug("add%sdd ",list[i].stripWhiteSpace().latin1() ); | ||
753 | proc->addArgument( list[i].stripWhiteSpace() ); | ||
754 | ++i; | ||
755 | } | ||
756 | parameters2 = translateMessage(parameters2, urls, "" ); | ||
757 | QString arg = "to='%1'"; | ||
758 | arg = arg.arg( emails ) + ","+parameters2;; | ||
759 | |||
760 | //qDebug("2add%sdd ",arg.latin1() ); | ||
761 | proc->addArgument( arg); | ||
762 | proc->launch(""); | ||
692 | #endif | 763 | #endif |
693 | 764 | ||
694 | return true; | 765 | return true; |
695 | } | 766 | } |
@@ -701,9 +772,9 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
701 | 772 | ||
702 | //calls the emailapplication and creates a mail with parameter emails as recipients | 773 | //calls the emailapplication and creates a mail with parameter emails as recipients |
703 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 774 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
704 | { | 775 | { |
705 | #ifndef DESKTOP_VERSION | 776 | |
706 | QString channel; | 777 | QString channel; |
707 | QString message; | 778 | QString message; |
708 | QString parameters; | 779 | QString parameters; |
709 | 780 | ||
@@ -727,29 +798,41 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e | |||
727 | message = dai->_message; | 798 | message = dai->_message; |
728 | parameters = dai->_parameters; | 799 | parameters = dai->_parameters; |
729 | } | 800 | } |
730 | 801 | ||
731 | 802 | #ifdef DESKTOP_VERSION | |
803 | //message = channel + " " +message + " \""+ parameters + "\""; | ||
804 | #endif | ||
732 | //first check if one of the mailers need the emails right in the message. | 805 | //first check if one of the mailers need the emails right in the message. |
733 | message = translateMessage(message, name, emailadress); | 806 | message = translateMessage(message, name, emailadress); |
734 | 807 | ||
735 | |||
736 | #ifdef DEBUG_EXT_APP_HANDLER | 808 | #ifdef DEBUG_EXT_APP_HANDLER |
737 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 809 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
738 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 810 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
739 | #endif | 811 | #endif |
740 | 812 | ||
813 | #ifndef DESKTOP_VERSION | ||
741 | QCopEnvelope e(channel.latin1(), message.latin1()); | 814 | QCopEnvelope e(channel.latin1(), message.latin1()); |
742 | //US we need no names in the To field. The emailadresses are enough | 815 | //US we need no names in the To field. The emailadresses are enough |
743 | 816 | ||
744 | passParameters(&e, parameters, name, emailadress); | 817 | passParameters(&e, parameters, name, emailadress); |
745 | 818 | #else // DESKTOP_VERSION | |
746 | 819 | ||
747 | #else | 820 | //KMessageBox::sorry( 0, message ); |
748 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 821 | QProcess * proc = new QProcess( this ); |
822 | QStringList list = QStringList::split( " ", message ); | ||
823 | int i = 0; | ||
824 | proc->addArgument( channel ); | ||
825 | while ( i < list.count ( ) ) { | ||
826 | //qDebug("add%sdd ",list[i].latin1() ); | ||
827 | proc->addArgument( list[i] ); | ||
828 | ++i; | ||
829 | } | ||
830 | parameters = translateMessage(parameters, name, emailadress); | ||
831 | proc->addArgument( parameters ); | ||
832 | proc->launch(""); | ||
749 | #endif | 833 | #endif |
750 | 834 | ||
751 | |||
752 | return true; | 835 | return true; |
753 | } | 836 | } |
754 | 837 | ||
755 | /************************************************************************** | 838 | /************************************************************************** |