Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 87 |
1 files changed, 63 insertions, 24 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 64caa7d..b57506b 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -51,6 +51,6 @@ $Id$ | |||
51 | 51 | ||
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 | { |
56 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 56 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
@@ -65,5 +65,5 @@ QCopTransferItem::QCopTransferItem() | |||
65 | 65 | ||
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 | { |
69 | 69 | ||
@@ -73,9 +73,17 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa | |||
73 | 73 | ||
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 | ||
77 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 77 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
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 | ||
81 | return true; | 89 | return true; |
@@ -125,8 +133,28 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data | |||
125 | QString uid; | 133 | QString uid; |
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 | ||
130 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 140 | if (_usedSourceParameters == 0) |
141 | { | ||
142 | emit receivedMessageFromSource(sourceChannel, uid); | ||
143 | } | ||
144 | else if (_usedSourceParameters == 1) | ||
145 | { | ||
146 | stream >> 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 | ||
132 | return true; | 160 | return true; |
@@ -142,6 +170,6 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data | |||
142 | 170 | ||
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 | { |
147 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 175 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
@@ -209,8 +237,8 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da | |||
209 | 237 | ||
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)"; |
216 | } | 244 | } |
@@ -286,13 +314,14 @@ ExternalAppHandler::ExternalAppHandler() | |||
286 | mDefaultItems.setAutoDelete(true); | 314 | mDefaultItems.setAutoDelete(true); |
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&))); |
294 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 322 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
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 | } |
298 | 327 | ||
@@ -925,4 +954,7 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat | |||
925 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 954 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
926 | 955 | ||
956 | if (!res) | ||
957 | res = mDisplayDetails->appMessage( cmsg, data ); | ||
958 | |||
927 | // if (!res) | 959 | // if (!res) |
928 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 960 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
@@ -931,28 +963,35 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat | |||
931 | 963 | ||
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 | ||
958 | 997 | ||