Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index fa56ee9..99aee86 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -68,63 +68,63 @@ QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sour } /*********************************************************************************/ QCopTransferItem::QCopTransferItem() { } /*********************************************************************************/ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) { #ifndef DESKTOP_VERSION //sourceMessage passes two parameters: sourceChannel, uid QString sourceMessage = _sourceMessage + _sourceMessageParameters; - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); + qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); e << _sourceChannel << uid; if (_usedSourceParameters == 1) e << param1; else if (_usedSourceParameters == 2) e << param1 << param2; else if (_usedSourceParameters == 3) e << param1 << param2 << param3; qApp->processEvents(); return true; #else KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); return false; #endif } /*********************************************************************************/ void QCopTransferItem::setSourceChannel(const QString& sourceChannel) { - if (_sourceChannel.isEmpty()) + if ( !sourceChannel.isEmpty()) _sourceChannel = sourceChannel; } /*********************************************************************************/ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) { // copied from old mail2 /* static int ii = 0; // block second call if ( ii < 2 ) { ++ii; if ( ii > 1 ) { @@ -184,33 +184,33 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) { //targetMessage returns later two parameters: uid, and map<qstring,qstring> _targetMessageParameters = "(QString,QMAP<QString,QString>)"; } /*********************************************************************************/ bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) { #ifndef DESKTOP_VERSION //targetMessage passes two parameters: uid, map QString targetMessage = _targetMessage + _targetMessageParameters; - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); + qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); //US we need no names in the To field. The emailadresses are enough e << uid << nameEmailMap; qApp->processEvents(); return true; #else KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); return false; #endif @@ -253,62 +253,63 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) { //targetMessage returns later two parameters: uid, and three lists _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; } /*********************************************************************************/ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) { #ifndef DESKTOP_VERSION //targetMessage passes two parameters: uid, map QString targetMessage = _targetMessage + _targetMessageParameters; - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); + qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); //US we need no names in the To field. The emailadresses are enough e << uid << list1 << list2 << list3; qApp->processEvents(); return true; #else KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); return false; #endif } /*********************************************************************************/ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) { bool res = QCopTransferItem::appMessage( cmsg, data ); + qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); if (res == false) { QDataStream stream( data, IO_ReadOnly ); -// qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); + qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); //we are in the source and get an answer from the target if ((_targetMessage + _targetMessageParameters) == cmsg.data()) { QStringList list1; QStringList list2; QStringList list3; QString uid; stream >> uid >> list1 >> list2 >> list3; emit receivedMessageFromTarget(uid, list1, list2, list3); return true; } } @@ -591,33 +592,33 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS { 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("4Using 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); #else KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); #endif return true; } @@ -648,33 +649,33 @@ bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& e DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); if (!dai) { qDebug("could not find configured email 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, name, emailadress); - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); + qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.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, name, emailadress); #else KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); #endif return true; } @@ -725,33 +726,33 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber ) 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, ""); - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); + 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()); 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; } @@ -780,33 +781,33 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber ) 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, ""); - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); + 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()); 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; } @@ -835,33 +836,33 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber ) 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, ""); - qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); + 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()); 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; } @@ -890,33 +891,33 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber ) 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("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()); 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; } @@ -945,33 +946,33 @@ bool ExternalAppHandler::callBySIP( const QString& sipnumber ) 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("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()); 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; } @@ -1051,32 +1052,33 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat 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); } bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) { + mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); } 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) { mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); } |