summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp85
-rw-r--r--libkdepim/externalapphandler.h19
2 files changed, 76 insertions, 28 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 64caa7d..b57506b 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -50,8 +50,8 @@ $Id$
50 ********************************************************************************/ 50 ********************************************************************************/
51 51
52 52
53QCopTransferItem::QCopTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 53QCopTransferItem::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
57 _sourceMessageParameters = "(QString,QString,QString)"; 57 _sourceMessageParameters = "(QString,QString,QString)";
@@ -64,7 +64,7 @@ QCopTransferItem::QCopTransferItem()
64} 64}
65 65
66/*********************************************************************************/ 66/*********************************************************************************/
67bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1) 67bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3)
68{ 68{
69 69
70#ifndef DESKTOP_VERSION 70#ifndef DESKTOP_VERSION
@@ -72,11 +72,19 @@ bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& pa
72 QString sourceMessage = _sourceMessage + _sourceMessageParameters; 72 QString sourceMessage = _sourceMessage + _sourceMessageParameters;
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;
82 90
@@ -124,10 +132,30 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data
124 QString sourceChannel; 132 QString sourceChannel;
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
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
132 return true; 160 return true;
133 } 161 }
@@ -141,8 +169,8 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data
141 ********************************************************************************/ 169 ********************************************************************************/
142 170
143 171
144QCopMapTransferItem::QCopMapTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 172QCopMapTransferItem::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>
148 _targetMessageParameters = "(QString,QMAP<QString,QString>)"; 176 _targetMessageParameters = "(QString,QMAP<QString,QString>)";
@@ -208,10 +236,10 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da
208 ********************************************************************************/ 236 ********************************************************************************/
209 237
210 238
211QCopListTransferItem::QCopListTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 239QCopListTransferItem::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}
217 245
@@ -285,15 +313,16 @@ ExternalAppHandler::ExternalAppHandler()
285{ 313{
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
299ExternalAppHandler::~ExternalAppHandler() 328ExternalAppHandler::~ExternalAppHandler()
@@ -924,36 +953,46 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat
924{ 953{
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 );
929} 961}
930 962
931 963
932 964
933bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid) 965bool 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
939bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 971bool 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
945bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email) 977bool 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
951bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 983bool 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
989bool 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
959 998
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 7c8de4e..a74080f 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -43,10 +43,10 @@ class QCopTransferItem : public QObject
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 QCopTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
47 QCopTransferItem(); 47 QCopTransferItem();
48 48
49 bool sendMessageToTarget(const QString& uid, const QString& param1); 49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
50 50
51 void setSourceChannel(const QString& sourceChannel); 51 void setSourceChannel(const QString& sourceChannel);
52 52
@@ -54,10 +54,14 @@ class QCopTransferItem : public QObject
54 54
55 55
56 signals: 56 signals:
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); 58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1);
59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2);
60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
58 61
59 62
60 public: 63 public:
64 int _usedSourceParameters;
61 QString _sourceChannel; 65 QString _sourceChannel;
62 QString _sourceMessage; 66 QString _sourceMessage;
63 QString _sourceMessageParameters; 67 QString _sourceMessageParameters;
@@ -75,7 +79,7 @@ class QCopMapTransferItem : public QCopTransferItem
75{ 79{
76 Q_OBJECT 80 Q_OBJECT
77 public: 81 public:
78 QCopMapTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 82 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
79 83
80 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 84 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
81 85
@@ -96,7 +100,7 @@ class QCopListTransferItem : public QCopTransferItem
96{ 100{
97 Q_OBJECT 101 Q_OBJECT
98 public: 102 public:
99 QCopListTransferItem(const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 103 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
100 104
101 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); 105 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3);
102 106
@@ -201,6 +205,8 @@ class ExternalAppHandler : public QObject
201 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email); 205 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email);
202 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); 206 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid);
203 207
208 bool requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
209
204 210
205 //loadConfig clears the cache and checks again if the applications are available or not 211 //loadConfig clears the cache and checks again if the applications are available or not
206 void loadConfig(); 212 void loadConfig();
@@ -214,7 +220,7 @@ class ExternalAppHandler : public QObject
214 220
215 signals: 221 signals:
216 // Emmitted when the target app receives a request from the source app 222 // Emmitted when the target app receives a request from the source app
217 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid, const QString& param1); 223 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
218 224
219 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 225 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
220 // The first parameter is a uniqueid. It can be used to identify the event 226 // The first parameter is a uniqueid. It can be used to identify the event
@@ -223,6 +229,8 @@ class ExternalAppHandler : public QObject
223 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 229 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
224 void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 230 void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
225 231
232 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
233
226 234
227 private: 235 private:
228 ExternalAppHandler(); 236 ExternalAppHandler();
@@ -236,6 +244,7 @@ class ExternalAppHandler : public QObject
236 244
237 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 245 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
238 QCopListTransferItem* mFindByEmailFromKAPITransfer; 246 QCopListTransferItem* mFindByEmailFromKAPITransfer;
247 QCopTransferItem* mDisplayDetails;
239 248
240 249
241 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); 250 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);