-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 | |||
@@ -64,42 +64,45 @@ AddresseeView::AddresseeView( QWidget *parent, const char *name ) | |||
64 | } | 64 | } |
65 | 65 | ||
66 | void AddresseeView::setSource(const QString& n) | 66 | void AddresseeView::setSource(const QString& n) |
67 | { | 67 | { |
68 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 68 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
69 | 69 | ||
70 | if ( n.left( 6 ) == "mailto" ) | 70 | if ( n.left( 6 ) == "mailto" ) |
71 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 71 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
72 | else if ( n.left( 7 ) == "phoneto" ) | 72 | else if ( n.left( 7 ) == "phoneto" ) |
73 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); | 73 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); |
74 | else if ( n.left( 5 ) == "faxto" ) | 74 | else if ( n.left( 5 ) == "faxto" ) |
75 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); | 75 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); |
76 | else if ( n.left( 5 ) == "smsto" ) | 76 | else if ( n.left( 5 ) == "smsto" ) |
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 ) |
83 | { | 85 | { |
84 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 86 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
85 | bool kemailAvail = eah->isEmailAppAvailable(); | 87 | bool kemailAvail = eah->isEmailAppAvailable(); |
86 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 88 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
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; |
93 | // clear view | 96 | // clear view |
94 | setText( QString::null ); | 97 | setText( QString::null ); |
95 | 98 | ||
96 | if ( mAddressee.isEmpty() ) | 99 | if ( mAddressee.isEmpty() ) |
97 | return; | 100 | return; |
98 | 101 | ||
99 | QString name = ( mAddressee.assembledName().isEmpty() ? | 102 | QString name = ( mAddressee.assembledName().isEmpty() ? |
100 | mAddressee.formattedName() : mAddressee.assembledName() ); | 103 | mAddressee.formattedName() : mAddressee.assembledName() ); |
101 | 104 | ||
102 | QString dynamicPart; | 105 | QString dynamicPart; |
103 | 106 | ||
104 | QStringList emails = mAddressee.emails(); | 107 | QStringList emails = mAddressee.emails(); |
105 | QStringList::ConstIterator emailIt; | 108 | QStringList::ConstIterator emailIt; |
@@ -146,32 +149,35 @@ void AddresseeView::setAddressee( const KABC::Addressee& addr ) | |||
146 | ) | 149 | ) |
147 | { | 150 | { |
148 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 151 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
149 | .arg( (*phoneIt).number() ); | 152 | .arg( (*phoneIt).number() ); |
150 | 153 | ||
151 | } | 154 | } |
152 | else | 155 | else |
153 | sms = ""; | 156 | sms = ""; |
154 | 157 | ||
155 | extension = QString::null; | 158 | extension = QString::null; |
156 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 159 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
157 | if (kfaxAvail) extension = "faxto:"; | 160 | if (kfaxAvail) extension = "faxto:"; |
158 | } | 161 | } |
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 | } |
165 | else | 171 | else |
166 | extension = QString::null; | 172 | extension = QString::null; |
167 | 173 | ||
168 | if ( !extension.isEmpty() ) { | 174 | if ( !extension.isEmpty() ) { |
169 | dynamicPart += QString( | 175 | dynamicPart += QString( |
170 | "<tr><td align=\"right\"><b>%1</b></td>" | 176 | "<tr><td align=\"right\"><b>%1</b></td>" |
171 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) | 177 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) |
172 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 178 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
173 | .arg( extension ) | 179 | .arg( extension ) |
174 | .arg( (*phoneIt).number() ) | 180 | .arg( (*phoneIt).number() ) |
175 | .arg( (*phoneIt).number() ) | 181 | .arg( (*phoneIt).number() ) |
176 | .arg( sms ); | 182 | .arg( sms ); |
177 | 183 | ||
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 5ba32b6..fa56ee9 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -342,33 +342,33 @@ ExternalAppHandler::ExternalAppHandler() | |||
342 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 342 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
343 | } | 343 | } |
344 | 344 | ||
345 | ExternalAppHandler::~ExternalAppHandler() | 345 | ExternalAppHandler::~ExternalAppHandler() |
346 | { | 346 | { |
347 | } | 347 | } |
348 | 348 | ||
349 | void ExternalAppHandler::loadConfig() | 349 | void ExternalAppHandler::loadConfig() |
350 | { | 350 | { |
351 | 351 | ||
352 | mDefaultItems.clear(); | 352 | mDefaultItems.clear(); |
353 | mEmailAppAvailable = UNDEFINED; | 353 | mEmailAppAvailable = UNDEFINED; |
354 | mPhoneAppAvailable = UNDEFINED; | 354 | mPhoneAppAvailable = UNDEFINED; |
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") ); |
362 | 362 | ||
363 | if (opiepath.isEmpty()) | 363 | if (opiepath.isEmpty()) |
364 | opiepath = qtopiapath; | 364 | opiepath = qtopiapath; |
365 | 365 | ||
366 | //mailclients | 366 | //mailclients |
367 | QString mailmsg1 = "writeMail(QString,QString)"; | 367 | QString mailmsg1 = "writeMail(QString,QString)"; |
368 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 368 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
369 | 369 | ||
370 | QString undefined = ""; | 370 | QString undefined = ""; |
371 | 371 | ||
372 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 372 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
373 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 373 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
374 | 374 | ||
@@ -391,32 +391,36 @@ void ExternalAppHandler::loadConfig() | |||
391 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 391 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
392 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 392 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
393 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 393 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
394 | 394 | ||
395 | //faxclients | 395 | //faxclients |
396 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 396 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
397 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 397 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
398 | 398 | ||
399 | //smsclients | 399 | //smsclients |
400 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 400 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
401 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 401 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
402 | 402 | ||
403 | //pagerclients | 403 | //pagerclients |
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() |
410 | { | 414 | { |
411 | if ( !sInstance ) { | 415 | if ( !sInstance ) { |
412 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 416 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
413 | sInstance->loadConfig(); | 417 | sInstance->loadConfig(); |
414 | } | 418 | } |
415 | 419 | ||
416 | return sInstance; | 420 | return sInstance; |
417 | } | 421 | } |
418 | 422 | ||
419 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 423 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
420 | { | 424 | { |
421 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 425 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
422 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | 426 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); |
@@ -529,32 +533,51 @@ bool ExternalAppHandler::isPagerAppAvailable() | |||
529 | #ifndef DESKTOP_VERSION | 533 | #ifndef DESKTOP_VERSION |
530 | if (mPagerAppAvailable == UNDEFINED) | 534 | if (mPagerAppAvailable == UNDEFINED) |
531 | { | 535 | { |
532 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 536 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
533 | if (client == KPimGlobalPrefs::NONE_PAC) | 537 | if (client == KPimGlobalPrefs::NONE_PAC) |
534 | mPagerAppAvailable = UNAVAILABLE; | 538 | mPagerAppAvailable = UNAVAILABLE; |
535 | else | 539 | else |
536 | mPagerAppAvailable = AVAILABLE; | 540 | mPagerAppAvailable = AVAILABLE; |
537 | } | 541 | } |
538 | 542 | ||
539 | return (mPagerAppAvailable == AVAILABLE); | 543 | return (mPagerAppAvailable == AVAILABLE); |
540 | #else //DESKTOP_VERSION | 544 | #else //DESKTOP_VERSION |
541 | return false; | 545 | return false; |
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 | **************************************************************************/ |
548 | 571 | ||
549 | 572 | ||
550 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 573 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
551 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 574 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
552 | { | 575 | { |
553 | 576 | ||
554 | #ifndef DESKTOP_VERSION | 577 | #ifndef DESKTOP_VERSION |
555 | QString channel; | 578 | QString channel; |
556 | QString message2; | 579 | QString message2; |
557 | QString parameters2; | 580 | QString parameters2; |
558 | 581 | ||
559 | 582 | ||
560 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 583 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
@@ -888,32 +911,88 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) | |||
888 | 911 | ||
889 | passParameters(&e, parameters, faxnumber, ""); | 912 | passParameters(&e, parameters, faxnumber, ""); |
890 | 913 | ||
891 | 914 | ||
892 | #else | 915 | #else |
893 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 916 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
894 | #endif | 917 | #endif |
895 | 918 | ||
896 | 919 | ||
897 | return true; | 920 | return true; |
898 | } | 921 | } |
899 | 922 | ||
900 | /************************************************************************** | 923 | /************************************************************************** |
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 | { |
907 | message = message.replace( QRegExp("%1"), param1 ); | 986 | message = message.replace( QRegExp("%1"), param1 ); |
908 | return message.replace( QRegExp("%2"), param2 ); | 987 | return message.replace( QRegExp("%2"), param2 ); |
909 | } | 988 | } |
910 | 989 | ||
911 | /************************************************************************** | 990 | /************************************************************************** |
912 | * | 991 | * |
913 | **************************************************************************/ | 992 | **************************************************************************/ |
914 | 993 | ||
915 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 994 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
916 | { | 995 | { |
917 | #ifndef DESKTOP_VERSION | 996 | #ifndef DESKTOP_VERSION |
918 | QMap<QString, QString> valmap; | 997 | QMap<QString, QString> valmap; |
919 | bool useValMap = false; | 998 | bool useValMap = false; |
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 1b04b2b..cfe577b 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -144,70 +144,75 @@ class DefaultAppItem | |||
144 | * | 144 | * |
145 | ********************************************************************************/ | 145 | ********************************************************************************/ |
146 | 146 | ||
147 | class ExternalAppHandler : public QObject | 147 | class ExternalAppHandler : public QObject |
148 | { | 148 | { |
149 | Q_OBJECT | 149 | Q_OBJECT |
150 | public: | 150 | public: |
151 | virtual ~ExternalAppHandler(); | 151 | virtual ~ExternalAppHandler(); |
152 | 152 | ||
153 | static ExternalAppHandler *instance(); | 153 | static ExternalAppHandler *instance(); |
154 | 154 | ||
155 | enum Types { | 155 | enum Types { |
156 | EMAIL = 0, | 156 | EMAIL = 0, |
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 { |
164 | UNDEFINED = -1, | 165 | UNDEFINED = -1, |
165 | UNAVAILABLE = 0, | 166 | UNAVAILABLE = 0, |
166 | AVAILABLE = 1 | 167 | AVAILABLE = 1 |
167 | }; | 168 | }; |
168 | 169 | ||
169 | //calls the emailapplication with a number of attachments that need to be send. | 170 | //calls the emailapplication with a number of attachments that need to be send. |
170 | //either parameter can be left empty. | 171 | //either parameter can be left empty. |
171 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); | 172 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); |
172 | 173 | ||
173 | //calls the emailapplication and creates a mail with parameter emailadress as recipients | 174 | //calls the emailapplication and creates a mail with parameter emailadress as recipients |
174 | bool mailToOneContact( const QString& name, const QString& emailadress ); | 175 | bool mailToOneContact( const QString& name, const QString& emailadress ); |
175 | 176 | ||
176 | //calls the emailapplication and creates a mail with parameter as recipients | 177 | //calls the emailapplication and creates a mail with parameter as recipients |
177 | // parameters format is | 178 | // parameters format is |
178 | // NAME <EMAIL>:SUBJECT | 179 | // NAME <EMAIL>:SUBJECT |
179 | bool mailToOneContact( const QString& adressline ); | 180 | bool mailToOneContact( const QString& adressline ); |
180 | 181 | ||
181 | //calls the phoneapplication with the number | 182 | //calls the phoneapplication with the number |
182 | bool callByPhone( const QString& phonenumber ); | 183 | bool callByPhone( const QString& phonenumber ); |
183 | 184 | ||
184 | //calls the smsapplication with the number | 185 | //calls the smsapplication with the number |
185 | bool callBySMS( const QString& phonenumber ); | 186 | bool callBySMS( const QString& phonenumber ); |
186 | 187 | ||
187 | //calls the pagerapplication with the number | 188 | //calls the pagerapplication with the number |
188 | bool callByPager( const QString& pagernumber ); | 189 | bool callByPager( const QString& pagernumber ); |
189 | 190 | ||
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 |
201 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); | 206 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); |
202 | //Call this method on the target when you want to return the name/email map to the source (client). | 207 | //Call this method on the target when you want to return the name/email map to the source (client). |
203 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); | 208 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
204 | 209 | ||
205 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); | 210 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); |
206 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); | 211 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
207 | 212 | ||
208 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); | 213 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); |
209 | 214 | ||
210 | 215 | ||
211 | //loadConfig clears the cache and checks again if the applications are available or not | 216 | //loadConfig clears the cache and checks again if the applications are available or not |
212 | void loadConfig(); | 217 | void loadConfig(); |
213 | 218 | ||
@@ -228,32 +233,33 @@ class ExternalAppHandler : public QObject | |||
228 | 233 | ||
229 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); | 234 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); |
230 | void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 235 | void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
231 | 236 | ||
232 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 237 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
233 | 238 | ||
234 | 239 | ||
235 | private: | 240 | private: |
236 | ExternalAppHandler(); | 241 | ExternalAppHandler(); |
237 | QList<DefaultAppItem> mDefaultItems; | 242 | QList<DefaultAppItem> mDefaultItems; |
238 | 243 | ||
239 | Availability mEmailAppAvailable; | 244 | Availability mEmailAppAvailable; |
240 | Availability mPhoneAppAvailable; | 245 | Availability mPhoneAppAvailable; |
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; |
247 | QCopTransferItem* mDisplayDetails; | 253 | QCopTransferItem* mDisplayDetails; |
248 | 254 | ||
249 | 255 | ||
250 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); | 256 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |
251 | 257 | ||
252 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; | 258 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; |
253 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; | 259 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; |
254 | 260 | ||
255 | 261 | ||
256 | static ExternalAppHandler *sInstance; | 262 | static ExternalAppHandler *sInstance; |
257 | 263 | ||
258 | }; | 264 | }; |
259 | 265 | ||