summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-10-22 10:45:11 (UTC)
committer zautrix <zautrix>2004-10-22 10:45:11 (UTC)
commit54405df7e8d5e931741145d6242d1d06b72c37d6 (patch) (side-by-side diff)
treed872a99a200202270eeaad38c2d38b3dd0d20e83
parent0af0436b73d0e55d4254aad66fb41efc06d329d1 (diff)
downloadkdepimpi-54405df7e8d5e931741145d6242d1d06b72c37d6.zip
kdepimpi-54405df7e8d5e931741145d6242d1d06b72c37d6.tar.gz
kdepimpi-54405df7e8d5e931741145d6242d1d06b72c37d6.tar.bz2
added kphone to SIP ext app
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp37
-rw-r--r--libkdepim/kpimglobalprefs.cpp2
-rw-r--r--libkdepim/kpimglobalprefs.h3
3 files changed, 37 insertions, 5 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 07bdff2..779b20e 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -43,16 +43,19 @@ $Id$
#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)
{
@@ -75,19 +78,20 @@ QCopTransferItem::QCopTransferItem()
/*********************************************************************************/
bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3)
{
#ifndef DESKTOP_VERSION
//sourceMessage passes two parameters: sourceChannel, uid
QString sourceMessage = _sourceMessage + _sourceMessageParameters;
-
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1());
qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1());
+#endif
QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1());
e << _sourceChannel << uid;
if (_usedSourceParameters == 1)
e << param1;
else if (_usedSourceParameters == 2)
@@ -192,18 +196,20 @@ QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString
/*********************************************************************************/
bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap)
{
#ifndef DESKTOP_VERSION
//targetMessage passes two parameters: uid, map
QString targetMessage = _targetMessage + _targetMessageParameters;
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1());
+#endif
QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
//US we need no names in the To field. The emailadresses are enough
e << uid << nameEmailMap;
qApp->processEvents();
@@ -261,22 +267,24 @@ QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QStri
/*********************************************************************************/
bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6)
{
#ifndef DESKTOP_VERSION
//targetMessage passes two parameters: uid, map
QString targetMessage = _targetMessage + _targetMessageParameters;
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1());
for ( int i = 0; i < list3.count(); i++)
qDebug("listentry list3: %s",list3[i].latin1());
+#endif
QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
//US we need no names in the To field. The emailadresses are enough
e << uid << list1 << list2 << list3 << list4 << list5 << list6;
qApp->processEvents();
@@ -289,36 +297,42 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString
}
/*********************************************************************************/
bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
{
bool res = QCopTransferItem::appMessage( cmsg, data );
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
+#endif
if (res == false)
{
QDataStream stream( data, IO_ReadOnly );
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
+#endif
//we are in the source and get an answer from the target
if ((_targetMessage + _targetMessageParameters) == cmsg.data())
{
QStringList list1;
QStringList list2;
QStringList list3;
QStringList list4;
QStringList list5;
QStringList list6;
QString uid;
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
+#endif
stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6;
emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6);
return true;
}
}
@@ -431,18 +445,21 @@ void ExternalAppHandler::loadConfig()
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);
- addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other sip client", undefined, undefined, undefined, undefined, undefined);
+ addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined);
+ addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined);
+ if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
+ ( QFile::exists( opiepath + "/bin/kppi" )))
+ addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
}
ExternalAppHandler *ExternalAppHandler::instance()
{
if ( !sInstance ) {
sInstance = staticDeleter.setObject( new ExternalAppHandler() );
sInstance->loadConfig();
@@ -630,18 +647,20 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS
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);
@@ -687,18 +706,20 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e
parameters = dai->_parameters;
}
//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
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
@@ -764,18 +785,20 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber )
parameters = dai->_parameters;
}
//first check if one of the mailers need the emails right in the message.
message = translateMessage(message, phonenumber, "");
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
+#endif
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameters(&e, parameters, phonenumber, "");
#else
@@ -819,18 +842,20 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber )
parameters = dai->_parameters;
}
//first check if one of the mailers need the emails right in the message.
message = translateMessage(message, phonenumber, "");
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
+#endif
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameters(&e, parameters, phonenumber, "");
#else
@@ -874,18 +899,20 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
parameters = dai->_parameters;
}
//first check if one of the mailers need the emails right in the message.
message = translateMessage(message, pagernumber, "");
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1());
+#endif
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameters(&e, parameters, pagernumber, "");
#else
@@ -929,18 +956,20 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber )
parameters = dai->_parameters;
}
//first check if one of the mailers need the emails right in the message.
message = translateMessage(message, faxnumber, "");
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
+#endif
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameters(&e, parameters, faxnumber, "");
#else
@@ -984,18 +1013,20 @@ bool ExternalAppHandler::callBySIP( const QString& sipnumber )
parameters = dai->_parameters;
}
//first check if one of the sip apps need the emails right in the message.
message = translateMessage(message, sipnumber, "");
+#ifdef DEBUG_EXT_APP_HANDLER
qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1());
+#endif
QCopEnvelope e(channel.latin1(), message.latin1());
//US we need no names in the To field. The emailadresses are enough
passParameters(&e, parameters, sipnumber, "");
#else
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 04e2072..7cd6038 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -87,17 +87,17 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
addItemString( "PagerChannel", &mPagerOtherChannel, "" );
addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
- addItemInt( "SIPChannelType", &mSipClient, NONE_SIC );
+ addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
addItemString( "SIPChannel", &mSipOtherChannel, "" );
addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
KPrefs::setCurrentGroup( "PhoneAccess" );
addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
diff --git a/libkdepim/kpimglobalprefs.h b/libkdepim/kpimglobalprefs.h
index 7c55099..d09c3da 100644
--- a/libkdepim/kpimglobalprefs.h
+++ b/libkdepim/kpimglobalprefs.h
@@ -70,17 +70,18 @@ class KPimGlobalPrefs : public KPrefs
enum PagerClients {
NONE_PAC = 0,
OTHER_PAC = 1
};
enum SIPClients {
NONE_SIC = 0,
- OTHER_SIC = 1
+ OTHER_SIC = 1,
+ KPPI_SIC = 2
};
private:
KPimGlobalPrefs( const QString &name = QString::null );
static KPimGlobalPrefs *sInstance;