From 00101d27c9305ac3163e1a0c8ed27408b41fa192 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Thu, 19 Aug 2004 00:33:04 +0000 Subject: code cleanup --- (limited to 'libkdepim/externalapphandler.cpp') diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index b57506b..bd83626 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp @@ -34,7 +34,10 @@ $Id$ #include #ifndef DESKTOP_VERSION +#include #include +#else +#include #endif #include @@ -54,7 +57,14 @@ QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sour : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) { //sourceMessage passes later three parameters: sourceChannel, uid, param1 - _sourceMessageParameters = "(QString,QString,QString)"; + if (_usedSourceParameters == 0) + _sourceMessageParameters = "(QString,QString)"; + else if (_usedSourceParameters == 1) + _sourceMessageParameters = "(QString,QString,QString)"; + else if (_usedSourceParameters == 2) + _sourceMessageParameters = "(QString,QString,QString,QString)"; + else if (_usedSourceParameters == 3) + _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; } /*********************************************************************************/ @@ -72,7 +82,7 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa QString sourceMessage = _sourceMessage + _sourceMessageParameters; qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); - qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param3(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.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()); @@ -85,6 +95,7 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa else if (_usedSourceParameters == 3) e << param1 << param2 << param3; + qApp->processEvents(); return true; @@ -108,24 +119,27 @@ void QCopTransferItem::setSourceChannel(const QString& sourceChannel) /*********************************************************************************/ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) { -/*US + // copied from old mail2 +/* static int ii = 0; - // block second call - if ( ii < 2 ) { - ++ii; - if ( ii > 1 ) { - qDebug("qcop call blocked "); - return true; + // block second call + if ( ii < 2 ) { + ++ii; + if ( ii > 1 ) { + qDebug("qcop call blocked "); + return true; + } } - } */ - qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); + +// qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); //we are in the target and get a request from the source if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) { + QDataStream stream( data, IO_ReadOnly ); @@ -191,6 +205,8 @@ bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMapprocessEvents(); + return true; #else @@ -210,7 +226,7 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da { QDataStream stream( data, IO_ReadOnly ); - qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); +// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); //we are in the source and get an answer from the target if ((_targetMessage + _targetMessageParameters) == cmsg.data()) @@ -258,6 +274,8 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString e << uid << list1 << list2 << list3; + qApp->processEvents(); + return true; #else @@ -277,7 +295,7 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d { QDataStream stream( data, IO_ReadOnly ); - qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); +// qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); //we are in the source and get an answer from the target if ((_targetMessage + _targetMessageParameters) == cmsg.data()) @@ -322,7 +340,7 @@ ExternalAppHandler::ExternalAppHandler() //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&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); + 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() @@ -986,10 +1004,10 @@ bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); } -bool ExternalAppHandler::requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) +bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) { - mDisplayDetails->setSourceChannel(sourceChannel); - return mDisplayDetails->sendMessageToTarget(sessionuid, name, email, uid); + mDisplayDetails->setSourceChannel(""); + return mDisplayDetails->sendMessageToTarget("", name, email, uid); } -- cgit v0.9.0.2