-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 | |||
@@ -77,6 +77,8 @@ void AddresseeView::setSource(const QString& n) | |||
77 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); | 77 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); |
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 | } |
82 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) | 84 | void AddresseeView::setAddressee( const KABC::Addressee& addr ) |
@@ -87,6 +89,7 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
87 | bool kfaxAvail = eah->isFaxAppAvailable(); | 89 | bool kfaxAvail = eah->isFaxAppAvailable(); |
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 | ||
92 | mAddressee = addr; | 95 | mAddressee = addr; |
@@ -159,6 +162,9 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
159 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 162 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
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:"; |
164 | } | 170 | } |
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() | |||
355 | mFaxAppAvailable = UNDEFINED; | 355 | mFaxAppAvailable = UNDEFINED; |
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") ); |
361 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 361 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
@@ -404,6 +404,10 @@ void ExternalAppHandler::loadConfig() | |||
404 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 404 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
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 | ||
409 | ExternalAppHandler *ExternalAppHandler::instance() | 413 | ExternalAppHandler *ExternalAppHandler::instance() |
@@ -542,6 +546,25 @@ bool ExternalAppHandler::isPagerAppAvailable() | |||
542 | #endif //DESKTOP_VERSION | 546 | #endif //DESKTOP_VERSION |
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 | * |
547 | **************************************************************************/ | 570 | **************************************************************************/ |
@@ -901,6 +924,62 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
901 | * | 924 | * |
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 |
906 | { | 985 | { |
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 1b04b2b..cfe577b 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -157,7 +157,8 @@ class ExternalAppHandler : public QObject | |||
157 | PHONE = 1, | 157 | PHONE = 1, |
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 | ||
163 | enum Availability { | 164 | enum Availability { |
@@ -190,11 +191,15 @@ class ExternalAppHandler : public QObject | |||
190 | //calls the faxapplication with the number | 191 | //calls the faxapplication with the number |
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(); |
195 | bool isPhoneAppAvailable(); | 199 | bool isPhoneAppAvailable(); |
196 | bool isFaxAppAvailable(); | 200 | bool isFaxAppAvailable(); |
197 | bool isPagerAppAvailable(); | 201 | bool isPagerAppAvailable(); |
202 | bool isSIPAppAvailable(); | ||
198 | 203 | ||
199 | 204 | ||
200 | //Call this method on the source when you want to select names from the addressbook by using QCop | 205 | //Call this method on the source when you want to select names from the addressbook by using QCop |
@@ -241,6 +246,7 @@ class ExternalAppHandler : public QObject | |||
241 | Availability mFaxAppAvailable; | 246 | Availability mFaxAppAvailable; |
242 | Availability mSMSAppAvailable; | 247 | Availability mSMSAppAvailable; |
243 | Availability mPagerAppAvailable; | 248 | Availability mPagerAppAvailable; |
249 | Availability mSIPAppAvailable; | ||
244 | 250 | ||
245 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; | 251 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; |
246 | QCopListTransferItem* mFindByEmailFromKAPITransfer; | 252 | QCopListTransferItem* mFindByEmailFromKAPITransfer; |