summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-10-29 16:39:40 (UTC)
committer zautrix <zautrix>2005-10-29 16:39:40 (UTC)
commit898dbabef6d747447999add46201315d04f85f63 (patch) (side-by-side diff)
treefb247cbbd99ca6918400547e16484a58a8ba1523 /libkdepim
parent1360f8e3b5da58b561f868643d2d5f04b874cee7 (diff)
downloadkdepimpi-898dbabef6d747447999add46201315d04f85f63.zip
kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.gz
kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.bz2
commit
Diffstat (limited to 'libkdepim') (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
@@ -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
- 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;
}