summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 6f812d0..0128cf7 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -26,22 +26,24 @@ Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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 35
35 36#ifndef DESKTOP_VERSION
36#include <qtopia/qcopenvelope_qws.h> 37#include <qtopia/qcopenvelope_qws.h>
37 38#endif
38 39
39#include <kstaticdeleter.h> 40#include <kstaticdeleter.h>
41#include <kmessagebox.h>
40 42
41 43
42#include "externalapphandler.h" 44#include "externalapphandler.h"
43 45
44#include "kpimglobalprefs.h" 46#include "kpimglobalprefs.h"
45 47
46 48
47 49
@@ -163,17 +165,18 @@ DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
163 return 0; 165 return 0;
164} 166}
165 167
166 168
167 169
168//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) 170//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma)
169bool ExternalAppHandler::mailAttachments( const QString& urls ) 171bool ExternalAppHandler::mailAttachments( const QString& urls )
170{ 172{
171#ifndef QT_NO_COP 173
174#ifndef DESKTOP_VERSION
172 QString channel; 175 QString channel;
173 QString message2; 176 QString message2;
174 QString parameters2; 177 QString parameters2;
175 178
176 179
177 int client = KPimGlobalPrefs::instance()->mEmailClient; 180 int client = KPimGlobalPrefs::instance()->mEmailClient;
178 if (client == KPimGlobalPrefs::OTHER_EMC) 181 if (client == KPimGlobalPrefs::OTHER_EMC)
179 { 182 {
@@ -193,35 +196,37 @@ bool ExternalAppHandler::mailAttachments( const QString& urls )
193 message2 = dai->_message2; 196 message2 = dai->_message2;
194 parameters2 = dai->_parameters2; 197 parameters2 = dai->_parameters2;
195 } 198 }
196 199
197 200
198 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); 201 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1());
199 qDebug("passing attachmenturls:(%s) as parameter in the form %s to QCopEnvelope", urls.latin1(), parameters2.latin1()); 202 qDebug("passing attachmenturls:(%s) as parameter in the form %s to QCopEnvelope", urls.latin1(), parameters2.latin1());
200 203
204
201 QCopEnvelope e(channel.latin1(), message2.latin1()); 205 QCopEnvelope e(channel.latin1(), message2.latin1());
202 //US we need no names in the To field. The emailadresses are enough 206 //US we need no names in the To field. The emailadresses are enough
203 207
204 passParameter(&e, parameters2, urls); 208 passParameter(&e, parameters2, urls);
205 209
206 210
211
207#else 212#else
208 KMessageBox::sorry( this, i18n( "This version does not support the sending of emails." ) ); 213 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
209#endif 214#endif
210 215
211 return true; 216 return true;
212} 217}
213 218
214 219
215 220
216//calls the emailapplication and creates a mail with parameter emails as recipients 221//calls the emailapplication and creates a mail with parameter emails as recipients
217bool ExternalAppHandler::mailToContacts( const QString& emails ) 222bool ExternalAppHandler::mailToContacts( const QString& emails )
218{ 223{
219#ifndef QT_NO_COP 224#ifndef DESKTOP_VERSION
220 QString channel; 225 QString channel;
221 QString message; 226 QString message;
222 QString parameters; 227 QString parameters;
223 228
224 229
225 int client = KPimGlobalPrefs::instance()->mEmailClient; 230 int client = KPimGlobalPrefs::instance()->mEmailClient;
226 if (client == KPimGlobalPrefs::OTHER_EMC) 231 if (client == KPimGlobalPrefs::OTHER_EMC)
227 { 232 {
@@ -252,28 +257,28 @@ bool ExternalAppHandler::mailToContacts( const QString& emails )
252 257
253 QCopEnvelope e(channel.latin1(), message.latin1()); 258 QCopEnvelope e(channel.latin1(), message.latin1());
254 //US we need no names in the To field. The emailadresses are enough 259 //US we need no names in the To field. The emailadresses are enough
255 260
256 passParameter(&e, parameters, emails); 261 passParameter(&e, parameters, emails);
257 262
258 263
259#else 264#else
260 KMessageBox::sorry( this, i18n( "This version does not support the sending of emails." ) ); 265 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
261#endif 266#endif
262 267
263 268
264 return true; 269 return true;
265} 270}
266 271
267 272
268//calls the phoneapplication with the number 273//calls the phoneapplication with the number
269bool ExternalAppHandler::callByPhone( const QString& phonenumber ) 274bool ExternalAppHandler::callByPhone( const QString& phonenumber )
270{ 275{
271#ifndef QT_NO_COP 276#ifndef DESKTOP_VERSION
272 QString channel; 277 QString channel;
273 QString message; 278 QString message;
274 QString parameters; 279 QString parameters;
275 280
276 281
277 int client = KPimGlobalPrefs::instance()->mPhoneClient; 282 int client = KPimGlobalPrefs::instance()->mPhoneClient;
278 if (client == KPimGlobalPrefs::OTHER_PHC) 283 if (client == KPimGlobalPrefs::OTHER_PHC)
279 { 284 {
@@ -304,27 +309,27 @@ bool ExternalAppHandler::callByPhone( const QString& phonenumber )
304 309
305 QCopEnvelope e(channel.latin1(), message.latin1()); 310 QCopEnvelope e(channel.latin1(), message.latin1());
306 //US we need no names in the To field. The emailadresses are enough 311 //US we need no names in the To field. The emailadresses are enough
307 312
308 passParameter(&e, parameters, phonenumber); 313 passParameter(&e, parameters, phonenumber);
309 314
310 315
311#else 316#else
312 KMessageBox::sorry( this, i18n( "This version does not support phonecalls." ) ); 317 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) );
313#endif 318#endif
314 319
315 320
316 return true; 321 return true;
317} 322}
318 323
319//calls the smsapplication with the number 324//calls the smsapplication with the number
320bool ExternalAppHandler::callBySMS( const QString& phonenumber ) 325bool ExternalAppHandler::callBySMS( const QString& phonenumber )
321{ 326{
322#ifndef QT_NO_COP 327#ifndef DESKTOP_VERSION
323 QString channel; 328 QString channel;
324 QString message; 329 QString message;
325 QString parameters; 330 QString parameters;
326 331
327 332
328 int client = KPimGlobalPrefs::instance()->mSMSClient; 333 int client = KPimGlobalPrefs::instance()->mSMSClient;
329 if (client == KPimGlobalPrefs::OTHER_SMC) 334 if (client == KPimGlobalPrefs::OTHER_SMC)
330 { 335 {
@@ -355,27 +360,27 @@ bool ExternalAppHandler::callBySMS( const QString& phonenumber )
355 360
356 QCopEnvelope e(channel.latin1(), message.latin1()); 361 QCopEnvelope e(channel.latin1(), message.latin1());
357 //US we need no names in the To field. The emailadresses are enough 362 //US we need no names in the To field. The emailadresses are enough
358 363
359 passParameter(&e, parameters, phonenumber); 364 passParameter(&e, parameters, phonenumber);
360 365
361 366
362#else 367#else
363 KMessageBox::sorry( this, i18n( "This version does not support the sending of sms." ) ); 368 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
364#endif 369#endif
365 370
366 371
367 return true; 372 return true;
368} 373}
369 374
370//calls the pagerapplication with the number 375//calls the pagerapplication with the number
371bool ExternalAppHandler::callByPager( const QString& pagernumber ) 376bool ExternalAppHandler::callByPager( const QString& pagernumber )
372{ 377{
373#ifndef QT_NO_COP 378#ifndef DESKTOP_VERSION
374 QString channel; 379 QString channel;
375 QString message; 380 QString message;
376 QString parameters; 381 QString parameters;
377 382
378 383
379 int client = KPimGlobalPrefs::instance()->mPagerClient; 384 int client = KPimGlobalPrefs::instance()->mPagerClient;
380 if (client == KPimGlobalPrefs::OTHER_PAC) 385 if (client == KPimGlobalPrefs::OTHER_PAC)
381 { 386 {
@@ -406,27 +411,27 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
406 411
407 QCopEnvelope e(channel.latin1(), message.latin1()); 412 QCopEnvelope e(channel.latin1(), message.latin1());
408 //US we need no names in the To field. The emailadresses are enough 413 //US we need no names in the To field. The emailadresses are enough
409 414
410 passParameter(&e, parameters, pagernumber); 415 passParameter(&e, parameters, pagernumber);
411 416
412 417
413#else 418#else
414 KMessageBox::sorry( this, i18n( "This version does not support paging." ) ); 419 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
415#endif 420#endif
416 421
417 422
418 return true; 423 return true;
419} 424}
420 425
421//calls the faxapplication with the number 426//calls the faxapplication with the number
422bool ExternalAppHandler::callByFax( const QString& faxnumber ) 427bool ExternalAppHandler::callByFax( const QString& faxnumber )
423{ 428{
424#ifndef QT_NO_COP 429#ifndef DESKTOP_VERSION
425 QString channel; 430 QString channel;
426 QString message; 431 QString message;
427 QString parameters; 432 QString parameters;
428 433
429 434
430 int client = KPimGlobalPrefs::instance()->mFaxClient; 435 int client = KPimGlobalPrefs::instance()->mFaxClient;
431 if (client == KPimGlobalPrefs::OTHER_FAC) 436 if (client == KPimGlobalPrefs::OTHER_FAC)
432 { 437 {
@@ -457,17 +462,17 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber )
457 462
458 QCopEnvelope e(channel.latin1(), message.latin1()); 463 QCopEnvelope e(channel.latin1(), message.latin1());
459 //US we need no names in the To field. The emailadresses are enough 464 //US we need no names in the To field. The emailadresses are enough
460 465
461 passParameter(&e, parameters, faxnumber); 466 passParameter(&e, parameters, faxnumber);
462 467
463 468
464#else 469#else
465 KMessageBox::sorry( this, i18n( "This version does not support the sending of faxes." ) ); 470 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
466#endif 471#endif
467 472
468 473
469 return true; 474 return true;
470} 475}
471 476
472 477
473 478
@@ -476,16 +481,17 @@ bool ExternalAppHandler::callByFax( const QString& faxnumber )
476 481
477QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const 482QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1) const
478{ 483{
479 return message.replace( QRegExp("%1"), param1 ); 484 return message.replace( QRegExp("%1"), param1 );
480} 485}
481 486
482void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const 487void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameters, const QString& param1) const
483{ 488{
489#ifndef DESKTOP_VERSION
484 QMap<QString, QString> valmap; 490 QMap<QString, QString> valmap;
485 bool useValMap = false; 491 bool useValMap = false;
486 492
487 // first extract all parts of the parameters. 493 // first extract all parts of the parameters.
488 QStringList paramlist = QStringList::split(";", parameters); 494 QStringList paramlist = QStringList::split(";", parameters);
489 495
490 //Now check how many parts we have. 496 //Now check how many parts we have.
491 //=0 :no params to pass 497 //=0 :no params to pass
@@ -513,14 +519,14 @@ void ExternalAppHandler::passParameter(QCopEnvelope* e, const QString& parameter
513 { 519 {
514 (*e) << key.latin1(); 520 (*e) << key.latin1();
515 } 521 }
516 } 522 }
517 523
518 if (useValMap == true) 524 if (useValMap == true)
519 (*e) << valmap; 525 (*e) << valmap;
520 526
521 527#endif
522 528
523} 529}
524 530
525 531
526 532