summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorulf69 <ulf69>2004-08-19 00:33:04 (UTC)
committer ulf69 <ulf69>2004-08-19 00:33:04 (UTC)
commit00101d27c9305ac3163e1a0c8ed27408b41fa192 (patch) (side-by-side diff)
tree3051c96ef71245c97fb18d0804749e7d04bd4ad2 /libkdepim
parent05a1b5cbea6a7c1a7500632f8e7c1bf5be9328d8 (diff)
downloadkdepimpi-00101d27c9305ac3163e1a0c8ed27408b41fa192.zip
kdepimpi-00101d27c9305ac3163e1a0c8ed27408b41fa192.tar.gz
kdepimpi-00101d27c9305ac3163e1a0c8ed27408b41fa192.tar.bz2
code cleanup
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp52
-rw-r--r--libkdepim/externalapphandler.h10
2 files changed, 40 insertions, 22 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index b57506b..bd83626 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -33,9 +33,12 @@ $Id$
#include <qmap.h>
#include <qregexp.h>
#ifndef DESKTOP_VERSION
+#include <qpe/qpeapplication.h>
#include <qtopia/qcopenvelope_qws.h>
+#else
+#include <qapplication.h>
#endif
#include <kstaticdeleter.h>
#include <kmessagebox.h>
@@ -53,9 +56,16 @@ $Id$
QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
: _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)";
}
/*********************************************************************************/
@@ -71,9 +81,9 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa
//sourceMessage passes two parameters: sourceChannel, uid
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());
e << _sourceChannel << uid;
@@ -84,8 +94,9 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa
e << param1 << param2;
else if (_usedSourceParameters == 3)
e << param1 << param2 << param3;
+ qApp->processEvents();
return true;
#else
@@ -107,26 +118,29 @@ 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 );
QString sourceChannel;
@@ -190,8 +204,10 @@ bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QSt
//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." ) );
@@ -209,9 +225,9 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da
if (res == false)
{
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())
{
@@ -257,8 +273,10 @@ bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QString
//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." ) );
@@ -276,9 +294,9 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d
if (res == false)
{
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())
{
@@ -321,9 +339,9 @@ ExternalAppHandler::ExternalAppHandler()
//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&)), 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()
{
@@ -985,12 +1003,12 @@ bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel,
mFindByEmailFromKAPITransfer->setSourceChannel(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);
}
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index a74080f..1b04b2b 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -197,16 +197,16 @@ class ExternalAppHandler : public QObject
bool isPagerAppAvailable();
//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& uid);
+ 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& uid, const QStringList& name, const QStringList& email, const QStringList& uid);
+ bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
- bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email);
- bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, 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& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& 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();