author | ulf69 <ulf69> | 2004-08-18 21:11:43 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-18 21:11:43 (UTC) |
commit | 05a1b5cbea6a7c1a7500632f8e7c1bf5be9328d8 (patch) (unidiff) | |
tree | 605819f51c314d137f24281f1ed4854b2086aa68 | |
parent | 7d15927b7e7957a80da335587598e7b62dece1a4 (diff) | |
download | kdepimpi-05a1b5cbea6a7c1a7500632f8e7c1bf5be9328d8.zip kdepimpi-05a1b5cbea6a7c1a7500632f8e7c1bf5be9328d8.tar.gz kdepimpi-05a1b5cbea6a7c1a7500632f8e7c1bf5be9328d8.tar.bz2 |
added new QCop method requestForDetails
-rw-r--r-- | libkdepim/externalapphandler.cpp | 87 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 19 |
2 files changed, 77 insertions, 29 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 64caa7d..b57506b 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -1,959 +1,998 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | #include <qtopia/qcopenvelope_qws.h> | 37 | #include <qtopia/qcopenvelope_qws.h> |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | #include <kstaticdeleter.h> | 40 | #include <kstaticdeleter.h> |
41 | #include <kmessagebox.h> | 41 | #include <kmessagebox.h> |
42 | 42 | ||
43 | 43 | ||
44 | #include "externalapphandler.h" | 44 | #include "externalapphandler.h" |
45 | 45 | ||
46 | #include "kpimglobalprefs.h" | 46 | #include "kpimglobalprefs.h" |
47 | 47 | ||
48 | /********************************************************************************* | 48 | /********************************************************************************* |
49 | * | 49 | * |
50 | ********************************************************************************/ | 50 | ********************************************************************************/ |
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 |
57 | _sourceMessageParameters = "(QString,QString,QString)"; | 57 | _sourceMessageParameters = "(QString,QString,QString)"; |
58 | } | 58 | } |
59 | 59 | ||
60 | /*********************************************************************************/ | 60 | /*********************************************************************************/ |
61 | 61 | ||
62 | QCopTransferItem::QCopTransferItem() | 62 | QCopTransferItem::QCopTransferItem() |
63 | { | 63 | { |
64 | } | 64 | } |
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 | ||
70 | #ifndef DESKTOP_VERSION | 70 | #ifndef DESKTOP_VERSION |
71 | //sourceMessage passes two parameters: sourceChannel, uid | 71 | //sourceMessage passes two parameters: sourceChannel, uid |
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 | ||
83 | #else | 91 | #else |
84 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 92 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
85 | return false; | 93 | return false; |
86 | #endif | 94 | #endif |
87 | 95 | ||
88 | } | 96 | } |
89 | 97 | ||
90 | 98 | ||
91 | /*********************************************************************************/ | 99 | /*********************************************************************************/ |
92 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 100 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
93 | { | 101 | { |
94 | 102 | ||
95 | if (_sourceChannel.isEmpty()) | 103 | if (_sourceChannel.isEmpty()) |
96 | _sourceChannel = sourceChannel; | 104 | _sourceChannel = sourceChannel; |
97 | } | 105 | } |
98 | 106 | ||
99 | 107 | ||
100 | /*********************************************************************************/ | 108 | /*********************************************************************************/ |
101 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 109 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
102 | { | 110 | { |
103 | /*US | 111 | /*US |
104 | // copied from old mail2 | 112 | // copied from old mail2 |
105 | static int ii = 0; | 113 | static int ii = 0; |
106 | 114 | ||
107 | // block second call | 115 | // block second call |
108 | if ( ii < 2 ) { | 116 | if ( ii < 2 ) { |
109 | ++ii; | 117 | ++ii; |
110 | if ( ii > 1 ) { | 118 | if ( ii > 1 ) { |
111 | qDebug("qcop call blocked "); | 119 | qDebug("qcop call blocked "); |
112 | return true; | 120 | return true; |
113 | } | 121 | } |
114 | } | 122 | } |
115 | */ | 123 | */ |
116 | qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 124 | qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
117 | 125 | ||
118 | //we are in the target and get a request from the source | 126 | //we are in the target and get a request from the source |
119 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 127 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
120 | { | 128 | { |
121 | QDataStream stream( data, IO_ReadOnly ); | 129 | QDataStream stream( data, IO_ReadOnly ); |
122 | 130 | ||
123 | 131 | ||
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 | ||
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; |
133 | } | 161 | } |
134 | 162 | ||
135 | return false; | 163 | return false; |
136 | } | 164 | } |
137 | 165 | ||
138 | 166 | ||
139 | /********************************************************************************* | 167 | /********************************************************************************* |
140 | * | 168 | * |
141 | ********************************************************************************/ | 169 | ********************************************************************************/ |
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> |
148 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 176 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
149 | } | 177 | } |
150 | 178 | ||
151 | /*********************************************************************************/ | 179 | /*********************************************************************************/ |
152 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 180 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
153 | { | 181 | { |
154 | #ifndef DESKTOP_VERSION | 182 | #ifndef DESKTOP_VERSION |
155 | //targetMessage passes two parameters: uid, map | 183 | //targetMessage passes two parameters: uid, map |
156 | QString targetMessage = _targetMessage + _targetMessageParameters; | 184 | QString targetMessage = _targetMessage + _targetMessageParameters; |
157 | 185 | ||
158 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 186 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
159 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 187 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
160 | 188 | ||
161 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 189 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
162 | //US we need no names in the To field. The emailadresses are enough | 190 | //US we need no names in the To field. The emailadresses are enough |
163 | 191 | ||
164 | e << uid << nameEmailMap; | 192 | e << uid << nameEmailMap; |
165 | 193 | ||
166 | return true; | 194 | return true; |
167 | 195 | ||
168 | #else | 196 | #else |
169 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 197 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
170 | return false; | 198 | return false; |
171 | #endif | 199 | #endif |
172 | 200 | ||
173 | } | 201 | } |
174 | 202 | ||
175 | 203 | ||
176 | /*********************************************************************************/ | 204 | /*********************************************************************************/ |
177 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 205 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
178 | { | 206 | { |
179 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 207 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
180 | 208 | ||
181 | if (res == false) | 209 | if (res == false) |
182 | { | 210 | { |
183 | QDataStream stream( data, IO_ReadOnly ); | 211 | QDataStream stream( data, IO_ReadOnly ); |
184 | 212 | ||
185 | qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 213 | qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
186 | 214 | ||
187 | //we are in the source and get an answer from the target | 215 | //we are in the source and get an answer from the target |
188 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 216 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
189 | { | 217 | { |
190 | QMap<QString,QString> adrMap; | 218 | QMap<QString,QString> adrMap; |
191 | QString uid; | 219 | QString uid; |
192 | 220 | ||
193 | stream >> uid >> adrMap; | 221 | stream >> uid >> adrMap; |
194 | 222 | ||
195 | emit receivedMessageFromTarget(uid, adrMap); | 223 | emit receivedMessageFromTarget(uid, adrMap); |
196 | 224 | ||
197 | 225 | ||
198 | return true; | 226 | return true; |
199 | } | 227 | } |
200 | } | 228 | } |
201 | 229 | ||
202 | return false; | 230 | return false; |
203 | } | 231 | } |
204 | 232 | ||
205 | 233 | ||
206 | /********************************************************************************* | 234 | /********************************************************************************* |
207 | * | 235 | * |
208 | ********************************************************************************/ | 236 | ********************************************************************************/ |
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 | } |
217 | 245 | ||
218 | /*********************************************************************************/ | 246 | /*********************************************************************************/ |
219 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 247 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
220 | { | 248 | { |
221 | #ifndef DESKTOP_VERSION | 249 | #ifndef DESKTOP_VERSION |
222 | //targetMessage passes two parameters: uid, map | 250 | //targetMessage passes two parameters: uid, map |
223 | QString targetMessage = _targetMessage + _targetMessageParameters; | 251 | QString targetMessage = _targetMessage + _targetMessageParameters; |
224 | 252 | ||
225 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 253 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
226 | qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); | 254 | qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); |
227 | 255 | ||
228 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 256 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
229 | //US we need no names in the To field. The emailadresses are enough | 257 | //US we need no names in the To field. The emailadresses are enough |
230 | 258 | ||
231 | e << uid << list1 << list2 << list3; | 259 | e << uid << list1 << list2 << list3; |
232 | 260 | ||
233 | return true; | 261 | return true; |
234 | 262 | ||
235 | #else | 263 | #else |
236 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 264 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
237 | return false; | 265 | return false; |
238 | #endif | 266 | #endif |
239 | 267 | ||
240 | } | 268 | } |
241 | 269 | ||
242 | 270 | ||
243 | /*********************************************************************************/ | 271 | /*********************************************************************************/ |
244 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 272 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
245 | { | 273 | { |
246 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 274 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
247 | 275 | ||
248 | if (res == false) | 276 | if (res == false) |
249 | { | 277 | { |
250 | QDataStream stream( data, IO_ReadOnly ); | 278 | QDataStream stream( data, IO_ReadOnly ); |
251 | 279 | ||
252 | qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 280 | qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
253 | 281 | ||
254 | //we are in the source and get an answer from the target | 282 | //we are in the source and get an answer from the target |
255 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 283 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
256 | { | 284 | { |
257 | QStringList list1; | 285 | QStringList list1; |
258 | QStringList list2; | 286 | QStringList list2; |
259 | QStringList list3; | 287 | QStringList list3; |
260 | QString uid; | 288 | QString uid; |
261 | 289 | ||
262 | stream >> uid >> list1 >> list2 >> list3; | 290 | stream >> uid >> list1 >> list2 >> list3; |
263 | 291 | ||
264 | emit receivedMessageFromTarget(uid, list1, list2, list3); | 292 | emit receivedMessageFromTarget(uid, list1, list2, list3); |
265 | 293 | ||
266 | 294 | ||
267 | return true; | 295 | return true; |
268 | } | 296 | } |
269 | } | 297 | } |
270 | 298 | ||
271 | return false; | 299 | return false; |
272 | } | 300 | } |
273 | 301 | ||
274 | 302 | ||
275 | 303 | ||
276 | /********************************************************************************* | 304 | /********************************************************************************* |
277 | * | 305 | * |
278 | ********************************************************************************/ | 306 | ********************************************************************************/ |
279 | 307 | ||
280 | 308 | ||
281 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 309 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
282 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 310 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
283 | 311 | ||
284 | ExternalAppHandler::ExternalAppHandler() | 312 | 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 | ||
299 | ExternalAppHandler::~ExternalAppHandler() | 328 | ExternalAppHandler::~ExternalAppHandler() |
300 | { | 329 | { |
301 | } | 330 | } |
302 | 331 | ||
303 | void ExternalAppHandler::loadConfig() | 332 | void ExternalAppHandler::loadConfig() |
304 | { | 333 | { |
305 | 334 | ||
306 | mDefaultItems.clear(); | 335 | mDefaultItems.clear(); |
307 | 336 | ||
308 | mEmailAppAvailable = UNDEFINED; | 337 | mEmailAppAvailable = UNDEFINED; |
309 | mPhoneAppAvailable = UNDEFINED; | 338 | mPhoneAppAvailable = UNDEFINED; |
310 | mFaxAppAvailable = UNDEFINED; | 339 | mFaxAppAvailable = UNDEFINED; |
311 | mSMSAppAvailable = UNDEFINED; | 340 | mSMSAppAvailable = UNDEFINED; |
312 | mPagerAppAvailable = UNDEFINED; | 341 | mPagerAppAvailable = UNDEFINED; |
313 | 342 | ||
314 | 343 | ||
315 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 344 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
316 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 345 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
317 | 346 | ||
318 | if (opiepath.isEmpty()) | 347 | if (opiepath.isEmpty()) |
319 | opiepath = qtopiapath; | 348 | opiepath = qtopiapath; |
320 | 349 | ||
321 | //mailclients | 350 | //mailclients |
322 | QString mailmsg1 = "writeMail(QString,QString)"; | 351 | QString mailmsg1 = "writeMail(QString,QString)"; |
323 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 352 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
324 | 353 | ||
325 | QString undefined = ""; | 354 | QString undefined = ""; |
326 | 355 | ||
327 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 356 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
328 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 357 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
329 | 358 | ||
330 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 359 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
331 | ( QFile::exists( opiepath + "/bin/ompi" ))) | 360 | ( QFile::exists( opiepath + "/bin/ompi" ))) |
332 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 361 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
333 | 362 | ||
334 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) | 363 | if ( QFile::exists( qtopiapath + "/bin/qtmail" )) |
335 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 364 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
336 | 365 | ||
337 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 366 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
338 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 367 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
339 | 368 | ||
340 | 369 | ||
341 | 370 | ||
342 | //phoneclients | 371 | //phoneclients |
343 | 372 | ||
344 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); | 373 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); |
345 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); | 374 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); |
346 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 375 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
347 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 376 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
348 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 377 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
349 | 378 | ||
350 | //faxclients | 379 | //faxclients |
351 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 380 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
352 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 381 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
353 | 382 | ||
354 | //smsclients | 383 | //smsclients |
355 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 384 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
356 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 385 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
357 | 386 | ||
358 | //pagerclients | 387 | //pagerclients |
359 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 388 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
360 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 389 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
361 | 390 | ||
362 | } | 391 | } |
363 | 392 | ||
364 | ExternalAppHandler *ExternalAppHandler::instance() | 393 | ExternalAppHandler *ExternalAppHandler::instance() |
365 | { | 394 | { |
366 | if ( !sInstance ) { | 395 | if ( !sInstance ) { |
367 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 396 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
368 | sInstance->loadConfig(); | 397 | sInstance->loadConfig(); |
369 | } | 398 | } |
370 | 399 | ||
371 | return sInstance; | 400 | return sInstance; |
372 | } | 401 | } |
373 | 402 | ||
374 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 403 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
375 | { | 404 | { |
376 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 405 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
377 | 406 | ||
378 | mDefaultItems.append(dai); | 407 | mDefaultItems.append(dai); |
379 | } | 408 | } |
380 | 409 | ||
381 | 410 | ||
382 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 411 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
383 | { | 412 | { |
384 | QList<DefaultAppItem> list; | 413 | QList<DefaultAppItem> list; |
385 | 414 | ||
386 | DefaultAppItem* dai; | 415 | DefaultAppItem* dai; |
387 | 416 | ||
388 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 417 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
389 | { | 418 | { |
390 | if (dai->_type == type) | 419 | if (dai->_type == type) |
391 | list.append(dai); | 420 | list.append(dai); |
392 | } | 421 | } |
393 | 422 | ||
394 | return list; | 423 | return list; |
395 | } | 424 | } |
396 | 425 | ||
397 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 426 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
398 | { | 427 | { |
399 | DefaultAppItem* dai; | 428 | DefaultAppItem* dai; |
400 | 429 | ||
401 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 430 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
402 | { | 431 | { |
403 | if (dai->_type == type && dai->_id == clientid) | 432 | if (dai->_type == type && dai->_id == clientid) |
404 | return dai; | 433 | return dai; |
405 | } | 434 | } |
406 | 435 | ||
407 | return 0; | 436 | return 0; |
408 | } | 437 | } |
409 | 438 | ||
410 | bool ExternalAppHandler::isEmailAppAvailable() | 439 | bool ExternalAppHandler::isEmailAppAvailable() |
411 | { | 440 | { |
412 | #ifndef DESKTOP_VERSION | 441 | #ifndef DESKTOP_VERSION |
413 | if (mEmailAppAvailable == UNDEFINED) | 442 | if (mEmailAppAvailable == UNDEFINED) |
414 | { | 443 | { |
415 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 444 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
416 | if (client == KPimGlobalPrefs::NONE_EMC) | 445 | if (client == KPimGlobalPrefs::NONE_EMC) |
417 | mEmailAppAvailable = UNAVAILABLE; | 446 | mEmailAppAvailable = UNAVAILABLE; |
418 | else | 447 | else |
419 | mEmailAppAvailable = AVAILABLE; | 448 | mEmailAppAvailable = AVAILABLE; |
420 | } | 449 | } |
421 | return (mEmailAppAvailable == AVAILABLE); | 450 | return (mEmailAppAvailable == AVAILABLE); |
422 | 451 | ||
423 | #else //DESKTOP_VERSION | 452 | #else //DESKTOP_VERSION |
424 | return false; | 453 | return false; |
425 | #endif //DESKTOP_VERSION | 454 | #endif //DESKTOP_VERSION |
426 | } | 455 | } |
427 | 456 | ||
428 | bool ExternalAppHandler::isSMSAppAvailable() | 457 | bool ExternalAppHandler::isSMSAppAvailable() |
429 | { | 458 | { |
430 | #ifndef DESKTOP_VERSION | 459 | #ifndef DESKTOP_VERSION |
431 | if (mSMSAppAvailable == UNDEFINED) | 460 | if (mSMSAppAvailable == UNDEFINED) |
432 | { | 461 | { |
433 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 462 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
434 | if (client == KPimGlobalPrefs::NONE_SMC) | 463 | if (client == KPimGlobalPrefs::NONE_SMC) |
435 | mSMSAppAvailable = UNAVAILABLE; | 464 | mSMSAppAvailable = UNAVAILABLE; |
436 | else | 465 | else |
437 | mSMSAppAvailable = AVAILABLE; | 466 | mSMSAppAvailable = AVAILABLE; |
438 | } | 467 | } |
439 | 468 | ||
440 | return (mSMSAppAvailable == AVAILABLE); | 469 | return (mSMSAppAvailable == AVAILABLE); |
441 | #else //DESKTOP_VERSION | 470 | #else //DESKTOP_VERSION |
442 | return false; | 471 | return false; |
443 | #endif //DESKTOP_VERSION | 472 | #endif //DESKTOP_VERSION |
444 | } | 473 | } |
445 | 474 | ||
446 | bool ExternalAppHandler::isPhoneAppAvailable() | 475 | bool ExternalAppHandler::isPhoneAppAvailable() |
447 | { | 476 | { |
448 | #ifndef DESKTOP_VERSION | 477 | #ifndef DESKTOP_VERSION |
449 | if (mPhoneAppAvailable == UNDEFINED) | 478 | if (mPhoneAppAvailable == UNDEFINED) |
450 | { | 479 | { |
451 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 480 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
452 | if (client == KPimGlobalPrefs::NONE_PHC) | 481 | if (client == KPimGlobalPrefs::NONE_PHC) |
453 | mPhoneAppAvailable = UNAVAILABLE; | 482 | mPhoneAppAvailable = UNAVAILABLE; |
454 | else | 483 | else |
455 | mPhoneAppAvailable = AVAILABLE; | 484 | mPhoneAppAvailable = AVAILABLE; |
456 | } | 485 | } |
457 | 486 | ||
458 | return (mPhoneAppAvailable == AVAILABLE); | 487 | return (mPhoneAppAvailable == AVAILABLE); |
459 | #else //DESKTOP_VERSION | 488 | #else //DESKTOP_VERSION |
460 | return false; | 489 | return false; |
461 | #endif //DESKTOP_VERSION | 490 | #endif //DESKTOP_VERSION |
462 | } | 491 | } |
463 | 492 | ||
464 | bool ExternalAppHandler::isFaxAppAvailable() | 493 | bool ExternalAppHandler::isFaxAppAvailable() |
465 | { | 494 | { |
466 | #ifndef DESKTOP_VERSION | 495 | #ifndef DESKTOP_VERSION |
467 | if (mFaxAppAvailable == UNDEFINED) | 496 | if (mFaxAppAvailable == UNDEFINED) |
468 | { | 497 | { |
469 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 498 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
470 | if (client == KPimGlobalPrefs::NONE_FAC) | 499 | if (client == KPimGlobalPrefs::NONE_FAC) |
471 | mFaxAppAvailable = UNAVAILABLE; | 500 | mFaxAppAvailable = UNAVAILABLE; |
472 | else | 501 | else |
473 | mFaxAppAvailable = AVAILABLE; | 502 | mFaxAppAvailable = AVAILABLE; |
474 | } | 503 | } |
475 | 504 | ||
476 | return (mFaxAppAvailable == AVAILABLE); | 505 | return (mFaxAppAvailable == AVAILABLE); |
477 | #else //DESKTOP_VERSION | 506 | #else //DESKTOP_VERSION |
478 | return false; | 507 | return false; |
479 | #endif //DESKTOP_VERSION | 508 | #endif //DESKTOP_VERSION |
480 | } | 509 | } |
481 | 510 | ||
482 | bool ExternalAppHandler::isPagerAppAvailable() | 511 | bool ExternalAppHandler::isPagerAppAvailable() |
483 | { | 512 | { |
484 | #ifndef DESKTOP_VERSION | 513 | #ifndef DESKTOP_VERSION |
485 | if (mPagerAppAvailable == UNDEFINED) | 514 | if (mPagerAppAvailable == UNDEFINED) |
486 | { | 515 | { |
487 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 516 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
488 | if (client == KPimGlobalPrefs::NONE_PAC) | 517 | if (client == KPimGlobalPrefs::NONE_PAC) |
489 | mPagerAppAvailable = UNAVAILABLE; | 518 | mPagerAppAvailable = UNAVAILABLE; |
490 | else | 519 | else |
491 | mPagerAppAvailable = AVAILABLE; | 520 | mPagerAppAvailable = AVAILABLE; |
492 | } | 521 | } |
493 | 522 | ||
494 | return (mPagerAppAvailable == AVAILABLE); | 523 | return (mPagerAppAvailable == AVAILABLE); |
495 | #else //DESKTOP_VERSION | 524 | #else //DESKTOP_VERSION |
496 | return false; | 525 | return false; |
497 | #endif //DESKTOP_VERSION | 526 | #endif //DESKTOP_VERSION |
498 | } | 527 | } |
499 | 528 | ||
500 | /************************************************************************** | 529 | /************************************************************************** |
501 | * | 530 | * |
502 | **************************************************************************/ | 531 | **************************************************************************/ |
503 | 532 | ||
504 | 533 | ||
505 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 534 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
506 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 535 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
507 | { | 536 | { |
508 | 537 | ||
509 | #ifndef DESKTOP_VERSION | 538 | #ifndef DESKTOP_VERSION |
510 | QString channel; | 539 | QString channel; |
511 | QString message2; | 540 | QString message2; |
512 | QString parameters2; | 541 | QString parameters2; |
513 | 542 | ||
514 | 543 | ||
515 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 544 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
516 | if (client == KPimGlobalPrefs::OTHER_EMC) | 545 | if (client == KPimGlobalPrefs::OTHER_EMC) |
517 | { | 546 | { |
518 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 547 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
519 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 548 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
520 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 549 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
521 | } | 550 | } |
522 | else | 551 | else |
523 | { | 552 | { |
524 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 553 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
525 | if (!dai) | 554 | if (!dai) |
526 | { | 555 | { |
527 | qDebug("could not find configured email application."); | 556 | qDebug("could not find configured email application."); |
528 | return false; | 557 | return false; |
529 | } | 558 | } |
530 | channel = dai->_channel; | 559 | channel = dai->_channel; |
531 | message2 = dai->_message2; | 560 | message2 = dai->_message2; |
532 | parameters2 = dai->_parameters2; | 561 | parameters2 = dai->_parameters2; |
533 | } | 562 | } |
534 | 563 | ||
535 | //first check if one of the mailers need the emails right in the message. | 564 | //first check if one of the mailers need the emails right in the message. |
536 | message2 = translateMessage(message2, emails, urls); | 565 | message2 = translateMessage(message2, emails, urls); |
537 | 566 | ||
538 | 567 | ||
539 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 568 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
540 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 569 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
541 | 570 | ||
542 | 571 | ||
543 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 572 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
544 | //US we need no names in the To field. The emailadresses are enough | 573 | //US we need no names in the To field. The emailadresses are enough |
545 | 574 | ||
546 | passParameters(&e, parameters2, emails, urls); | 575 | passParameters(&e, parameters2, emails, urls); |
547 | 576 | ||
548 | 577 | ||
549 | 578 | ||
550 | #else | 579 | #else |
551 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 580 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
552 | #endif | 581 | #endif |
553 | 582 | ||
554 | return true; | 583 | return true; |
555 | } | 584 | } |
556 | 585 | ||
557 | /************************************************************************** | 586 | /************************************************************************** |
558 | * | 587 | * |
559 | **************************************************************************/ | 588 | **************************************************************************/ |
560 | 589 | ||
561 | 590 | ||
562 | //calls the emailapplication and creates a mail with parameter emails as recipients | 591 | //calls the emailapplication and creates a mail with parameter emails as recipients |
563 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 592 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
564 | { | 593 | { |
565 | #ifndef DESKTOP_VERSION | 594 | #ifndef DESKTOP_VERSION |
566 | QString channel; | 595 | QString channel; |
567 | QString message; | 596 | QString message; |
568 | QString parameters; | 597 | QString parameters; |
569 | 598 | ||
570 | 599 | ||
571 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 600 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
572 | if (client == KPimGlobalPrefs::OTHER_EMC) | 601 | if (client == KPimGlobalPrefs::OTHER_EMC) |
573 | { | 602 | { |
574 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 603 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
575 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 604 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
576 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 605 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
577 | } | 606 | } |
578 | else | 607 | else |
579 | { | 608 | { |
580 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 609 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
581 | if (!dai) | 610 | if (!dai) |
582 | { | 611 | { |
583 | qDebug("could not find configured email application."); | 612 | qDebug("could not find configured email application."); |
584 | return false; | 613 | return false; |
585 | } | 614 | } |
586 | channel = dai->_channel; | 615 | channel = dai->_channel; |
587 | message = dai->_message; | 616 | message = dai->_message; |
588 | parameters = dai->_parameters; | 617 | parameters = dai->_parameters; |
589 | } | 618 | } |
590 | 619 | ||
591 | 620 | ||
592 | //first check if one of the mailers need the emails right in the message. | 621 | //first check if one of the mailers need the emails right in the message. |
593 | message = translateMessage(message, name, emailadress); | 622 | message = translateMessage(message, name, emailadress); |
594 | 623 | ||
595 | 624 | ||
596 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 625 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
597 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 626 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
598 | 627 | ||
599 | QCopEnvelope e(channel.latin1(), message.latin1()); | 628 | QCopEnvelope e(channel.latin1(), message.latin1()); |
600 | //US we need no names in the To field. The emailadresses are enough | 629 | //US we need no names in the To field. The emailadresses are enough |
601 | 630 | ||
602 | passParameters(&e, parameters, name, emailadress); | 631 | passParameters(&e, parameters, name, emailadress); |
603 | 632 | ||
604 | 633 | ||
605 | #else | 634 | #else |
606 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 635 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
607 | #endif | 636 | #endif |
608 | 637 | ||
609 | 638 | ||
610 | return true; | 639 | return true; |
611 | } | 640 | } |
612 | 641 | ||
613 | /************************************************************************** | 642 | /************************************************************************** |
614 | * | 643 | * |
615 | **************************************************************************/ | 644 | **************************************************************************/ |
616 | 645 | ||
617 | //calls the emailapplication and creates a mail with parameter as recipients | 646 | //calls the emailapplication and creates a mail with parameter as recipients |
618 | // parameters format is | 647 | // parameters format is |
619 | // NAME <EMAIL>:SUBJECT | 648 | // NAME <EMAIL>:SUBJECT |
620 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 649 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
621 | { | 650 | { |
622 | QString line = adressline; | 651 | QString line = adressline; |
623 | 652 | ||
624 | int first = line.find( "<"); | 653 | int first = line.find( "<"); |
625 | int last = line.find( ">"); | 654 | int last = line.find( ">"); |
626 | QString name = line.left(first); | 655 | QString name = line.left(first); |
627 | QString emailadress = line.mid(first+1, last-first-1); | 656 | QString emailadress = line.mid(first+1, last-first-1); |
628 | 657 | ||
629 | //Subject can not be handled right now. | 658 | //Subject can not be handled right now. |
630 | return mailToOneContact( name, emailadress ); | 659 | return mailToOneContact( name, emailadress ); |
631 | 660 | ||
632 | } | 661 | } |
633 | 662 | ||
634 | 663 | ||
635 | /************************************************************************** | 664 | /************************************************************************** |
636 | * | 665 | * |
637 | **************************************************************************/ | 666 | **************************************************************************/ |
638 | 667 | ||
639 | //calls the phoneapplication with the number | 668 | //calls the phoneapplication with the number |
640 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 669 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
641 | { | 670 | { |
642 | #ifndef DESKTOP_VERSION | 671 | #ifndef DESKTOP_VERSION |
643 | QString channel; | 672 | QString channel; |
644 | QString message; | 673 | QString message; |
645 | QString parameters; | 674 | QString parameters; |
646 | 675 | ||
647 | 676 | ||
648 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 677 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
649 | if (client == KPimGlobalPrefs::OTHER_PHC) | 678 | if (client == KPimGlobalPrefs::OTHER_PHC) |
650 | { | 679 | { |
651 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 680 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
652 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 681 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
653 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 682 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
654 | } | 683 | } |
655 | else | 684 | else |
656 | { | 685 | { |
657 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 686 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
658 | if (!dai) | 687 | if (!dai) |
659 | { | 688 | { |
660 | qDebug("could not find configured phone application."); | 689 | qDebug("could not find configured phone application."); |
661 | return false; | 690 | return false; |
662 | } | 691 | } |
663 | channel = dai->_channel; | 692 | channel = dai->_channel; |
664 | message = dai->_message; | 693 | message = dai->_message; |
665 | parameters = dai->_parameters; | 694 | parameters = dai->_parameters; |
666 | } | 695 | } |
667 | 696 | ||
668 | 697 | ||
669 | //first check if one of the mailers need the emails right in the message. | 698 | //first check if one of the mailers need the emails right in the message. |
670 | message = translateMessage(message, phonenumber, ""); | 699 | message = translateMessage(message, phonenumber, ""); |
671 | 700 | ||
672 | 701 | ||
673 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 702 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
674 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 703 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
675 | 704 | ||
676 | QCopEnvelope e(channel.latin1(), message.latin1()); | 705 | QCopEnvelope e(channel.latin1(), message.latin1()); |
677 | //US we need no names in the To field. The emailadresses are enough | 706 | //US we need no names in the To field. The emailadresses are enough |
678 | 707 | ||
679 | passParameters(&e, parameters, phonenumber, ""); | 708 | passParameters(&e, parameters, phonenumber, ""); |
680 | 709 | ||
681 | 710 | ||
682 | #else | 711 | #else |
683 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); | 712 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); |
684 | #endif | 713 | #endif |
685 | 714 | ||
686 | 715 | ||
687 | return true; | 716 | return true; |
688 | } | 717 | } |
689 | 718 | ||
690 | /************************************************************************** | 719 | /************************************************************************** |
691 | * | 720 | * |
692 | **************************************************************************/ | 721 | **************************************************************************/ |
693 | 722 | ||
694 | //calls the smsapplication with the number | 723 | //calls the smsapplication with the number |
695 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 724 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
696 | { | 725 | { |
697 | #ifndef DESKTOP_VERSION | 726 | #ifndef DESKTOP_VERSION |
698 | QString channel; | 727 | QString channel; |
699 | QString message; | 728 | QString message; |
700 | QString parameters; | 729 | QString parameters; |
701 | 730 | ||
702 | 731 | ||
703 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 732 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
704 | if (client == KPimGlobalPrefs::OTHER_SMC) | 733 | if (client == KPimGlobalPrefs::OTHER_SMC) |
705 | { | 734 | { |
706 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; | 735 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; |
707 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; | 736 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; |
708 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; | 737 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; |
709 | } | 738 | } |
710 | else | 739 | else |
711 | { | 740 | { |
712 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); | 741 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); |
713 | if (!dai) | 742 | if (!dai) |
714 | { | 743 | { |
715 | qDebug("could not find configured sms application."); | 744 | qDebug("could not find configured sms application."); |
716 | return false; | 745 | return false; |
717 | } | 746 | } |
718 | channel = dai->_channel; | 747 | channel = dai->_channel; |
719 | message = dai->_message; | 748 | message = dai->_message; |
720 | parameters = dai->_parameters; | 749 | parameters = dai->_parameters; |
721 | } | 750 | } |
722 | 751 | ||
723 | 752 | ||
724 | //first check if one of the mailers need the emails right in the message. | 753 | //first check if one of the mailers need the emails right in the message. |
725 | message = translateMessage(message, phonenumber, ""); | 754 | message = translateMessage(message, phonenumber, ""); |
726 | 755 | ||
727 | 756 | ||
728 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 757 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
729 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 758 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
730 | 759 | ||
731 | QCopEnvelope e(channel.latin1(), message.latin1()); | 760 | QCopEnvelope e(channel.latin1(), message.latin1()); |
732 | //US we need no names in the To field. The emailadresses are enough | 761 | //US we need no names in the To field. The emailadresses are enough |
733 | 762 | ||
734 | passParameters(&e, parameters, phonenumber, ""); | 763 | passParameters(&e, parameters, phonenumber, ""); |
735 | 764 | ||
736 | 765 | ||
737 | #else | 766 | #else |
738 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); | 767 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); |
739 | #endif | 768 | #endif |
740 | 769 | ||
741 | 770 | ||
742 | return true; | 771 | return true; |
743 | } | 772 | } |
744 | 773 | ||
745 | /************************************************************************** | 774 | /************************************************************************** |
746 | * | 775 | * |
747 | **************************************************************************/ | 776 | **************************************************************************/ |
748 | 777 | ||
749 | //calls the pagerapplication with the number | 778 | //calls the pagerapplication with the number |
750 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 779 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
751 | { | 780 | { |
752 | #ifndef DESKTOP_VERSION | 781 | #ifndef DESKTOP_VERSION |
753 | QString channel; | 782 | QString channel; |
754 | QString message; | 783 | QString message; |
755 | QString parameters; | 784 | QString parameters; |
756 | 785 | ||
757 | 786 | ||
758 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 787 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
759 | if (client == KPimGlobalPrefs::OTHER_PAC) | 788 | if (client == KPimGlobalPrefs::OTHER_PAC) |
760 | { | 789 | { |
761 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; | 790 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; |
762 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; | 791 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; |
763 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; | 792 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; |
764 | } | 793 | } |
765 | else | 794 | else |
766 | { | 795 | { |
767 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); | 796 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); |
768 | if (!dai) | 797 | if (!dai) |
769 | { | 798 | { |
770 | qDebug("could not find configured pager application."); | 799 | qDebug("could not find configured pager application."); |
771 | return false; | 800 | return false; |
772 | } | 801 | } |
773 | channel = dai->_channel; | 802 | channel = dai->_channel; |
774 | message = dai->_message; | 803 | message = dai->_message; |
775 | parameters = dai->_parameters; | 804 | parameters = dai->_parameters; |
776 | } | 805 | } |
777 | 806 | ||
778 | 807 | ||
779 | //first check if one of the mailers need the emails right in the message. | 808 | //first check if one of the mailers need the emails right in the message. |
780 | message = translateMessage(message, pagernumber, ""); | 809 | message = translateMessage(message, pagernumber, ""); |
781 | 810 | ||
782 | 811 | ||
783 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 812 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
784 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); | 813 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); |
785 | 814 | ||
786 | QCopEnvelope e(channel.latin1(), message.latin1()); | 815 | QCopEnvelope e(channel.latin1(), message.latin1()); |
787 | //US we need no names in the To field. The emailadresses are enough | 816 | //US we need no names in the To field. The emailadresses are enough |
788 | 817 | ||
789 | passParameters(&e, parameters, pagernumber, ""); | 818 | passParameters(&e, parameters, pagernumber, ""); |
790 | 819 | ||
791 | 820 | ||
792 | #else | 821 | #else |
793 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); | 822 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); |
794 | #endif | 823 | #endif |
795 | 824 | ||
796 | 825 | ||
797 | return true; | 826 | return true; |
798 | } | 827 | } |
799 | 828 | ||
800 | /************************************************************************** | 829 | /************************************************************************** |
801 | * | 830 | * |
802 | **************************************************************************/ | 831 | **************************************************************************/ |
803 | 832 | ||
804 | //calls the faxapplication with the number | 833 | //calls the faxapplication with the number |
805 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 834 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
806 | { | 835 | { |
807 | #ifndef DESKTOP_VERSION | 836 | #ifndef DESKTOP_VERSION |
808 | QString channel; | 837 | QString channel; |
809 | QString message; | 838 | QString message; |
810 | QString parameters; | 839 | QString parameters; |
811 | 840 | ||
812 | 841 | ||
813 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 842 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
814 | if (client == KPimGlobalPrefs::OTHER_FAC) | 843 | if (client == KPimGlobalPrefs::OTHER_FAC) |
815 | { | 844 | { |
816 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; | 845 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; |
817 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; | 846 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; |
818 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; | 847 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; |
819 | } | 848 | } |
820 | else | 849 | else |
821 | { | 850 | { |
822 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); | 851 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); |
823 | if (!dai) | 852 | if (!dai) |
824 | { | 853 | { |
825 | qDebug("could not find configured fax application."); | 854 | qDebug("could not find configured fax application."); |
826 | return false; | 855 | return false; |
827 | } | 856 | } |
828 | channel = dai->_channel; | 857 | channel = dai->_channel; |
829 | message = dai->_message; | 858 | message = dai->_message; |
830 | parameters = dai->_parameters; | 859 | parameters = dai->_parameters; |
831 | } | 860 | } |
832 | 861 | ||
833 | 862 | ||
834 | //first check if one of the mailers need the emails right in the message. | 863 | //first check if one of the mailers need the emails right in the message. |
835 | message = translateMessage(message, faxnumber, ""); | 864 | message = translateMessage(message, faxnumber, ""); |
836 | 865 | ||
837 | 866 | ||
838 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 867 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
839 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); | 868 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); |
840 | 869 | ||
841 | QCopEnvelope e(channel.latin1(), message.latin1()); | 870 | QCopEnvelope e(channel.latin1(), message.latin1()); |
842 | //US we need no names in the To field. The emailadresses are enough | 871 | //US we need no names in the To field. The emailadresses are enough |
843 | 872 | ||
844 | passParameters(&e, parameters, faxnumber, ""); | 873 | passParameters(&e, parameters, faxnumber, ""); |
845 | 874 | ||
846 | 875 | ||
847 | #else | 876 | #else |
848 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 877 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
849 | #endif | 878 | #endif |
850 | 879 | ||
851 | 880 | ||
852 | return true; | 881 | return true; |
853 | } | 882 | } |
854 | 883 | ||
855 | /************************************************************************** | 884 | /************************************************************************** |
856 | * | 885 | * |
857 | **************************************************************************/ | 886 | **************************************************************************/ |
858 | 887 | ||
859 | 888 | ||
860 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 889 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
861 | { | 890 | { |
862 | message = message.replace( QRegExp("%1"), param1 ); | 891 | message = message.replace( QRegExp("%1"), param1 ); |
863 | return message.replace( QRegExp("%2"), param2 ); | 892 | return message.replace( QRegExp("%2"), param2 ); |
864 | } | 893 | } |
865 | 894 | ||
866 | /************************************************************************** | 895 | /************************************************************************** |
867 | * | 896 | * |
868 | **************************************************************************/ | 897 | **************************************************************************/ |
869 | 898 | ||
870 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 899 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
871 | { | 900 | { |
872 | #ifndef DESKTOP_VERSION | 901 | #ifndef DESKTOP_VERSION |
873 | QMap<QString, QString> valmap; | 902 | QMap<QString, QString> valmap; |
874 | bool useValMap = false; | 903 | bool useValMap = false; |
875 | 904 | ||
876 | // first extract all parts of the parameters. | 905 | // first extract all parts of the parameters. |
877 | QStringList paramlist = QStringList::split(";", parameters); | 906 | QStringList paramlist = QStringList::split(";", parameters); |
878 | 907 | ||
879 | //Now check how many parts we have. | 908 | //Now check how many parts we have. |
880 | //=0 :no params to pass | 909 | //=0 :no params to pass |
881 | //>0 :parameters to pass | 910 | //>0 :parameters to pass |
882 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) | 911 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) |
883 | { | 912 | { |
884 | QString param = (*it); | 913 | QString param = (*it); |
885 | QStringList keyvallist = QStringList::split("=", param); | 914 | QStringList keyvallist = QStringList::split("=", param); |
886 | 915 | ||
887 | //if we have keyvalue pairs, we assume that we pass a map to the envelope | 916 | //if we have keyvalue pairs, we assume that we pass a map to the envelope |
888 | QStringList::Iterator it2 = keyvallist.begin(); | 917 | QStringList::Iterator it2 = keyvallist.begin(); |
889 | QString key = (*it2); | 918 | QString key = (*it2); |
890 | key = key.replace( QRegExp("%1"), param1 ); | 919 | key = key.replace( QRegExp("%1"), param1 ); |
891 | key = key.replace( QRegExp("%2"), param2 ); | 920 | key = key.replace( QRegExp("%2"), param2 ); |
892 | ++it2; | 921 | ++it2; |
893 | 922 | ||
894 | if(it2 != keyvallist.end()) | 923 | if(it2 != keyvallist.end()) |
895 | { | 924 | { |
896 | QString value = (*it2); | 925 | QString value = (*it2); |
897 | value = value.replace( QRegExp("%1"), param1 ); | 926 | value = value.replace( QRegExp("%1"), param1 ); |
898 | value = value.replace( QRegExp("%2"), param2 ); | 927 | value = value.replace( QRegExp("%2"), param2 ); |
899 | 928 | ||
900 | valmap.insert(key, value); | 929 | valmap.insert(key, value); |
901 | useValMap = true; | 930 | useValMap = true; |
902 | } | 931 | } |
903 | else | 932 | else |
904 | { | 933 | { |
905 | // qDebug("pass parameter << %s", key.latin1()); | 934 | // qDebug("pass parameter << %s", key.latin1()); |
906 | (*e) << key; | 935 | (*e) << key; |
907 | } | 936 | } |
908 | } | 937 | } |
909 | 938 | ||
910 | if (useValMap == true) | 939 | if (useValMap == true) |
911 | (*e) << valmap; | 940 | (*e) << valmap; |
912 | 941 | ||
913 | #endif | 942 | #endif |
914 | 943 | ||
915 | } | 944 | } |
916 | 945 | ||
917 | 946 | ||
918 | 947 | ||
919 | /************************************************************************** | 948 | /************************************************************************** |
920 | * | 949 | * |
921 | **************************************************************************/ | 950 | **************************************************************************/ |
922 | 951 | ||
923 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 952 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) |
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 | ||
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 | ||
959 | 998 | ||
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 7c8de4e..a74080f 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -1,252 +1,261 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef EXTERNALAPPHANDLER_H | 31 | #ifndef EXTERNALAPPHANDLER_H |
32 | #define EXTERNALAPPHANDLER_H | 32 | #define EXTERNALAPPHANDLER_H |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | 37 | ||
38 | class QCopEnvelope; | 38 | class QCopEnvelope; |
39 | 39 | ||
40 | 40 | ||
41 | class ExternalAppHandler; | 41 | class ExternalAppHandler; |
42 | class QCopTransferItem : public QObject | 42 | 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 | ||
53 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 53 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
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; |
64 | QString _targetChannel; | 68 | QString _targetChannel; |
65 | QString _targetMessage; | 69 | QString _targetMessage; |
66 | QString _targetMessageParameters; | 70 | QString _targetMessageParameters; |
67 | 71 | ||
68 | }; | 72 | }; |
69 | 73 | ||
70 | /********************************************************************************* | 74 | /********************************************************************************* |
71 | * | 75 | * |
72 | ********************************************************************************/ | 76 | ********************************************************************************/ |
73 | 77 | ||
74 | class QCopMapTransferItem : public QCopTransferItem | 78 | 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 | ||
82 | 86 | ||
83 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 87 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
84 | 88 | ||
85 | 89 | ||
86 | signals: | 90 | signals: |
87 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 91 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
88 | 92 | ||
89 | }; | 93 | }; |
90 | 94 | ||
91 | /********************************************************************************* | 95 | /********************************************************************************* |
92 | * | 96 | * |
93 | ********************************************************************************/ | 97 | ********************************************************************************/ |
94 | 98 | ||
95 | class QCopListTransferItem : public QCopTransferItem | 99 | 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 | ||
103 | 107 | ||
104 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 108 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
105 | 109 | ||
106 | 110 | ||
107 | signals: | 111 | signals: |
108 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); | 112 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3); |
109 | 113 | ||
110 | }; | 114 | }; |
111 | 115 | ||
112 | /********************************************************************************* | 116 | /********************************************************************************* |
113 | * | 117 | * |
114 | ********************************************************************************/ | 118 | ********************************************************************************/ |
115 | 119 | ||
116 | 120 | ||
117 | class DefaultAppItem | 121 | class DefaultAppItem |
118 | { | 122 | { |
119 | public: | 123 | public: |
120 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) | 124 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) |
121 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) | 125 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) |
122 | {} | 126 | {} |
123 | 127 | ||
124 | DefaultAppItem() | 128 | DefaultAppItem() |
125 | { } | 129 | { } |
126 | 130 | ||
127 | public: | 131 | public: |
128 | int _type; | 132 | int _type; |
129 | int _id; | 133 | int _id; |
130 | QString _label; | 134 | QString _label; |
131 | QString _channel; | 135 | QString _channel; |
132 | QString _message; | 136 | QString _message; |
133 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; | 137 | QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; |
134 | QString _message2; | 138 | QString _message2; |
135 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; | 139 | QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; |
136 | 140 | ||
137 | }; | 141 | }; |
138 | 142 | ||
139 | /********************************************************************************* | 143 | /********************************************************************************* |
140 | * | 144 | * |
141 | ********************************************************************************/ | 145 | ********************************************************************************/ |
142 | 146 | ||
143 | class ExternalAppHandler : public QObject | 147 | class ExternalAppHandler : public QObject |
144 | { | 148 | { |
145 | Q_OBJECT | 149 | Q_OBJECT |
146 | public: | 150 | public: |
147 | virtual ~ExternalAppHandler(); | 151 | virtual ~ExternalAppHandler(); |
148 | 152 | ||
149 | static ExternalAppHandler *instance(); | 153 | static ExternalAppHandler *instance(); |
150 | 154 | ||
151 | enum Types { | 155 | enum Types { |
152 | EMAIL = 0, | 156 | EMAIL = 0, |
153 | PHONE = 1, | 157 | PHONE = 1, |
154 | SMS = 2, | 158 | SMS = 2, |
155 | FAX = 3, | 159 | FAX = 3, |
156 | PAGER = 4 | 160 | PAGER = 4 |
157 | }; | 161 | }; |
158 | 162 | ||
159 | enum Availability { | 163 | enum Availability { |
160 | UNDEFINED = -1, | 164 | UNDEFINED = -1, |
161 | UNAVAILABLE = 0, | 165 | UNAVAILABLE = 0, |
162 | AVAILABLE = 1 | 166 | AVAILABLE = 1 |
163 | }; | 167 | }; |
164 | 168 | ||
165 | //calls the emailapplication with a number of attachments that need to be send. | 169 | //calls the emailapplication with a number of attachments that need to be send. |
166 | //either parameter can be left empty. | 170 | //either parameter can be left empty. |
167 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); | 171 | bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); |
168 | 172 | ||
169 | //calls the emailapplication and creates a mail with parameter emailadress as recipients | 173 | //calls the emailapplication and creates a mail with parameter emailadress as recipients |
170 | bool mailToOneContact( const QString& name, const QString& emailadress ); | 174 | bool mailToOneContact( const QString& name, const QString& emailadress ); |
171 | 175 | ||
172 | //calls the emailapplication and creates a mail with parameter as recipients | 176 | //calls the emailapplication and creates a mail with parameter as recipients |
173 | // parameters format is | 177 | // parameters format is |
174 | // NAME <EMAIL>:SUBJECT | 178 | // NAME <EMAIL>:SUBJECT |
175 | bool mailToOneContact( const QString& adressline ); | 179 | bool mailToOneContact( const QString& adressline ); |
176 | 180 | ||
177 | //calls the phoneapplication with the number | 181 | //calls the phoneapplication with the number |
178 | bool callByPhone( const QString& phonenumber ); | 182 | bool callByPhone( const QString& phonenumber ); |
179 | 183 | ||
180 | //calls the smsapplication with the number | 184 | //calls the smsapplication with the number |
181 | bool callBySMS( const QString& phonenumber ); | 185 | bool callBySMS( const QString& phonenumber ); |
182 | 186 | ||
183 | //calls the pagerapplication with the number | 187 | //calls the pagerapplication with the number |
184 | bool callByPager( const QString& pagernumber ); | 188 | bool callByPager( const QString& pagernumber ); |
185 | 189 | ||
186 | //calls the faxapplication with the number | 190 | //calls the faxapplication with the number |
187 | bool callByFax( const QString& faxnumber ); | 191 | bool callByFax( const QString& faxnumber ); |
188 | 192 | ||
189 | bool isEmailAppAvailable(); | 193 | bool isEmailAppAvailable(); |
190 | bool isSMSAppAvailable(); | 194 | bool isSMSAppAvailable(); |
191 | bool isPhoneAppAvailable(); | 195 | bool isPhoneAppAvailable(); |
192 | bool isFaxAppAvailable(); | 196 | bool isFaxAppAvailable(); |
193 | bool isPagerAppAvailable(); | 197 | bool isPagerAppAvailable(); |
194 | 198 | ||
195 | 199 | ||
196 | //Call this method on the source when you want to select names from the addressbook by using QCop | 200 | //Call this method on the source when you want to select names from the addressbook by using QCop |
197 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid); | 201 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid); |
198 | //Call this method on the target when you want to return the name/email map to the source (client). | 202 | //Call this method on the target when you want to return the name/email map to the source (client). |
199 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); | 203 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); |
200 | 204 | ||
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(); |
207 | 213 | ||
208 | QList<DefaultAppItem> getAvailableDefaultItems(Types); | 214 | QList<DefaultAppItem> getAvailableDefaultItems(Types); |
209 | DefaultAppItem* getDefaultItem(Types, int); | 215 | DefaultAppItem* getDefaultItem(Types, int); |
210 | 216 | ||
211 | public slots: | 217 | public slots: |
212 | void appMessage( const QCString& msg, const QByteArray& data ); | 218 | void appMessage( const QCString& msg, const QByteArray& data ); |
213 | 219 | ||
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 |
221 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 227 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
222 | 228 | ||
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(); |
229 | QList<DefaultAppItem> mDefaultItems; | 237 | QList<DefaultAppItem> mDefaultItems; |
230 | 238 | ||
231 | Availability mEmailAppAvailable; | 239 | Availability mEmailAppAvailable; |
232 | Availability mPhoneAppAvailable; | 240 | Availability mPhoneAppAvailable; |
233 | Availability mFaxAppAvailable; | 241 | Availability mFaxAppAvailable; |
234 | Availability mSMSAppAvailable; | 242 | Availability mSMSAppAvailable; |
235 | Availability mPagerAppAvailable; | 243 | Availability mPagerAppAvailable; |
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); |
242 | 251 | ||
243 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; | 252 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; |
244 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; | 253 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; |
245 | 254 | ||
246 | 255 | ||
247 | static ExternalAppHandler *sInstance; | 256 | static ExternalAppHandler *sInstance; |
248 | 257 | ||
249 | }; | 258 | }; |
250 | 259 | ||
251 | 260 | ||
252 | #endif | 261 | #endif |