author | zautrix <zautrix> | 2005-03-29 17:05:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-29 17:05:50 (UTC) |
commit | a7c827aa0e555206b60dec3bc07f7afab4352883 (patch) (side-by-side diff) | |
tree | 56dbda15314f27ffabd143d09ea036b092444198 /libkdepim/externalapphandler.cpp | |
parent | 3116f249fc6ccd0e067213e826d3d924f6986972 (diff) | |
download | kdepimpi-a7c827aa0e555206b60dec3bc07f7afab4352883.zip kdepimpi-a7c827aa0e555206b60dec3bc07f7afab4352883.tar.gz kdepimpi-a7c827aa0e555206b60dec3bc07f7afab4352883.tar.bz2 |
fixes
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index f8f4c8a..0d66a5a 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -754,451 +754,458 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e /************************************************************************** * **************************************************************************/ //calls the emailapplication and creates a mail with parameter as recipients // parameters format is // NAME <EMAIL>:SUBJECT bool ExternalAppHandler::mailToOneContact( const QString& adressline ) { QString line = adressline; int first = line.find( "<"); int last = line.find( ">"); QString name = line.left(first); QString emailadress = line.mid(first+1, last-first-1); //Subject can not be handled right now. 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; } + if ( cmsg == "callContactdialog()" ) { + qDebug("callContactdialog()"); + emit callContactdialog(); + 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); // 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 + //qDebug("UID %s ", sessionuid.latin1()); return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); + //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); } 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); } |