summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp111
1 files changed, 97 insertions, 14 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 2ce6926..edefda4 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -41,2 +41,3 @@ $Id$
#include <qapplication.h>
+#include <qprocess.h>
#endif
@@ -436,2 +437,21 @@ void ExternalAppHandler::loadConfig()
+#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" )) ||
@@ -450,3 +470,3 @@ void ExternalAppHandler::loadConfig()
addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
-
+#endif
@@ -530,3 +550,3 @@ bool ExternalAppHandler::isEmailAppAvailable()
{
-#ifndef DESKTOP_VERSION
+
if (mEmailAppAvailable == UNDEFINED)
@@ -541,5 +561,2 @@ bool ExternalAppHandler::isEmailAppAvailable()
-#else //DESKTOP_VERSION
- return false;
-#endif //DESKTOP_VERSION
}
@@ -690,3 +707,57 @@ 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
@@ -704,3 +775,3 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e
{
-#ifndef DESKTOP_VERSION
+
QString channel;
@@ -730,3 +801,5 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e
-
+#ifdef DESKTOP_VERSION
+ //message = channel + " " +message + " \""+ parameters + "\"";
+#endif
//first check if one of the mailers need the emails right in the message.
@@ -734,3 +807,2 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e
-
#ifdef DEBUG_EXT_APP_HANDLER
@@ -740,2 +812,3 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e
+#ifndef DESKTOP_VERSION
QCopEnvelope e(channel.latin1(), message.latin1());
@@ -744,9 +817,19 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e
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;