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