-rw-r--r-- | libkdepim/addresseeview.cpp | 6 | ||||
-rw-r--r-- | libkdepim/externalapphandler.cpp | 81 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 8 |
3 files changed, 93 insertions, 2 deletions
diff --git a/libkdepim/addresseeview.cpp b/libkdepim/addresseeview.cpp index 5c69010..b4717d7 100644 --- a/libkdepim/addresseeview.cpp +++ b/libkdepim/addresseeview.cpp @@ -79,2 +79,4 @@ void AddresseeView::setSource(const QString& n) ExternalAppHandler::instance()->callByPager( n.mid(8) ); + else if ( n.left( 5 ) == "sipto" ) + ExternalAppHandler::instance()->callBySIP( n.mid(6) ); @@ -89,2 +91,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) bool kpagerAvail = eah->isPagerAppAvailable(); + bool ksipAvail = eah->isSIPAppAvailable(); @@ -161,2 +164,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) } + else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { + if (ksipAvail) extension = "sipto:"; + } else if (kphoneAvail) { diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 5ba32b6..fa56ee9 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -357,3 +357,3 @@ void ExternalAppHandler::loadConfig() mPagerAppAvailable = UNDEFINED; - + mSIPAppAvailable = UNDEFINED; @@ -406,2 +406,6 @@ void ExternalAppHandler::loadConfig() + //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); + } @@ -544,2 +548,21 @@ bool ExternalAppHandler::isPagerAppAvailable() + +bool ExternalAppHandler::isSIPAppAvailable() +{ +#ifndef DESKTOP_VERSION + if (mSIPAppAvailable == UNDEFINED) + { + int client = KPimGlobalPrefs::instance()->mSipClient; + if (client == KPimGlobalPrefs::NONE_SIC) + mSIPAppAvailable = UNAVAILABLE; + else + mSIPAppAvailable = AVAILABLE; + } + + return (mSIPAppAvailable == AVAILABLE); +#else //DESKTOP_VERSION + return false; +#endif //DESKTOP_VERSION +} + /************************************************************************** @@ -903,2 +926,58 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) +//calls the sipapplication with the number +bool ExternalAppHandler::callBySIP( const QString& sipnumber ) +{ +#ifndef DESKTOP_VERSION + QString channel; + QString message; + QString parameters; + + + int client = KPimGlobalPrefs::instance()->mSipClient; + if (client == KPimGlobalPrefs::OTHER_SIC) + { + channel = KPimGlobalPrefs::instance()->mSipOtherChannel; + message = KPimGlobalPrefs::instance()->mSipOtherMessage; + parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; + } + else + { + DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); + if (!dai) + { + qDebug("could not find configured sip application."); + return false; + } + channel = dai->_channel; + message = dai->_message; + parameters = dai->_parameters; + } + + + //first check if one of the sip apps need the emails right in the message. + message = translateMessage(message, sipnumber, ""); + + + qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); + qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); + + QCopEnvelope e(channel.latin1(), message.latin1()); + //US we need no names in the To field. The emailadresses are enough + + passParameters(&e, parameters, sipnumber, ""); + + +#else + KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); +#endif + + + return true; +} + + +/************************************************************************** + * + **************************************************************************/ + diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 1b04b2b..cfe577b 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h @@ -159,3 +159,4 @@ class ExternalAppHandler : public QObject FAX = 3, - PAGER = 4 + PAGER = 4, + SIP = 5 }; @@ -192,2 +193,5 @@ class ExternalAppHandler : public QObject + //calls the sipapplication with the number + bool callBySIP( const QString& sipnumber ); + bool isEmailAppAvailable(); @@ -197,2 +201,3 @@ class ExternalAppHandler : public QObject bool isPagerAppAvailable(); + bool isSIPAppAvailable(); @@ -243,2 +248,3 @@ class ExternalAppHandler : public QObject Availability mPagerAppAvailable; + Availability mSIPAppAvailable; |