summaryrefslogtreecommitdiffabout
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
parent1360f8e3b5da58b561f868643d2d5f04b874cee7 (diff)
downloadkdepimpi-898dbabef6d747447999add46201315d04f85f63.zip
kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.gz
kdepimpi-898dbabef6d747447999add46201315d04f85f63.tar.bz2
commit
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp6
-rw-r--r--korganizer/koeventviewer.cpp24
-rw-r--r--libkcal/person.cpp8
-rw-r--r--libkcal/person.h1
-rw-r--r--libkdepim/externalapphandler.cpp111
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
@@ -142,3 +142,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
QString name = mAddressee.realName();
-
+ QString assName = mAddressee.assembledName();
+ if ( assName.isEmpty() )
+ assName = name;
QString dynamicPart;
@@ -156,3 +158,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
.arg( type )
- .arg( name )
+ .arg( assName )
.arg( *emailIt )
diff --git a/korganizer/koeventviewer.cpp b/korganizer/koeventviewer.cpp
index 976ee2c..02b54da 100644
--- a/korganizer/koeventviewer.cpp
+++ b/korganizer/koeventviewer.cpp
@@ -59,5 +59,5 @@
#else //DESKTOP_VERSION
-#include <externalapphandler.h>
#include <qtopia/qcopenvelope_qws.h>
#endif //DESKTOP_VERSION
+#include <externalapphandler.h>
@@ -175,3 +175,3 @@ void KOEventViewer::setSource(const QString& n)
// qDebug("KOEventViewer::setSource %s ", n.mid(7).latin1());
-#ifndef DESKTOP_VERSION
+ //#ifndef DESKTOP_VERSION
if ( n.mid(7,3) == "ALL" ) {
@@ -181,6 +181,7 @@ void KOEventViewer::setSource(const QString& n)
} 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
@@ -241,10 +242,17 @@ void KOEventViewer::mailToAttendees( bool all )
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
@@ -672,3 +680,3 @@ void KOEventViewer::formatAttendees(Incidence *event)
if (iconPath) {
- mText += "<a href=\"mailto:" + a->name() +" <" + a->email() + ">:" + mMailSubject + "\">";
+ mText += "<a href=\"mailto:" + a->realName() +" <" + a->email() + ">:" + mMailSubject + "\">";
if ( a->RSVP() ) {
diff --git a/libkcal/person.cpp b/libkcal/person.cpp
index aca28c2..858805d 100644
--- a/libkcal/person.cpp
+++ b/libkcal/person.cpp
@@ -51,3 +51,9 @@ bool KCal::operator==( const Person& p1, const Person& p2 )
-
+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
diff --git a/libkcal/person.h b/libkcal/person.h
index c46c5f0..3cec153 100644
--- a/libkcal/person.h
+++ b/libkcal/person.h
@@ -37,2 +37,3 @@ class Person
QString name() const { return mName; }
+ QString realName() const;
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;