-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 | |||
@@ -78,4 +78,6 @@ void AddresseeView::setSource(const QString& n) | |||
78 | else if ( n.left( 7 ) == "pagerto" ) | 78 | else if ( n.left( 7 ) == "pagerto" ) |
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 | ||
81 | } | 83 | } |
@@ -88,4 +90,5 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
88 | bool ksmsAvail = eah->isSMSAppAvailable(); | 90 | bool ksmsAvail = eah->isSMSAppAvailable(); |
89 | bool kpagerAvail = eah->isPagerAppAvailable(); | 91 | bool kpagerAvail = eah->isPagerAppAvailable(); |
92 | bool ksipAvail = eah->isSIPAppAvailable(); | ||
90 | 93 | ||
91 | 94 | ||
@@ -160,4 +163,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
160 | if (kpagerAvail) extension = "pagerto:"; | 163 | if (kpagerAvail) extension = "pagerto:"; |
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) { |
163 | extension = "phoneto:"; | 169 | extension = "phoneto:"; |
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 5ba32b6..fa56ee9 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -356,5 +356,5 @@ void ExternalAppHandler::loadConfig() | |||
356 | mSMSAppAvailable = UNDEFINED; | 356 | mSMSAppAvailable = UNDEFINED; |
357 | mPagerAppAvailable = UNDEFINED; | 357 | mPagerAppAvailable = UNDEFINED; |
358 | 358 | mSIPAppAvailable = UNDEFINED; | |
359 | 359 | ||
360 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 360 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
@@ -405,4 +405,8 @@ void ExternalAppHandler::loadConfig() | |||
405 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 405 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
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 | } |
408 | 412 | ||
@@ -543,4 +547,23 @@ bool ExternalAppHandler::isPagerAppAvailable() | |||
543 | } | 547 | } |
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 | /************************************************************************** |
546 | * | 569 | * |
@@ -902,4 +925,60 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
902 | **************************************************************************/ | 925 | **************************************************************************/ |
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 | ||
905 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 984 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 1b04b2b..cfe577b 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -158,5 +158,6 @@ class ExternalAppHandler : public QObject | |||
158 | SMS = 2, | 158 | SMS = 2, |
159 | FAX = 3, | 159 | FAX = 3, |
160 | PAGER = 4 | 160 | PAGER = 4, |
161 | SIP = 5 | ||
161 | }; | 162 | }; |
162 | 163 | ||
@@ -191,4 +192,7 @@ class ExternalAppHandler : public QObject | |||
191 | bool callByFax( const QString& faxnumber ); | 192 | bool callByFax( const QString& faxnumber ); |
192 | 193 | ||
194 | //calls the sipapplication with the number | ||
195 | bool callBySIP( const QString& sipnumber ); | ||
196 | |||
193 | bool isEmailAppAvailable(); | 197 | bool isEmailAppAvailable(); |
194 | bool isSMSAppAvailable(); | 198 | bool isSMSAppAvailable(); |
@@ -196,4 +200,5 @@ class ExternalAppHandler : public QObject | |||
196 | bool isFaxAppAvailable(); | 200 | bool isFaxAppAvailable(); |
197 | bool isPagerAppAvailable(); | 201 | bool isPagerAppAvailable(); |
202 | bool isSIPAppAvailable(); | ||
198 | 203 | ||
199 | 204 | ||
@@ -242,4 +247,5 @@ class ExternalAppHandler : public QObject | |||
242 | Availability mSMSAppAvailable; | 247 | Availability mSMSAppAvailable; |
243 | Availability mPagerAppAvailable; | 248 | Availability mPagerAppAvailable; |
249 | Availability mSIPAppAvailable; | ||
244 | 250 | ||
245 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; | 251 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; |