-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 @@ -32,178 +32,184 @@ #include <qfile.h> #include <qapplication.h> #include "externalapphandler.h" #include "addresseeview.h" //US #ifndef DESKTOP_VERSION //US #include <qtopia/qcopenvelope_qws.h> //US #include <qpe/qpeapplication.h> //US #endif //US static int kphoneInstalled = 0; using namespace KPIM; AddresseeView::AddresseeView( QWidget *parent, const char *name ) //US : KTextBrowser( parent, name ) : QTextBrowser( parent, name ) { //US setWrapPolicy( QTextEdit::AtWordBoundary ); setLinkUnderline( false ); // setVScrollBarMode( QScrollView::AlwaysOff ); //setHScrollBarMode( QScrollView::AlwaysOff ); //US QStyleSheet *sheet = styleSheet(); //US QStyleSheetItem *link = sheet->item( "a" ); //US link->setColor( KGlobalSettings::linkColor() ); } void AddresseeView::setSource(const QString& n) { //qDebug("********AddresseeView::setSource %s", n.latin1()); if ( n.left( 6 ) == "mailto" ) ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); else if ( n.left( 7 ) == "phoneto" ) ExternalAppHandler::instance()->callByPhone( n.mid(8) ); else if ( n.left( 5 ) == "faxto" ) ExternalAppHandler::instance()->callByFax( n.mid(6) ); else if ( n.left( 5 ) == "smsto" ) ExternalAppHandler::instance()->callBySMS( n.mid(6) ); else if ( n.left( 7 ) == "pagerto" ) ExternalAppHandler::instance()->callByPager( n.mid(8) ); + else if ( n.left( 5 ) == "sipto" ) + ExternalAppHandler::instance()->callBySIP( n.mid(6) ); } void AddresseeView::setAddressee( const KABC::Addressee& addr ) { ExternalAppHandler* eah = ExternalAppHandler::instance(); bool kemailAvail = eah->isEmailAppAvailable(); bool kphoneAvail = eah->isPhoneAppAvailable(); bool kfaxAvail = eah->isFaxAppAvailable(); bool ksmsAvail = eah->isSMSAppAvailable(); bool kpagerAvail = eah->isPagerAppAvailable(); + bool ksipAvail = eah->isSIPAppAvailable(); mAddressee = addr; // clear view setText( QString::null ); if ( mAddressee.isEmpty() ) return; QString name = ( mAddressee.assembledName().isEmpty() ? mAddressee.formattedName() : mAddressee.assembledName() ); QString dynamicPart; QStringList emails = mAddressee.emails(); QStringList::ConstIterator emailIt; QString type = i18n( "Email" ); emailIt = emails.begin(); if ( emailIt != emails.end() ) { if ( kemailAvail ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) .arg( type ) .arg( name ) .arg( *emailIt ) .arg( *emailIt ); ++emailIt; } else { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( type ) .arg( *emailIt ); ++emailIt; } } if ( mAddressee.birthday().date().isValid() ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( i18n ("Birthday") ) .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); } KABC::PhoneNumber::List phones = mAddressee.phoneNumbers(); KABC::PhoneNumber::List::ConstIterator phoneIt; QString extension; int phonetype; QString sms; for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { phonetype = (*phoneIt).type(); if (ksmsAvail && ( ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) ) ) { sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) .arg( (*phoneIt).number() ); } else sms = ""; extension = QString::null; if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { if (kfaxAvail) extension = "faxto:"; } else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { if (kpagerAvail) extension = "pagerto:"; } + else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { + if (ksipAvail) extension = "sipto:"; + } else if (kphoneAvail) { extension = "phoneto:"; } else extension = QString::null; if ( !extension.isEmpty() ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) .arg( extension ) .arg( (*phoneIt).number() ) .arg( (*phoneIt).number() ) .arg( sms ); } else { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2 %3</td></tr>" ) .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) .arg( (*phoneIt).number() ) .arg( sms ); } } for ( ; emailIt != emails.end(); ++emailIt ) { if ( kemailAvail ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) .arg( type ) .arg( name ) .arg( *emailIt ) .arg( *emailIt ); } else { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" "<td align=\"left\">%2</td></tr>" ) .arg( type ) .arg( *emailIt ); } } if ( !mAddressee.url().url().isEmpty() ) { dynamicPart += QString( "<tr><td align=\"right\"><b>%1</b></td>" diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 5ba32b6..fa56ee9 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -310,145 +310,149 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d return true; } } return false; } /********************************************************************************* * ********************************************************************************/ ExternalAppHandler *ExternalAppHandler::sInstance = 0; static KStaticDeleter<ExternalAppHandler> staticDeleter; ExternalAppHandler::ExternalAppHandler() { mDefaultItems.setAutoDelete(true); mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); 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&))); } ExternalAppHandler::~ExternalAppHandler() { } void ExternalAppHandler::loadConfig() { mDefaultItems.clear(); mEmailAppAvailable = UNDEFINED; mPhoneAppAvailable = UNDEFINED; mFaxAppAvailable = UNDEFINED; mSMSAppAvailable = UNDEFINED; mPagerAppAvailable = UNDEFINED; - + mSIPAppAvailable = UNDEFINED; QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); if (opiepath.isEmpty()) opiepath = qtopiapath; //mailclients QString mailmsg1 = "writeMail(QString,QString)"; QString mailmsg2 = "writeMail(QMap(QString,QString))"; QString undefined = ""; addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); if (( QFile::exists( qtopiapath + "/bin/ompi" )) || ( QFile::exists( opiepath + "/bin/ompi" ))) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); if ( QFile::exists( qtopiapath + "/bin/qtmail" )) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); if ( QFile::exists( opiepath + "/bin/opiemail" )) addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); //phoneclients addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); if (( QFile::exists( qtopiapath + "/bin/kppi" )) || ( QFile::exists( opiepath + "/bin/kppi" ))) addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); //faxclients addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); //smsclients addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); //pagerclients 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() { if ( !sInstance ) { sInstance = staticDeleter.setObject( new ExternalAppHandler() ); sInstance->loadConfig(); } return sInstance; } 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) { DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); mDefaultItems.append(dai); } QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) { QList<DefaultAppItem> list; DefaultAppItem* dai; for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) { if (dai->_type == type) list.append(dai); } return list; } DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) { DefaultAppItem* dai; for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) { if (dai->_type == type && dai->_id == clientid) return dai; } return 0; } @@ -497,96 +501,115 @@ bool ExternalAppHandler::isPhoneAppAvailable() if (client == KPimGlobalPrefs::NONE_PHC) mPhoneAppAvailable = UNAVAILABLE; else mPhoneAppAvailable = AVAILABLE; } return (mPhoneAppAvailable == AVAILABLE); #else //DESKTOP_VERSION return false; #endif //DESKTOP_VERSION } bool ExternalAppHandler::isFaxAppAvailable() { #ifndef DESKTOP_VERSION if (mFaxAppAvailable == UNDEFINED) { int client = KPimGlobalPrefs::instance()->mFaxClient; if (client == KPimGlobalPrefs::NONE_FAC) mFaxAppAvailable = UNAVAILABLE; else mFaxAppAvailable = AVAILABLE; } return (mFaxAppAvailable == AVAILABLE); #else //DESKTOP_VERSION return false; #endif //DESKTOP_VERSION } bool ExternalAppHandler::isPagerAppAvailable() { #ifndef DESKTOP_VERSION if (mPagerAppAvailable == UNDEFINED) { int client = KPimGlobalPrefs::instance()->mPagerClient; if (client == KPimGlobalPrefs::NONE_PAC) mPagerAppAvailable = UNAVAILABLE; else mPagerAppAvailable = AVAILABLE; } return (mPagerAppAvailable == AVAILABLE); #else //DESKTOP_VERSION return false; #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 +} + /************************************************************************** * **************************************************************************/ //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) { #ifndef DESKTOP_VERSION QString channel; QString message2; QString parameters2; int client = KPimGlobalPrefs::instance()->mEmailClient; if (client == KPimGlobalPrefs::OTHER_EMC) { channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; } else { DefaultAppItem* dai = getDefaultItem(EMAIL, client); if (!dai) { qDebug("could not find configured email application."); return false; } channel = dai->_channel; message2 = dai->_message2; parameters2 = dai->_parameters2; } //first check if one of the mailers need the emails right in the message. message2 = translateMessage(message2, emails, urls); qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); QCopEnvelope e(channel.latin1(), message2.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters2, emails, urls); @@ -856,96 +879,152 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) int client = KPimGlobalPrefs::instance()->mFaxClient; if (client == KPimGlobalPrefs::OTHER_FAC) { channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; message = KPimGlobalPrefs::instance()->mFaxOtherMessage; parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; } else { DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); if (!dai) { qDebug("could not find configured fax application."); return false; } channel = dai->_channel; message = dai->_message; parameters = dai->_parameters; } //first check if one of the mailers need the emails right in the message. message = translateMessage(message, faxnumber, ""); qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.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, faxnumber, ""); #else KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); #endif return true; } /************************************************************************** * **************************************************************************/ +//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 { message = message.replace( QRegExp("%1"), param1 ); return message.replace( QRegExp("%2"), param2 ); } /************************************************************************** * **************************************************************************/ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const { #ifndef DESKTOP_VERSION QMap<QString, QString> valmap; bool useValMap = false; // first extract all parts of the parameters. QStringList paramlist = QStringList::split(";", parameters); //Now check how many parts we have. //=0 :no params to pass //>0 :parameters to pass for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) { QString param = (*it); QStringList keyvallist = QStringList::split("=", param); //if we have keyvalue pairs, we assume that we pass a map to the envelope QStringList::Iterator it2 = keyvallist.begin(); QString key = (*it2); key = key.replace( QRegExp("%1"), param1 ); key = key.replace( QRegExp("%2"), param2 ); ++it2; if(it2 != keyvallist.end()) { QString value = (*it2); value = value.replace( QRegExp("%1"), param1 ); value = value.replace( QRegExp("%2"), param2 ); valmap.insert(key, value); useValMap = true; } else { // qDebug("pass parameter << %s", key.latin1()); (*e) << key; diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 1b04b2b..cfe577b 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h @@ -112,150 +112,156 @@ class QCopListTransferItem : public QCopTransferItem void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); }; /********************************************************************************* * ********************************************************************************/ class DefaultAppItem { public: DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) { } DefaultAppItem() { } public: int _type; int _id; QString _label; QString _channel; QString _message; QString _parameters; // a list of parameters in stringrepresentation. Delimiter is ; QString _message2; QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; }; /********************************************************************************* * ********************************************************************************/ class ExternalAppHandler : public QObject { Q_OBJECT public: virtual ~ExternalAppHandler(); static ExternalAppHandler *instance(); enum Types { EMAIL = 0, PHONE = 1, SMS = 2, FAX = 3, - PAGER = 4 + PAGER = 4, + SIP = 5 }; enum Availability { UNDEFINED = -1, UNAVAILABLE = 0, AVAILABLE = 1 }; //calls the emailapplication with a number of attachments that need to be send. //either parameter can be left empty. bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); //calls the emailapplication and creates a mail with parameter emailadress as recipients bool mailToOneContact( const QString& name, const QString& emailadress ); //calls the emailapplication and creates a mail with parameter as recipients // parameters format is // NAME <EMAIL>:SUBJECT bool mailToOneContact( const QString& adressline ); //calls the phoneapplication with the number bool callByPhone( const QString& phonenumber ); //calls the smsapplication with the number bool callBySMS( const QString& phonenumber ); //calls the pagerapplication with the number bool callByPager( const QString& pagernumber ); //calls the faxapplication with the number bool callByFax( const QString& faxnumber ); + //calls the sipapplication with the number + bool callBySIP( const QString& sipnumber ); + bool isEmailAppAvailable(); bool isSMSAppAvailable(); bool isPhoneAppAvailable(); bool isFaxAppAvailable(); bool isPagerAppAvailable(); + bool isSIPAppAvailable(); //Call this method on the source when you want to select names from the addressbook by using QCop bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); //Call this method on the target when you want to return the name/email map to the source (client). bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); //loadConfig clears the cache and checks again if the applications are available or not void loadConfig(); QList<DefaultAppItem> getAvailableDefaultItems(Types); DefaultAppItem* getDefaultItem(Types, int); public slots: void appMessage( const QCString& msg, const QByteArray& data ); signals: // Emmitted when the target app receives a request from the source app void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi // The first parameter is a uniqueid. It can be used to identify the event void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); private: ExternalAppHandler(); QList<DefaultAppItem> mDefaultItems; Availability mEmailAppAvailable; Availability mPhoneAppAvailable; Availability mFaxAppAvailable; Availability mSMSAppAvailable; Availability mPagerAppAvailable; + Availability mSIPAppAvailable; QCopListTransferItem* mNameEmailUidListFromKAPITransfer; QCopListTransferItem* mFindByEmailFromKAPITransfer; QCopTransferItem* mDisplayDetails; void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; static ExternalAppHandler *sInstance; }; #endif |