summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp81
1 files changed, 80 insertions, 1 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 5ba32b6..fa56ee9 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -355,7 +355,7 @@ void ExternalAppHandler::loadConfig()
mFaxAppAvailable = UNDEFINED;
mSMSAppAvailable = UNDEFINED;
mPagerAppAvailable = UNDEFINED;
-
+ mSIPAppAvailable = UNDEFINED;
QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
@@ -404,6 +404,10 @@ void ExternalAppHandler::loadConfig()
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);
+
}
ExternalAppHandler *ExternalAppHandler::instance()
@@ -542,6 +546,25 @@ bool ExternalAppHandler::isPagerAppAvailable()
#endif //DESKTOP_VERSION
}
+
+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
+}
+
/**************************************************************************
*
**************************************************************************/
@@ -901,6 +924,62 @@ 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;
+}
+
+
+/**************************************************************************
+ *
+ **************************************************************************/
+
QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const
{