author | ulf69 <ulf69> | 2004-09-16 17:25:06 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-09-16 17:25:06 (UTC) |
commit | b6bfa63deb15a2600d46a8c68c231f068da1444a (patch) (unidiff) | |
tree | 271c22bdf98d05d1c0acbd56e5c570f56baa9b5d | |
parent | c32d7e58ca69196426eee3217140227aca634f52 (diff) | |
download | kdepimpi-b6bfa63deb15a2600d46a8c68c231f068da1444a.zip kdepimpi-b6bfa63deb15a2600d46a8c68c231f068da1444a.tar.gz kdepimpi-b6bfa63deb15a2600d46a8c68c231f068da1444a.tar.bz2 |
added sip support to external applications and display sip numbers as hyperlink
-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) | |||
79 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); | 79 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); |
80 | else if ( n.left( 5 ) == "sipto" ) | ||
81 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); | ||
80 | 82 | ||
@@ -89,2 +91,3 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
89 | bool kpagerAvail = eah->isPagerAppAvailable(); | 91 | bool kpagerAvail = eah->isPagerAppAvailable(); |
92 | bool ksipAvail = eah->isSIPAppAvailable(); | ||
90 | 93 | ||
@@ -161,2 +164,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
161 | } | 164 | } |
165 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | ||
166 | if (ksipAvail) extension = "sipto:"; | ||
167 | } | ||
162 | else if (kphoneAvail) { | 168 | 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() | |||
357 | mPagerAppAvailable = UNDEFINED; | 357 | mPagerAppAvailable = UNDEFINED; |
358 | 358 | mSIPAppAvailable = UNDEFINED; | |
359 | 359 | ||
@@ -406,2 +406,6 @@ void ExternalAppHandler::loadConfig() | |||
406 | 406 | ||
407 | //sipclients | ||
408 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No sip client installed", undefined, undefined, undefined, undefined, undefined); | ||
409 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other sip client", undefined, undefined, undefined, undefined, undefined); | ||
410 | |||
407 | } | 411 | } |
@@ -544,2 +548,21 @@ bool ExternalAppHandler::isPagerAppAvailable() | |||
544 | 548 | ||
549 | |||
550 | bool ExternalAppHandler::isSIPAppAvailable() | ||
551 | { | ||
552 | #ifndef DESKTOP_VERSION | ||
553 | if (mSIPAppAvailable == UNDEFINED) | ||
554 | { | ||
555 | int client = KPimGlobalPrefs::instance()->mSipClient; | ||
556 | if (client == KPimGlobalPrefs::NONE_SIC) | ||
557 | mSIPAppAvailable = UNAVAILABLE; | ||
558 | else | ||
559 | mSIPAppAvailable = AVAILABLE; | ||
560 | } | ||
561 | |||
562 | return (mSIPAppAvailable == AVAILABLE); | ||
563 | #else //DESKTOP_VERSION | ||
564 | return false; | ||
565 | #endif //DESKTOP_VERSION | ||
566 | } | ||
567 | |||
545 | /************************************************************************** | 568 | /************************************************************************** |
@@ -903,2 +926,58 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
903 | 926 | ||
927 | //calls the sipapplication with the number | ||
928 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) | ||
929 | { | ||
930 | #ifndef DESKTOP_VERSION | ||
931 | QString channel; | ||
932 | QString message; | ||
933 | QString parameters; | ||
934 | |||
935 | |||
936 | int client = KPimGlobalPrefs::instance()->mSipClient; | ||
937 | if (client == KPimGlobalPrefs::OTHER_SIC) | ||
938 | { | ||
939 | channel = KPimGlobalPrefs::instance()->mSipOtherChannel; | ||
940 | message = KPimGlobalPrefs::instance()->mSipOtherMessage; | ||
941 | parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; | ||
942 | } | ||
943 | else | ||
944 | { | ||
945 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); | ||
946 | if (!dai) | ||
947 | { | ||
948 | qDebug("could not find configured sip application."); | ||
949 | return false; | ||
950 | } | ||
951 | channel = dai->_channel; | ||
952 | message = dai->_message; | ||
953 | parameters = dai->_parameters; | ||
954 | } | ||
955 | |||
956 | |||
957 | //first check if one of the sip apps need the emails right in the message. | ||
958 | message = translateMessage(message, sipnumber, ""); | ||
959 | |||
960 | |||
961 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | ||
962 | qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); | ||
963 | |||
964 | QCopEnvelope e(channel.latin1(), message.latin1()); | ||
965 | //US we need no names in the To field. The emailadresses are enough | ||
966 | |||
967 | passParameters(&e, parameters, sipnumber, ""); | ||
968 | |||
969 | |||
970 | #else | ||
971 | KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); | ||
972 | #endif | ||
973 | |||
974 | |||
975 | return true; | ||
976 | } | ||
977 | |||
978 | |||
979 | /************************************************************************** | ||
980 | * | ||
981 | **************************************************************************/ | ||
982 | |||
904 | 983 | ||
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 | |||
159 | FAX = 3, | 159 | FAX = 3, |
160 | PAGER = 4 | 160 | PAGER = 4, |
161 | SIP = 5 | ||
161 | }; | 162 | }; |
@@ -192,2 +193,5 @@ class ExternalAppHandler : public QObject | |||
192 | 193 | ||
194 | //calls the sipapplication with the number | ||
195 | bool callBySIP( const QString& sipnumber ); | ||
196 | |||
193 | bool isEmailAppAvailable(); | 197 | bool isEmailAppAvailable(); |
@@ -197,2 +201,3 @@ class ExternalAppHandler : public QObject | |||
197 | bool isPagerAppAvailable(); | 201 | bool isPagerAppAvailable(); |
202 | bool isSIPAppAvailable(); | ||
198 | 203 | ||
@@ -243,2 +248,3 @@ class ExternalAppHandler : public QObject | |||
243 | Availability mPagerAppAvailable; | 248 | Availability mPagerAppAvailable; |
249 | Availability mSIPAppAvailable; | ||
244 | 250 | ||