-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 @@ -119,63 +119,65 @@ void AddresseeView::setSource(const QString& n) ExternalAppHandler::instance()->callBySMS( n.mid(6) ); else if ( n.left( 7 ) == "pagerto" ) ExternalAppHandler::instance()->callByPager( n.mid(8) ); else if ( n.left( 5 ) == "sipto" ) ExternalAppHandler::instance()->callBySIP( n.mid(6) ); } void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) { bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable(); // mAddressee = addr; // clear view //setText( QString::null ); mCurrentContact = mAddressee; if ( mAddressee.isEmpty() ) { setText( QString::null); return; } #if 0 QString name = ( mAddressee.assembledName().isEmpty() ? mAddressee.formattedName() : mAddressee.assembledName() ); #endif QString name = mAddressee.realName(); - + QString assName = mAddressee.assembledName(); + if ( assName.isEmpty() ) + assName = name; QString dynamicPart; dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); QStringList emails = mAddressee.emails(); QStringList::ConstIterator emailIt; QString type = i18n( "Email" ); emailIt = emails.begin(); if ( emailIt != emails.end() ) { if ( kemailAvail ) { dynamicPart += QString( "<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; } else { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( type ) .arg( *emailIt ); ++emailIt; } } if ( mAddressee.birthday().date().isValid() ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n ("Birthday") ) .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); } dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); for ( ; emailIt != emails.end(); ++emailIt ) { if ( kemailAvail ) { dynamicPart += QString( diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp index 976ee2c..02b54da 100644 --- a/korganizer/koeventviewer.cpp +++ b/korganizer/koeventviewer.cpp @@ -36,51 +36,51 @@ #include "koprefs.h" #include <kabc/stdaddressbook.h> #ifndef KORG_NODCOP #include <dcopclient.h> #include "korganizer.h" #include "koprefs.h" #include "actionmanager.h" #endif #include "koeventviewer.h" //#ifndef KORG_NOKABC //#include <kabc/stdaddressbook.h> //#define size count //#endif #ifdef DESKTOP_VERSION #include <kabc/addresseedialog.h> #include <kabc/addresseeview.h> #include <qprinter.h> #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) { mSyncMode = false; mColorMode = 0; } KOEventViewer::~KOEventViewer() { } void KOEventViewer::printMe() { #ifdef DESKTOP_VERSION KOPrintPrefs pp ( this ); if (!pp.exec() ) return; int scaleval = pp.printMode() ; QPrinter printer; if (!printer.setup() ) return; @@ -152,58 +152,59 @@ void KOEventViewer::setSource(const QString& n) #else { if ( "uid:organizer" == n ) { ExternalAppHandler::instance()->requestDetailsFromKAPI("", mCurrentIncidence->organizer(),""); return; } QPtrList<Attendee> attendees = mCurrentIncidence->attendees(); if (attendees.count()) { Attendee *a; for(a=attendees.first();a;a=attendees.next()) { if ( "uid:"+a->uid() == n ) { bool res = ExternalAppHandler::instance()->requestDetailsFromKAPI(a->name(), a->email(), a->uid()); return; } } } 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 + //#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 } #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; } else if (n.startsWith("uid:")) { DCOPClient *client = KApplication::kApplication()->dcopClient(); const QByteArray noParamData; const QByteArray paramData; QByteArray replyData; QCString replyTypeStr; #define PING_ABBROWSER (client->call("kaddressbook", "KAddressBookIface", "interfaces()", noParamData, replyTypeStr, replyData)) bool foundAbbrowser = PING_ABBROWSER; if (foundAbbrowser) { //KAddressbook is already running, so just DCOP to it to bring up the contact editor //client->send("kaddressbook","KAddressBookIface", QDataStream arg(paramData, IO_WriteOnly); @@ -218,56 +219,63 @@ void KOEventViewer::setSource(const QString& n) KIconLoader* iconLoader = new KIconLoader(); 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() ); +#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 } 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++) { pos=tmpText.find("\n"); tmp=tmpText.left(pos); tmpText=tmpText.right(tmpText.length()-pos-1); tmpStr+=tmp+"<br>"; } } else tmpStr += tmpText; tmpStr+="</" + tag + ">"; mText.append(tmpStr); @@ -649,49 +657,49 @@ void KOEventViewer::formatAttendees(Incidence *event) } } else { mText += "<li><a href=\"uid:" + a->uid() + "\">"; if (!a->name().isEmpty()) mText += a->name(); else mText += a->email(); mText += "</a>\n"; } #else //DESKTOP_VERSION mText += "<li><a href=\"uid:" + a->uid() + "\">"; if (!a->name().isEmpty()) mText += a->name(); else mText += a->email(); mText += "</a>\n"; #endif //DESKTOP_VERSION #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 + "\">"; + mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">"; if ( a->RSVP() ) { ++a_count_nr; mText += "<IMG src=\"" + iconPath + "\">"; } else { ++a_count; 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+a_count_nr) > 1 ) { mText += "<a href=\"mailto:ALL\">"; mText += i18n( "Mail to all" ); mText += "</a> ( "; mText += "<IMG src=\"" + iconPath + "\">"; mText += i18n( " and " ); mText += "<IMG src=\"" + NOiconPath + "\"> )"; diff --git a/libkcal/person.cpp b/libkcal/person.cpp index aca28c2..858805d 100644 --- a/libkcal/person.cpp +++ b/libkcal/person.cpp @@ -28,49 +28,55 @@ using namespace KCal; Person::Person( const QString &fullName ) { int emailPos = fullName.find( '<' ); if ( emailPos < 0 ) { setEmail(fullName); } else { setEmail(fullName.mid( emailPos + 1, fullName.length() - 1 )); setName(fullName.left( emailPos - 2 )); } } Person::Person( const QString &name, const QString &email ) { setName(name); setEmail(email); } bool KCal::operator==( const Person& p1, const Person& p2 ) { return ( p1.name() == p2.name() && 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() ) { return mEmail; } else { if( mEmail.isEmpty() ) return mName; else return mName + " <" + mEmail + ">"; } } void Person::setName(const QString &name) { mName = name; } void Person::setEmail(const QString &email) { if (email.left(7).lower() == "mailto:") { mEmail = email.mid(7); } else { mEmail = email; } diff --git a/libkcal/person.h b/libkcal/person.h index c46c5f0..3cec153 100644 --- a/libkcal/person.h +++ b/libkcal/person.h @@ -14,37 +14,38 @@ You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef KCAL_PERSON_H #define KCAL_PERSON_H #include <qstring.h> namespace KCal { class Person { public: Person() {} Person( const QString &fullName ); Person( const QString &name, const QString &email ); QString fullName( ) const; void setName(const QString &); QString name() const { return mName; } + QString realName() const; void setEmail(const QString &); QString email() const { return mEmail; } private: QString mName; QString mEmail; }; bool operator==( const Person& p1, const Person& p2 ); } #endif diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 2ce6926..edefda4 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -18,48 +18,49 @@ As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <stdlib.h> #include <qfile.h> #include <qtimer.h> #include <qmap.h> #include <qregexp.h> #ifndef DESKTOP_VERSION #include <qpe/qpeapplication.h> #include <qtopia/qcopenvelope_qws.h> #else #include <qapplication.h> +#include <qprocess.h> #endif #include <kstaticdeleter.h> #include <kmessagebox.h> #include "externalapphandler.h" #include "kpimglobalprefs.h" //uncomment line to get debug output //#define DEBUG_EXT_APP_HANDLER /********************************************************************************* * ********************************************************************************/ QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) { //sourceMessage passes later three parameters: sourceChannel, uid, param1 if (_usedSourceParameters == 0) _sourceMessageParameters = "QString,QString)"; @@ -413,63 +414,82 @@ void ExternalAppHandler::loadConfig() QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); QString qtpath = QString::fromLatin1( getenv("QTDIR") ); //if qtopiapath is not set, fallback to qt if (qtopiapath.isEmpty()) qtopiapath = qtpath; //if opiepath is not set, fallback to qtopia if (opiepath.isEmpty()) opiepath = qtopiapath; //mailclients QString mailmsg1 = "writeMail(QString,QString)"; QString mailmsg2 = "writeMail(QMap(QString,QString))"; QString undefined = ""; 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" ))) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || ( QFile::exists( qtpath + "/bin/qtmail" ))) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); if ( QFile::exists( opiepath + "/bin/opiemail" )) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 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 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); if (( QFile::exists( qtopiapath + "/bin/kppi" )) || ( QFile::exists( opiepath + "/bin/kppi" ))) addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); //faxclients addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); //smsclients addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); //pagerclients addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); //sipclients addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); @@ -507,62 +527,59 @@ QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) { if (dai->_type == type) list.append(dai); } return list; } DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) { DefaultAppItem* dai; for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) { if (dai->_type == type && dai->_id == clientid) return dai; } return 0; } bool ExternalAppHandler::isEmailAppAvailable() { -#ifndef DESKTOP_VERSION + if (mEmailAppAvailable == UNDEFINED) { int client = KPimGlobalPrefs::instance()->mEmailClient; if (client == KPimGlobalPrefs::NONE_EMC) mEmailAppAvailable = UNAVAILABLE; else mEmailAppAvailable = AVAILABLE; } return (mEmailAppAvailable == AVAILABLE); -#else //DESKTOP_VERSION - return false; -#endif //DESKTOP_VERSION } bool ExternalAppHandler::isSMSAppAvailable() { #ifndef DESKTOP_VERSION if (mSMSAppAvailable == UNDEFINED) { int client = KPimGlobalPrefs::instance()->mSMSClient; if (client == KPimGlobalPrefs::NONE_SMC) mSMSAppAvailable = UNAVAILABLE; else mSMSAppAvailable = AVAILABLE; } return (mSMSAppAvailable == AVAILABLE); #else //DESKTOP_VERSION return false; #endif //DESKTOP_VERSION } bool ExternalAppHandler::isPhoneAppAvailable() { #ifndef DESKTOP_VERSION if (mPhoneAppAvailable == UNDEFINED) @@ -667,109 +684,175 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS } channel = dai->_channel; message2 = dai->_message2; parameters2 = dai->_parameters2; } //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 QCopEnvelope e(channel.latin1(), message2.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters2, emails, urls); #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; } /************************************************************************** * **************************************************************************/ //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; int client = KPimGlobalPrefs::instance()->mEmailClient; if (client == KPimGlobalPrefs::OTHER_EMC) { channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; message = KPimGlobalPrefs::instance()->mEmailOtherMessage; parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; } else { DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); if (!dai) { qDebug("could not find configured email application."); return false; } channel = dai->_channel; message = dai->_message; 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 - KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); +#else // DESKTOP_VERSION + + //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; } /************************************************************************** * **************************************************************************/ //calls the emailapplication and creates a mail with parameter as recipients // parameters format is // NAME <EMAIL>:SUBJECT bool ExternalAppHandler::mailToOneContact( const QString& adressline ) { QString line = adressline; int first = line.find( "<"); int last = line.find( ">"); QString name = line.left(first); QString emailadress = line.mid(first+1, last-first-1); //Subject can not be handled right now. return mailToOneContact( name, emailadress ); } |