Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 85 |
1 files changed, 62 insertions, 23 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 64caa7d..b57506b 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -52,4 +52,4 @@ $Id$ | |||
52 | 52 | ||
53 | QCopTransferItem::QCopTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 53 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
54 | : _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 54 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
55 | { | 55 | { |
@@ -66,3 +66,3 @@ QCopTransferItem::QCopTransferItem() | |||
66 | /*********************************************************************************/ | 66 | /*********************************************************************************/ |
67 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1) | 67 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
68 | { | 68 | { |
@@ -74,3 +74,3 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa | |||
74 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 74 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
75 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1()); | 75 | 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()); |
76 | 76 | ||
@@ -78,3 +78,11 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa | |||
78 | 78 | ||
79 | e << _sourceChannel << uid << param1; | 79 | e << _sourceChannel << uid; |
80 | |||
81 | if (_usedSourceParameters == 1) | ||
82 | e << param1; | ||
83 | else if (_usedSourceParameters == 2) | ||
84 | e << param1 << param2; | ||
85 | else if (_usedSourceParameters == 3) | ||
86 | e << param1 << param2 << param3; | ||
87 | |||
80 | 88 | ||
@@ -126,6 +134,26 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data | |||
126 | QString param1; | 134 | QString param1; |
135 | QString param2; | ||
136 | QString param3; | ||
127 | 137 | ||
128 | stream >> sourceChannel >> uid >> param1; | 138 | stream >> sourceChannel >> uid; |
129 | 139 | ||
140 | if (_usedSourceParameters == 0) | ||
141 | { | ||
142 | emit receivedMessageFromSource(sourceChannel, uid); | ||
143 | } | ||
144 | else if (_usedSourceParameters == 1) | ||
145 | { | ||
146 | stream >> param1; | ||
130 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 147 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
148 | } | ||
149 | else if (_usedSourceParameters == 2) | ||
150 | { | ||
151 | stream >> param1 >> param2; | ||
152 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | ||
153 | } | ||
154 | else if (_usedSourceParameters == 3) | ||
155 | { | ||
156 | stream >> param1 >> param2 >> param3; | ||
157 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); | ||
158 | } | ||
131 | 159 | ||
@@ -143,4 +171,4 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data | |||
143 | 171 | ||
144 | QCopMapTransferItem::QCopMapTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 172 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
145 | : QCopTransferItem(sourceMessage, targetChannel,targetMessage) | 173 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
146 | { | 174 | { |
@@ -210,6 +238,6 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da | |||
210 | 238 | ||
211 | QCopListTransferItem::QCopListTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 239 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
212 | : QCopTransferItem(sourceMessage, targetChannel,targetMessage) | 240 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
213 | { | 241 | { |
214 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 242 | //targetMessage returns later two parameters: uid, and three lists |
215 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; | 243 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; |
@@ -287,7 +315,7 @@ ExternalAppHandler::ExternalAppHandler() | |||
287 | 315 | ||
288 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem("requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 316 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
289 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&, const QString&))); | 317 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
290 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 318 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
291 | 319 | ||
292 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem("requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 320 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
293 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 321 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
@@ -295,3 +323,4 @@ ExternalAppHandler::ExternalAppHandler() | |||
295 | 323 | ||
296 | 324 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | |
325 | 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&))); | ||
297 | } | 326 | } |
@@ -926,2 +955,5 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat | |||
926 | 955 | ||
956 | if (!res) | ||
957 | res = mDisplayDetails->appMessage( cmsg, data ); | ||
958 | |||
927 | // if (!res) | 959 | // if (!res) |
@@ -932,26 +964,33 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat | |||
932 | 964 | ||
933 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid) | 965 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
934 | { | 966 | { |
935 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 967 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
936 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(uid, QString::null); | 968 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); |
937 | } | 969 | } |
938 | 970 | ||
939 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 971 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
940 | { | 972 | { |
941 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 973 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
942 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(uid, list1, list2, list3); | 974 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); |
943 | } | 975 | } |
944 | 976 | ||
945 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email) | 977 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) |
946 | { | 978 | { |
947 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 979 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
948 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(uid, email); | 980 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
949 | } | 981 | } |
950 | 982 | ||
951 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 983 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
952 | { | 984 | { |
953 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 985 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
954 | return mFindByEmailFromKAPITransfer->sendMessageToSource(uid, list1, list2, list3); | 986 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); |
955 | } | 987 | } |
956 | 988 | ||
989 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | ||
990 | { | ||
991 | mDisplayDetails->setSourceChannel(sourceChannel); | ||
992 | return mDisplayDetails->sendMessageToTarget(sessionuid, name, email, uid); | ||
993 | } | ||
994 | |||
995 | |||
957 | 996 | ||