author | zautrix <zautrix> | 2005-03-29 14:23:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 14:23:43 (UTC) |
commit | 3116f249fc6ccd0e067213e826d3d924f6986972 (patch) (side-by-side diff) | |
tree | fe37b19450279d07b6767d56ef0deeff51f7485e /libkdepim/externalapphandler.cpp | |
parent | c873163eca527625ce22ed461ee5d4fec61b3b18 (diff) | |
download | kdepimpi-3116f249fc6ccd0e067213e826d3d924f6986972.zip kdepimpi-3116f249fc6ccd0e067213e826d3d924f6986972.tar.gz kdepimpi-3116f249fc6ccd0e067213e826d3d924f6986972.tar.bz2 |
fix
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 7200da9..f8f4c8a 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -771,431 +771,434 @@ bool ExternalAppHandler::mailToOneContact( const QString& adressline ) return mailToOneContact( name, emailadress ); } /************************************************************************** * **************************************************************************/ //calls the phoneapplication with the number bool ExternalAppHandler::callByPhone( const QString& phonenumber ) { #ifndef DESKTOP_VERSION QString channel; QString message; QString parameters; int client = KPimGlobalPrefs::instance()->mPhoneClient; if (client == KPimGlobalPrefs::OTHER_PHC) { channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; } else { DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); if (!dai) { qDebug("could not find configured phone 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, phonenumber, ""); #ifdef DEBUG_EXT_APP_HANDLER qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); #endif QCopEnvelope e(channel.latin1(), message.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters, phonenumber, ""); #else KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); #endif return true; } /************************************************************************** * **************************************************************************/ //calls the smsapplication with the number bool ExternalAppHandler::callBySMS( const QString& phonenumber ) { #ifndef DESKTOP_VERSION QString channel; QString message; QString parameters; int client = KPimGlobalPrefs::instance()->mSMSClient; if (client == KPimGlobalPrefs::OTHER_SMC) { channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; message = KPimGlobalPrefs::instance()->mSMSOtherMessage; parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; } else { DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); if (!dai) { qDebug("could not find configured sms 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, phonenumber, ""); #ifdef DEBUG_EXT_APP_HANDLER qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); #endif QCopEnvelope e(channel.latin1(), message.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters, phonenumber, ""); #else KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); #endif return true; } /************************************************************************** * **************************************************************************/ //calls the pagerapplication with the number bool ExternalAppHandler::callByPager( const QString& pagernumber ) { #ifndef DESKTOP_VERSION QString channel; QString message; QString parameters; int client = KPimGlobalPrefs::instance()->mPagerClient; if (client == KPimGlobalPrefs::OTHER_PAC) { channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; message = KPimGlobalPrefs::instance()->mPagerOtherMessage; parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; } else { DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); if (!dai) { qDebug("could not find configured pager 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, pagernumber, ""); #ifdef DEBUG_EXT_APP_HANDLER qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); #endif QCopEnvelope e(channel.latin1(), message.latin1()); //US we need no names in the To field. The emailadresses are enough passParameters(&e, parameters, pagernumber, ""); #else KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); #endif return true; } /************************************************************************** * **************************************************************************/ //calls the faxapplication with the number bool ExternalAppHandler::callByFax( const QString& faxnumber ) { #ifndef DESKTOP_VERSION QString channel; QString message; QString parameters; 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, ""); #ifdef DEBUG_EXT_APP_HANDLER qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); #endif 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, ""); #ifdef DEBUG_EXT_APP_HANDLER qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); #endif 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; } } if (useValMap == true) (*e) << valmap; #endif } /************************************************************************** * **************************************************************************/ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) { if ( cmsg == "nextView()" ) { qDebug("nextView()"); emit nextView(); return; } bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); if (!res) res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); if (!res) res = mDisplayDetails->appMessage( cmsg, data ); // if (!res) // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); } bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) { mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); - return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); + // maybe we are sending to KA/Pi fom a different worldd... + // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application + // for that reason we send the current QApplication::desktop()->width() to KA/Pi + return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); } bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) { QStringList list4, list5, list6; mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); } bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) { mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); } bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) { QStringList list4, list5, list6; mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); } bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) { mDisplayDetails->setSourceChannel(""); return mDisplayDetails->sendMessageToTarget("", name, email, uid); } bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) { mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); } bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) { mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); } |