author | zautrix <zautrix> | 2005-10-29 16:39:40 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-29 16:39:40 (UTC) |
commit | 898dbabef6d747447999add46201315d04f85f63 (patch) (side-by-side diff) | |
tree | fb247cbbd99ca6918400547e16484a58a8ba1523 | |
parent | 1360f8e3b5da58b561f868643d2d5f04b874cee7 (diff) | |
download | kdepimpi-898dbabef6d747447999add46201315d04f85f63.zip kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.gz kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.bz2 |
commit
-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 | 109 |
5 files changed, 124 insertions, 24 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index aae923c..5c24acf 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp @@ -140,7 +140,9 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) #endif QString name = mAddressee.realName(); - + QString assName = mAddressee.assembledName(); + if ( assName.isEmpty() ) + assName = name; QString dynamicPart; dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); @@ -154,7 +156,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) .arg( type ) - .arg( name ) + .arg( assName ) .arg( *emailIt ) .arg( *emailIt ); ++emailIt; diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 976ee2c..02b54da 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -57,9 +57,9 @@ #include <qpainter.h> #include <qpaintdevicemetrics.h> #else //DESKTOP_VERSION -#include <externalapphandler.h> #include <qtopia/qcopenvelope_qws.h> #endif //DESKTOP_VERSION +#include <externalapphandler.h> KOEventViewer::KOEventViewer(QWidget *parent,const char *name) : QTextBrowser(parent,name) @@ -173,16 +173,17 @@ void KOEventViewer::setSource(const QString& n) #endif if ( n.left(6) == "mailto" ) { // qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1()); -#ifndef DESKTOP_VERSION + //#ifndef DESKTOP_VERSION if ( n.mid(7,3) == "ALL" ) { mailToAttendees( true ); } else if ( n.mid(7,4) == "RSVP" ) { mailToAttendees( false ); } else { - QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); - e << n.mid(7); + ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); + //QCopEnvelope e("QPE/Application/ompi", "newMail(QString)" ); + //e << n.mid(7); } -#endif + //#endif } @@ -239,14 +240,21 @@ void KOEventViewer::mailToAttendees( bool all ) for(a=attendees.first();a;a=attendees.next()) { if ( !all && !a->RSVP() ) continue; if (!a->email().isEmpty()) { - nameList.append (a->name() ); +#ifndef DESKTOP_VERSION + nameList.append (a->realName() ); emailList.append (a->email() ); uidList.append (a->uid() ); +#else + emailList.append(a->realName() +" <" + a->email() +">"); +#endif } } - QString uid = "ComposeMailUIpick2"+mMailSubject; #ifndef DESKTOP_VERSION + QString uid = "ComposeMailUIpick2"+mMailSubject; bool res = ExternalAppHandler::instance()->returnNameEmailUidListFromKAPI("QPE/Application/ompi", uid, nameList, emailList, uidList); + +#else + ExternalAppHandler::instance()->mailToMultipleContacts( emailList.join(","), mMailSubject ); #endif } @@ -670,7 +678,7 @@ void KOEventViewer::formatAttendees(Incidence *event) if (!a->email().isEmpty()) { if (iconPath) { - mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">"; + mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">"; if ( a->RSVP() ) { ++a_count_nr; mText += "<IMG src=\"" + iconPath + "\">"; diff --git a/libkcal/person.cpp b/libkcal/person.cpp index aca28c2..858805d 100644 --- a/libkcal/person.cpp +++ b/libkcal/person.cpp @@ -49,7 +49,13 @@ bool KCal::operator==( const Person& p1, const Person& p2 ) p1.email() == p2.email() ); } - +QString Person::realName() const +{ + int ccc = mName.find (','); + if ( ccc < 0 ) + return mName; + return mName.mid( ccc+1 ).stripWhiteSpace() + " " + mName.left( ccc ).stripWhiteSpace(); +} QString Person::fullName() const { if( mName.isEmpty() ) { diff --git a/libkcal/person.h b/libkcal/person.h index c46c5f0..3cec153 100644 --- a/libkcal/person.h +++ b/libkcal/person.h @@ -35,6 +35,7 @@ class Person void setName(const QString &); QString name() const { return mName; } + QString realName() const; void setEmail(const QString &); QString email() const { return mEmail; } diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 2ce6926..edefda4 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -39,6 +39,7 @@ $Id$ #include <qtopia/qcopenvelope_qws.h> #else #include <qapplication.h> +#include <qprocess.h> #endif #include <kstaticdeleter.h> @@ -434,6 +435,25 @@ void ExternalAppHandler::loadConfig() addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); +#ifdef DESKTOP_VERSION + QString appPath; +#ifdef _WIN32_ + appPath = "C:\\Programme\\Mozilla Thunderbird\\thunderbird.exe"; +#else + appPath = "/usr/bin/thunderbird"; +#endif + addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "Mozilla Thunderbird", appPath, "-compose", "to=%1 <%2>", ",", "subject=%1"); + +#ifdef _WIN32_ + appPath = "C:\\Programme\\Mozilla\\mozilla.exe"; +#else + appPath = "/usr/bin/mozilla"; +#endif + addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Mozilla Suite", appPath, "-mail -compose", "to=%1 <%2>", ",", "subject=%1"); + + + +#else if (( QFile::exists( qtopiapath + "/bin/ompi" )) || ( QFile::exists( opiepath + "/bin/ompi" )) || ( QFile::exists( qtpath + "/bin/ompi" ))) @@ -448,7 +468,7 @@ void ExternalAppHandler::loadConfig() if ( QFile::exists( opiepath + "/bin/mailit" )) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); - +#endif //phoneclients @@ -528,7 +548,7 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) bool ExternalAppHandler::isEmailAppAvailable() { -#ifndef DESKTOP_VERSION + if (mEmailAppAvailable == UNDEFINED) { int client = KPimGlobalPrefs::instance()->mEmailClient; @@ -539,9 +559,6 @@ bool ExternalAppHandler::isEmailAppAvailable() } return (mEmailAppAvailable == AVAILABLE); -#else //DESKTOP_VERSION - return false; -#endif //DESKTOP_VERSION } bool ExternalAppHandler::isSMSAppAvailable() @@ -688,7 +705,61 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS #else - KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); + //qDebug("mtmc %s %s ", emails.latin1(), urls.latin1()); + + QString channel; + QString message2; + QString parameters2; + QString message; + QString parameters; + + + int client = KPimGlobalPrefs::instance()->mEmailClient; + if (client == KPimGlobalPrefs::OTHER_EMC) + { + channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; + message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; + parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; + } + else + { + DefaultAppItem* dai = getDefaultItem(EMAIL, client); + if (!dai) + { + qDebug("could not find configured email application."); + return false; + } + channel = dai->_channel; + message2 = dai->_message2; + parameters2 = dai->_parameters2; + message = dai->_message; + parameters = dai->_parameters; + } + + //first check if one of the mailers need the emails right in the message. + message2 = translateMessage(message2, emails, urls); +#ifdef DEBUG_EXT_APP_HANDLER + qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); + qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); +#endif + qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); + //KMessageBox::sorry( 0, message2 ); + QProcess * proc = new QProcess( this ); + QStringList list = QStringList::split( " ", message ); + int i = 0; + proc->addArgument( channel ); + while ( i < list.count ( ) ) { + //qDebug("add%sdd ",list[i].stripWhiteSpace().latin1() ); + proc->addArgument( list[i].stripWhiteSpace() ); + ++i; + } + parameters2 = translateMessage(parameters2, urls, "" ); + QString arg = "to='%1'"; + arg = arg.arg( emails ) + ","+parameters2;; + + //qDebug("2add%sdd ",arg.latin1() ); + proc->addArgument( arg); + proc->launch(""); #endif return true; @@ -702,7 +773,7 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS //calls the emailapplication and creates a mail with parameter emails as recipients bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) { -#ifndef DESKTOP_VERSION + QString channel; QString message; QString parameters; @@ -728,27 +799,39 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e parameters = dai->_parameters; } - +#ifdef DESKTOP_VERSION + //message = channel + " " +message + " \""+ parameters + "\""; +#endif //first check if one of the mailers need the emails right in the message. message = translateMessage(message, name, emailadress); - #ifdef DEBUG_EXT_APP_HANDLER qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); #endif +#ifndef DESKTOP_VERSION QCopEnvelope e(channel.latin1(), message.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters, name, emailadress); +#else // DESKTOP_VERSION - -#else - KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); + //KMessageBox::sorry( 0, message ); + QProcess * proc = new QProcess( this ); + QStringList list = QStringList::split( " ", message ); + int i = 0; + proc->addArgument( channel ); + while ( i < list.count ( ) ) { + //qDebug("add%sdd ",list[i].latin1() ); + proc->addArgument( list[i] ); + ++i; + } + parameters = translateMessage(parameters, name, emailadress); + proc->addArgument( parameters ); + proc->launch(""); #endif - return true; } |