summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 6f812d0..0128cf7 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -22,30 +22,32 @@
*/
/*
Enhanced Version of the file for platform independent KDE tools.
Copyright (c) 2004 Ulf Schenk
$Id$
*/
#include <stdlib.h>
#include <qfile.h>
#include <qmap.h>
+#include <qregexp.h>
-
+#ifndef DESKTOP_VERSION
#include <qtopia/qcopenvelope_qws.h>
-
+#endif
#include <kstaticdeleter.h>
+#include <kmessagebox.h>
#include "externalapphandler.h"
#include "kpimglobalprefs.h"
@@ -159,25 +161,26 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
if (dai->_type == type && dai->_id == clientid)
return dai;
}
return 0;
}
//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma)
bool ExternalAppHandler::mailAttachments( const QString& urls )
{
-#ifndef QT_NO_COP
+
+#ifndef DESKTOP_VERSION
QString channel;
QString message2;
QString parameters2;
int client = KPimGlobalPrefs::instance()->mEmailClient;
if (client == KPimGlobalPrefs::OTHER_EMC)
{
channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage;
parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
}
@@ -189,43 +192,45 @@ bool ExternalAppHandler::mailAttachments( const QString& urls )
qDebug("could not find configured email application.");
return false;
}
channel = dai->_channel;
message2 = dai->_message2;
parameters2 = dai->_parameters2;
}
qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1());
qDebug("passing attachmenturls:(%s) as parameter in the form %s to QCopEnvelope", urls.latin1(), parameters2.latin1());
+
QCopEnvelope e(channel.latin1(), message2.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameter(&e, parameters2, urls);
+
#else
- KMessageBox::sorry( this, i18n( "This version does not support the sending of emails." ) );
+ KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
#endif
return true;
}
//calls the emailapplication and creates a mail with parameter emails as recipients
bool ExternalAppHandler::mailToContacts( const QString& emails )
{
-#ifndef QT_NO_COP
+#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;
}
@@ -248,36 +253,36 @@ bool ExternalAppHandler::mailToContacts( const QString& emails )
qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing emailadresses:(%s) as parameter in the form %s to QCopEnvelope", emails.latin1(), parameters.latin1());
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameter(&e, parameters, emails);
#else
- KMessageBox::sorry( this, i18n( "This version does not support the sending of emails." ) );
+ KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
#endif
return true;
}
//calls the phoneapplication with the number
bool ExternalAppHandler::callByPhone( const QString& phonenumber )
{
-#ifndef QT_NO_COP
+#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
int client = KPimGlobalPrefs::instance()->mPhoneClient;
if (client == KPimGlobalPrefs::OTHER_PHC)
{
channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel;
message = KPimGlobalPrefs::instance()->mPhoneOtherMessage;
parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters;
}
@@ -300,35 +305,35 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber )
qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing phonenumber:(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameter(&e, parameters, phonenumber);
#else
- KMessageBox::sorry( this, i18n( "This version does not support phonecalls." ) );
+ KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) );
#endif
return true;
}
//calls the smsapplication with the number
bool ExternalAppHandler::callBySMS( const QString& phonenumber )
{
-#ifndef QT_NO_COP
+#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
int client = KPimGlobalPrefs::instance()->mSMSClient;
if (client == KPimGlobalPrefs::OTHER_SMC)
{
channel = KPimGlobalPrefs::instance()->mSMSOtherChannel;
message = KPimGlobalPrefs::instance()->mSMSOtherMessage;
parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters;
}
@@ -351,35 +356,35 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber )
qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing phonenumber:(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameter(&e, parameters, phonenumber);
#else
- KMessageBox::sorry( this, i18n( "This version does not support the sending of sms." ) );
+ KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
#endif
return true;
}
//calls the pagerapplication with the number
bool ExternalAppHandler::callByPager( const QString& pagernumber )
{
-#ifndef QT_NO_COP
+#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
int client = KPimGlobalPrefs::instance()->mPagerClient;
if (client == KPimGlobalPrefs::OTHER_PAC)
{
channel = KPimGlobalPrefs::instance()->mPagerOtherChannel;
message = KPimGlobalPrefs::instance()->mPagerOtherMessage;
parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters;
}
@@ -402,35 +407,35 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing pagernumber:(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1());
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameter(&e, parameters, pagernumber);
#else
- KMessageBox::sorry( this, i18n( "This version does not support paging." ) );
+ KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
#endif
return true;
}
//calls the faxapplication with the number
bool ExternalAppHandler::callByFax( const QString& faxnumber )
{
-#ifndef QT_NO_COP
+#ifndef DESKTOP_VERSION
QString channel;
QString message;
QString parameters;
int client = KPimGlobalPrefs::instance()->mFaxClient;
if (client == KPimGlobalPrefs::OTHER_FAC)
{
channel = KPimGlobalPrefs::instance()->mFaxOtherChannel;
message = KPimGlobalPrefs::instance()->mFaxOtherMessage;
parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters;
}
@@ -453,43 +458,44 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber )
qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing faxnumber:(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameter(&e, parameters, faxnumber);
#else
- KMessageBox::sorry( this, i18n( "This version does not support the sending of faxes." ) );
+ KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
#endif
return true;
}
QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const
{
return message.replace( QRegExp("%1"), param1 );
}
void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const
{
+#ifndef DESKTOP_VERSION
QMap<QString, QString> valmap;
bool useValMap = false;
// first extract all parts of the parameters.
QStringList paramlist = QStringList::split(";", parameters);
//Now check how many parts we have.
//=0 :no params to pass
//>0 :parameters to pass
for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
{
QString param = (*it);
@@ -509,18 +515,18 @@ void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameter
valmap.insert(key, value);
useValMap = true;
}
else
{
(*e) << key.latin1();
}
}
if (useValMap == true)
(*e) << valmap;
-
+#endif
}