summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.cpp
authorzautrix <zautrix>2004-10-27 22:35:41 (UTC)
committer zautrix <zautrix>2004-10-27 22:35:41 (UTC)
commit5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c (patch) (unidiff)
tree914ce70d7e5a1afcd2da0c2fda34b959d65d0462 /libkdepim/externalapphandler.cpp
parent9c88346fc757fd1dc54b3fca151a2a610159d8cf (diff)
downloadkdepimpi-5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c.zip
kdepimpi-5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c.tar.gz
kdepimpi-5afbc6ae0908ce12fd5abb1c4eadf9c61a01503c.tar.bz2
pwm close fix
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 9085673..9f12152 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -351,831 +351,837 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d
351 ********************************************************************************/ 351 ********************************************************************************/
352 352
353 353
354ExternalAppHandler *ExternalAppHandler::sInstance = 0; 354ExternalAppHandler *ExternalAppHandler::sInstance = 0;
355static KStaticDeleter<ExternalAppHandler> staticDeleter; 355static KStaticDeleter<ExternalAppHandler> staticDeleter;
356 356
357ExternalAppHandler::ExternalAppHandler() 357ExternalAppHandler::ExternalAppHandler()
358{ 358{
359 mDefaultItems.setAutoDelete(true); 359 mDefaultItems.setAutoDelete(true);
360 360
361 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); 361 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList");
362 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); 362 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&)));
363 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 363 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
364 364
365//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); 365//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList");
366//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); 366//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&)));
367//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); 367//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)));
368 368
369 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); 369 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", "");
370 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&))); 370 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&)));
371 371
372 372
373 373
374 mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); 374 mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList");
375 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); 375 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&)));
376 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 376 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
377 377
378 378
379} 379}
380 380
381ExternalAppHandler::~ExternalAppHandler() 381ExternalAppHandler::~ExternalAppHandler()
382{ 382{
383 delete mNameEmailUidListFromKAPITransfer; 383 delete mNameEmailUidListFromKAPITransfer;
384 //delete mFindByEmailFromKAPITransfer; 384 //delete mFindByEmailFromKAPITransfer;
385 delete mDisplayDetails; 385 delete mDisplayDetails;
386 delete mBirthdayListFromKAPITransfer; 386 delete mBirthdayListFromKAPITransfer;
387} 387}
388 388
389void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, 389void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid,
390 const QStringList& nameList, 390 const QStringList& nameList,
391 const QStringList& emailList, 391 const QStringList& emailList,
392 const QStringList& uidList, 392 const QStringList& uidList,
393 const QStringList&, 393 const QStringList&,
394 const QStringList&, 394 const QStringList&,
395 const QStringList& ) 395 const QStringList& )
396{ 396{
397 // this method is a conevnient way to reduce the number of parameters I have to pass 397 // this method is a conevnient way to reduce the number of parameters I have to pass
398 emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); 398 emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList);
399} 399}
400 400
401 401
402void ExternalAppHandler::loadConfig() 402void ExternalAppHandler::loadConfig()
403{ 403{
404 404
405 mDefaultItems.clear(); 405 mDefaultItems.clear();
406 mEmailAppAvailable = UNDEFINED; 406 mEmailAppAvailable = UNDEFINED;
407 mPhoneAppAvailable = UNDEFINED; 407 mPhoneAppAvailable = UNDEFINED;
408 mFaxAppAvailable = UNDEFINED; 408 mFaxAppAvailable = UNDEFINED;
409 mSMSAppAvailable = UNDEFINED; 409 mSMSAppAvailable = UNDEFINED;
410 mPagerAppAvailable = UNDEFINED; 410 mPagerAppAvailable = UNDEFINED;
411 mSIPAppAvailable = UNDEFINED; 411 mSIPAppAvailable = UNDEFINED;
412 412
413 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); 413 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
414 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); 414 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
415 415
416 if (opiepath.isEmpty()) 416 if (opiepath.isEmpty())
417 opiepath = qtopiapath; 417 opiepath = qtopiapath;
418 418
419 //mailclients 419 //mailclients
420 QString mailmsg1 = "writeMail(QString,QString)"; 420 QString mailmsg1 = "writeMail(QString,QString)";
421 QString mailmsg2 = "writeMail(QMap(QString,QString))"; 421 QString mailmsg2 = "writeMail(QMap(QString,QString))";
422 422
423 QString undefined = ""; 423 QString undefined = "";
424 424
425 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); 425 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined);
426 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); 426 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined);
427 427
428 if (( QFile::exists( qtopiapath + "/bin/ompi" )) || 428 if (( QFile::exists( qtopiapath + "/bin/ompi" )) ||
429 ( QFile::exists( opiepath + "/bin/ompi" ))) 429 ( QFile::exists( opiepath + "/bin/ompi" )))
430 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 430 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
431 431
432 if ( QFile::exists( qtopiapath + "/bin/qtmail" )) 432 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
433 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 433 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
434 434
435 if ( QFile::exists( opiepath + "/bin/opiemail" )) 435 if ( QFile::exists( opiepath + "/bin/opiemail" ))
436 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 436 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
437 437
438 438
439 439
440 //phoneclients 440 //phoneclients
441 441
442 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); 442 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined);
443 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); 443 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined);
444 if (( QFile::exists( qtopiapath + "/bin/kppi" )) || 444 if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
445 ( QFile::exists( opiepath + "/bin/kppi" ))) 445 ( QFile::exists( opiepath + "/bin/kppi" )))
446 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); 446 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
447 447
448 //faxclients 448 //faxclients
449 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); 449 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined);
450 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); 450 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined);
451 451
452 //smsclients 452 //smsclients
453 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); 453 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined);
454 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); 454 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined);
455 455
456 //pagerclients 456 //pagerclients
457 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); 457 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined);
458 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); 458 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined);
459 459
460 //sipclients 460 //sipclients
461 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); 461 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined);
462 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); 462 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined);
463 if (( QFile::exists( qtopiapath + "/bin/kppi" )) || 463 if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
464 ( QFile::exists( opiepath + "/bin/kppi" ))) 464 ( QFile::exists( opiepath + "/bin/kppi" )))
465 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); 465 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
466 466
467} 467}
468 468
469ExternalAppHandler *ExternalAppHandler::instance() 469ExternalAppHandler *ExternalAppHandler::instance()
470{ 470{
471 if ( !sInstance ) { 471 if ( !sInstance ) {
472 sInstance = staticDeleter.setObject( new ExternalAppHandler() ); 472 sInstance = staticDeleter.setObject( new ExternalAppHandler() );
473 sInstance->loadConfig(); 473 sInstance->loadConfig();
474 } 474 }
475 475
476 return sInstance; 476 return sInstance;
477} 477}
478 478
479void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) 479void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2)
480{ 480{
481 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); 481 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2);
482 // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); 482 // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() );
483 mDefaultItems.append(dai); 483 mDefaultItems.append(dai);
484} 484}
485 485
486 486
487QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) 487QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type)
488{ 488{
489 QList<DefaultAppItem> list; 489 QList<DefaultAppItem> list;
490 490
491 DefaultAppItem* dai; 491 DefaultAppItem* dai;
492 492
493 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 493 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
494 { 494 {
495 if (dai->_type == type) 495 if (dai->_type == type)
496 list.append(dai); 496 list.append(dai);
497 } 497 }
498 498
499 return list; 499 return list;
500} 500}
501 501
502DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) 502DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
503{ 503{
504 DefaultAppItem* dai; 504 DefaultAppItem* dai;
505 505
506 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 506 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
507 { 507 {
508 if (dai->_type == type && dai->_id == clientid) 508 if (dai->_type == type && dai->_id == clientid)
509 return dai; 509 return dai;
510 } 510 }
511 511
512 return 0; 512 return 0;
513} 513}
514 514
515bool ExternalAppHandler::isEmailAppAvailable() 515bool ExternalAppHandler::isEmailAppAvailable()
516{ 516{
517#ifndef DESKTOP_VERSION 517#ifndef DESKTOP_VERSION
518 if (mEmailAppAvailable == UNDEFINED) 518 if (mEmailAppAvailable == UNDEFINED)
519 { 519 {
520 int client = KPimGlobalPrefs::instance()->mEmailClient; 520 int client = KPimGlobalPrefs::instance()->mEmailClient;
521 if (client == KPimGlobalPrefs::NONE_EMC) 521 if (client == KPimGlobalPrefs::NONE_EMC)
522 mEmailAppAvailable = UNAVAILABLE; 522 mEmailAppAvailable = UNAVAILABLE;
523 else 523 else
524 mEmailAppAvailable = AVAILABLE; 524 mEmailAppAvailable = AVAILABLE;
525 } 525 }
526 return (mEmailAppAvailable == AVAILABLE); 526 return (mEmailAppAvailable == AVAILABLE);
527 527
528#else //DESKTOP_VERSION 528#else //DESKTOP_VERSION
529 return false; 529 return false;
530#endif //DESKTOP_VERSION 530#endif //DESKTOP_VERSION
531} 531}
532 532
533bool ExternalAppHandler::isSMSAppAvailable() 533bool ExternalAppHandler::isSMSAppAvailable()
534{ 534{
535#ifndef DESKTOP_VERSION 535#ifndef DESKTOP_VERSION
536 if (mSMSAppAvailable == UNDEFINED) 536 if (mSMSAppAvailable == UNDEFINED)
537 { 537 {
538 int client = KPimGlobalPrefs::instance()->mSMSClient; 538 int client = KPimGlobalPrefs::instance()->mSMSClient;
539 if (client == KPimGlobalPrefs::NONE_SMC) 539 if (client == KPimGlobalPrefs::NONE_SMC)
540 mSMSAppAvailable = UNAVAILABLE; 540 mSMSAppAvailable = UNAVAILABLE;
541 else 541 else
542 mSMSAppAvailable = AVAILABLE; 542 mSMSAppAvailable = AVAILABLE;
543 } 543 }
544 544
545 return (mSMSAppAvailable == AVAILABLE); 545 return (mSMSAppAvailable == AVAILABLE);
546#else //DESKTOP_VERSION 546#else //DESKTOP_VERSION
547 return false; 547 return false;
548#endif //DESKTOP_VERSION 548#endif //DESKTOP_VERSION
549} 549}
550 550
551bool ExternalAppHandler::isPhoneAppAvailable() 551bool ExternalAppHandler::isPhoneAppAvailable()
552{ 552{
553#ifndef DESKTOP_VERSION 553#ifndef DESKTOP_VERSION
554 if (mPhoneAppAvailable == UNDEFINED) 554 if (mPhoneAppAvailable == UNDEFINED)
555 { 555 {
556 int client = KPimGlobalPrefs::instance()->mPhoneClient; 556 int client = KPimGlobalPrefs::instance()->mPhoneClient;
557 if (client == KPimGlobalPrefs::NONE_PHC) 557 if (client == KPimGlobalPrefs::NONE_PHC)
558 mPhoneAppAvailable = UNAVAILABLE; 558 mPhoneAppAvailable = UNAVAILABLE;
559 else 559 else
560 mPhoneAppAvailable = AVAILABLE; 560 mPhoneAppAvailable = AVAILABLE;
561 } 561 }
562 562
563 return (mPhoneAppAvailable == AVAILABLE); 563 return (mPhoneAppAvailable == AVAILABLE);
564#else //DESKTOP_VERSION 564#else //DESKTOP_VERSION
565 return false; 565 return false;
566#endif //DESKTOP_VERSION 566#endif //DESKTOP_VERSION
567} 567}
568 568
569bool ExternalAppHandler::isFaxAppAvailable() 569bool ExternalAppHandler::isFaxAppAvailable()
570{ 570{
571#ifndef DESKTOP_VERSION 571#ifndef DESKTOP_VERSION
572 if (mFaxAppAvailable == UNDEFINED) 572 if (mFaxAppAvailable == UNDEFINED)
573 { 573 {
574 int client = KPimGlobalPrefs::instance()->mFaxClient; 574 int client = KPimGlobalPrefs::instance()->mFaxClient;
575 if (client == KPimGlobalPrefs::NONE_FAC) 575 if (client == KPimGlobalPrefs::NONE_FAC)
576 mFaxAppAvailable = UNAVAILABLE; 576 mFaxAppAvailable = UNAVAILABLE;
577 else 577 else
578 mFaxAppAvailable = AVAILABLE; 578 mFaxAppAvailable = AVAILABLE;
579 } 579 }
580 580
581 return (mFaxAppAvailable == AVAILABLE); 581 return (mFaxAppAvailable == AVAILABLE);
582#else //DESKTOP_VERSION 582#else //DESKTOP_VERSION
583 return false; 583 return false;
584#endif //DESKTOP_VERSION 584#endif //DESKTOP_VERSION
585} 585}
586 586
587bool ExternalAppHandler::isPagerAppAvailable() 587bool ExternalAppHandler::isPagerAppAvailable()
588{ 588{
589#ifndef DESKTOP_VERSION 589#ifndef DESKTOP_VERSION
590 if (mPagerAppAvailable == UNDEFINED) 590 if (mPagerAppAvailable == UNDEFINED)
591 { 591 {
592 int client = KPimGlobalPrefs::instance()->mPagerClient; 592 int client = KPimGlobalPrefs::instance()->mPagerClient;
593 if (client == KPimGlobalPrefs::NONE_PAC) 593 if (client == KPimGlobalPrefs::NONE_PAC)
594 mPagerAppAvailable = UNAVAILABLE; 594 mPagerAppAvailable = UNAVAILABLE;
595 else 595 else
596 mPagerAppAvailable = AVAILABLE; 596 mPagerAppAvailable = AVAILABLE;
597 } 597 }
598 598
599 return (mPagerAppAvailable == AVAILABLE); 599 return (mPagerAppAvailable == AVAILABLE);
600#else //DESKTOP_VERSION 600#else //DESKTOP_VERSION
601 return false; 601 return false;
602#endif //DESKTOP_VERSION 602#endif //DESKTOP_VERSION
603} 603}
604 604
605 605
606bool ExternalAppHandler::isSIPAppAvailable() 606bool ExternalAppHandler::isSIPAppAvailable()
607{ 607{
608#ifndef DESKTOP_VERSION 608#ifndef DESKTOP_VERSION
609 if (mSIPAppAvailable == UNDEFINED) 609 if (mSIPAppAvailable == UNDEFINED)
610 { 610 {
611 int client = KPimGlobalPrefs::instance()->mSipClient; 611 int client = KPimGlobalPrefs::instance()->mSipClient;
612 if (client == KPimGlobalPrefs::NONE_SIC) 612 if (client == KPimGlobalPrefs::NONE_SIC)
613 mSIPAppAvailable = UNAVAILABLE; 613 mSIPAppAvailable = UNAVAILABLE;
614 else 614 else
615 mSIPAppAvailable = AVAILABLE; 615 mSIPAppAvailable = AVAILABLE;
616 } 616 }
617 617
618 return (mSIPAppAvailable == AVAILABLE); 618 return (mSIPAppAvailable == AVAILABLE);
619#else //DESKTOP_VERSION 619#else //DESKTOP_VERSION
620 return false; 620 return false;
621#endif //DESKTOP_VERSION 621#endif //DESKTOP_VERSION
622} 622}
623 623
624/************************************************************************** 624/**************************************************************************
625 * 625 *
626 **************************************************************************/ 626 **************************************************************************/
627 627
628 628
629//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) 629//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma)
630bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) 630bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls )
631{ 631{
632 632
633#ifndef DESKTOP_VERSION 633#ifndef DESKTOP_VERSION
634 QString channel; 634 QString channel;
635 QString message2; 635 QString message2;
636 QString parameters2; 636 QString parameters2;
637 637
638 638
639 int client = KPimGlobalPrefs::instance()->mEmailClient; 639 int client = KPimGlobalPrefs::instance()->mEmailClient;
640 if (client == KPimGlobalPrefs::OTHER_EMC) 640 if (client == KPimGlobalPrefs::OTHER_EMC)
641 { 641 {
642 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; 642 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
643 message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; 643 message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage;
644 parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; 644 parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
645 } 645 }
646 else 646 else
647 { 647 {
648 DefaultAppItem* dai = getDefaultItem(EMAIL, client); 648 DefaultAppItem* dai = getDefaultItem(EMAIL, client);
649 if (!dai) 649 if (!dai)
650 { 650 {
651 qDebug("could not find configured email application."); 651 qDebug("could not find configured email application.");
652 return false; 652 return false;
653 } 653 }
654 channel = dai->_channel; 654 channel = dai->_channel;
655 message2 = dai->_message2; 655 message2 = dai->_message2;
656 parameters2 = dai->_parameters2; 656 parameters2 = dai->_parameters2;
657 } 657 }
658 658
659 //first check if one of the mailers need the emails right in the message. 659 //first check if one of the mailers need the emails right in the message.
660 message2 = translateMessage(message2, emails, urls); 660 message2 = translateMessage(message2, emails, urls);
661 661
662 662
663#ifdef DEBUG_EXT_APP_HANDLER 663#ifdef DEBUG_EXT_APP_HANDLER
664 qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); 664 qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1());
665 qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); 665 qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1());
666#endif 666#endif
667 667
668 668
669 QCopEnvelope e(channel.latin1(), message2.latin1()); 669 QCopEnvelope e(channel.latin1(), message2.latin1());
670 //US we need no names in the To field. The emailadresses are enough 670 //US we need no names in the To field. The emailadresses are enough
671 671
672 passParameters(&e, parameters2, emails, urls); 672 passParameters(&e, parameters2, emails, urls);
673 673
674 674
675 675
676#else 676#else
677 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); 677 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
678#endif 678#endif
679 679
680 return true; 680 return true;
681} 681}
682 682
683/************************************************************************** 683/**************************************************************************
684 * 684 *
685 **************************************************************************/ 685 **************************************************************************/
686 686
687 687
688//calls the emailapplication and creates a mail with parameter emails as recipients 688//calls the emailapplication and creates a mail with parameter emails as recipients
689bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) 689bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress )
690{ 690{
691#ifndef DESKTOP_VERSION 691#ifndef DESKTOP_VERSION
692 QString channel; 692 QString channel;
693 QString message; 693 QString message;
694 QString parameters; 694 QString parameters;
695 695
696 696
697 int client = KPimGlobalPrefs::instance()->mEmailClient; 697 int client = KPimGlobalPrefs::instance()->mEmailClient;
698 if (client == KPimGlobalPrefs::OTHER_EMC) 698 if (client == KPimGlobalPrefs::OTHER_EMC)
699 { 699 {
700 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; 700 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
701 message = KPimGlobalPrefs::instance()->mEmailOtherMessage; 701 message = KPimGlobalPrefs::instance()->mEmailOtherMessage;
702 parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; 702 parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
703 } 703 }
704 else 704 else
705 { 705 {
706 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); 706 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client);
707 if (!dai) 707 if (!dai)
708 { 708 {
709 qDebug("could not find configured email application."); 709 qDebug("could not find configured email application.");
710 return false; 710 return false;
711 } 711 }
712 channel = dai->_channel; 712 channel = dai->_channel;
713 message = dai->_message; 713 message = dai->_message;
714 parameters = dai->_parameters; 714 parameters = dai->_parameters;
715 } 715 }
716 716
717 717
718 //first check if one of the mailers need the emails right in the message. 718 //first check if one of the mailers need the emails right in the message.
719 message = translateMessage(message, name, emailadress); 719 message = translateMessage(message, name, emailadress);
720 720
721 721
722#ifdef DEBUG_EXT_APP_HANDLER 722#ifdef DEBUG_EXT_APP_HANDLER
723 qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 723 qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
724 qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); 724 qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1());
725#endif 725#endif
726 726
727 QCopEnvelope e(channel.latin1(), message.latin1()); 727 QCopEnvelope e(channel.latin1(), message.latin1());
728 //US we need no names in the To field. The emailadresses are enough 728 //US we need no names in the To field. The emailadresses are enough
729 729
730 passParameters(&e, parameters, name, emailadress); 730 passParameters(&e, parameters, name, emailadress);
731 731
732 732
733#else 733#else
734 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); 734 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
735#endif 735#endif
736 736
737 737
738 return true; 738 return true;
739} 739}
740 740
741/************************************************************************** 741/**************************************************************************
742 * 742 *
743 **************************************************************************/ 743 **************************************************************************/
744 744
745//calls the emailapplication and creates a mail with parameter as recipients 745//calls the emailapplication and creates a mail with parameter as recipients
746// parameters format is 746// parameters format is
747// NAME <EMAIL>:SUBJECT 747// NAME <EMAIL>:SUBJECT
748bool ExternalAppHandler::mailToOneContact( const QString& adressline ) 748bool ExternalAppHandler::mailToOneContact( const QString& adressline )
749{ 749{
750 QString line = adressline; 750 QString line = adressline;
751 751
752 int first = line.find( "<"); 752 int first = line.find( "<");
753 int last = line.find( ">"); 753 int last = line.find( ">");
754 QString name = line.left(first); 754 QString name = line.left(first);
755 QString emailadress = line.mid(first+1, last-first-1); 755 QString emailadress = line.mid(first+1, last-first-1);
756 756
757 //Subject can not be handled right now. 757 //Subject can not be handled right now.
758 return mailToOneContact( name, emailadress ); 758 return mailToOneContact( name, emailadress );
759 759
760} 760}
761 761
762 762
763/************************************************************************** 763/**************************************************************************
764 * 764 *
765 **************************************************************************/ 765 **************************************************************************/
766 766
767//calls the phoneapplication with the number 767//calls the phoneapplication with the number
768bool ExternalAppHandler::callByPhone( const QString& phonenumber ) 768bool ExternalAppHandler::callByPhone( const QString& phonenumber )
769{ 769{
770#ifndef DESKTOP_VERSION 770#ifndef DESKTOP_VERSION
771 QString channel; 771 QString channel;
772 QString message; 772 QString message;
773 QString parameters; 773 QString parameters;
774 774
775 775
776 int client = KPimGlobalPrefs::instance()->mPhoneClient; 776 int client = KPimGlobalPrefs::instance()->mPhoneClient;
777 if (client == KPimGlobalPrefs::OTHER_PHC) 777 if (client == KPimGlobalPrefs::OTHER_PHC)
778 { 778 {
779 channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; 779 channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel;
780 message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; 780 message = KPimGlobalPrefs::instance()->mPhoneOtherMessage;
781 parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; 781 parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters;
782 } 782 }
783 else 783 else
784 { 784 {
785 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); 785 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client);
786 if (!dai) 786 if (!dai)
787 { 787 {
788 qDebug("could not find configured phone application."); 788 qDebug("could not find configured phone application.");
789 return false; 789 return false;
790 } 790 }
791 channel = dai->_channel; 791 channel = dai->_channel;
792 message = dai->_message; 792 message = dai->_message;
793 parameters = dai->_parameters; 793 parameters = dai->_parameters;
794 } 794 }
795 795
796 796
797 //first check if one of the mailers need the emails right in the message. 797 //first check if one of the mailers need the emails right in the message.
798 message = translateMessage(message, phonenumber, ""); 798 message = translateMessage(message, phonenumber, "");
799 799
800 800
801#ifdef DEBUG_EXT_APP_HANDLER 801#ifdef DEBUG_EXT_APP_HANDLER
802 qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 802 qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
803 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); 803 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
804#endif 804#endif
805 805
806 QCopEnvelope e(channel.latin1(), message.latin1()); 806 QCopEnvelope e(channel.latin1(), message.latin1());
807 //US we need no names in the To field. The emailadresses are enough 807 //US we need no names in the To field. The emailadresses are enough
808 808
809 passParameters(&e, parameters, phonenumber, ""); 809 passParameters(&e, parameters, phonenumber, "");
810 810
811 811
812#else 812#else
813 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); 813 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) );
814#endif 814#endif
815 815
816 816
817 return true; 817 return true;
818} 818}
819 819
820/************************************************************************** 820/**************************************************************************
821 * 821 *
822 **************************************************************************/ 822 **************************************************************************/
823 823
824//calls the smsapplication with the number 824//calls the smsapplication with the number
825bool ExternalAppHandler::callBySMS( const QString& phonenumber ) 825bool ExternalAppHandler::callBySMS( const QString& phonenumber )
826{ 826{
827#ifndef DESKTOP_VERSION 827#ifndef DESKTOP_VERSION
828 QString channel; 828 QString channel;
829 QString message; 829 QString message;
830 QString parameters; 830 QString parameters;
831 831
832 832
833 int client = KPimGlobalPrefs::instance()->mSMSClient; 833 int client = KPimGlobalPrefs::instance()->mSMSClient;
834 if (client == KPimGlobalPrefs::OTHER_SMC) 834 if (client == KPimGlobalPrefs::OTHER_SMC)
835 { 835 {
836 channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; 836 channel = KPimGlobalPrefs::instance()->mSMSOtherChannel;
837 message = KPimGlobalPrefs::instance()->mSMSOtherMessage; 837 message = KPimGlobalPrefs::instance()->mSMSOtherMessage;
838 parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; 838 parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters;
839 } 839 }
840 else 840 else
841 { 841 {
842 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); 842 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client);
843 if (!dai) 843 if (!dai)
844 { 844 {
845 qDebug("could not find configured sms application."); 845 qDebug("could not find configured sms application.");
846 return false; 846 return false;
847 } 847 }
848 channel = dai->_channel; 848 channel = dai->_channel;
849 message = dai->_message; 849 message = dai->_message;
850 parameters = dai->_parameters; 850 parameters = dai->_parameters;
851 } 851 }
852 852
853 853
854 //first check if one of the mailers need the emails right in the message. 854 //first check if one of the mailers need the emails right in the message.
855 message = translateMessage(message, phonenumber, ""); 855 message = translateMessage(message, phonenumber, "");
856 856
857 857
858#ifdef DEBUG_EXT_APP_HANDLER 858#ifdef DEBUG_EXT_APP_HANDLER
859 qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 859 qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
860 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); 860 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
861#endif 861#endif
862 862
863 QCopEnvelope e(channel.latin1(), message.latin1()); 863 QCopEnvelope e(channel.latin1(), message.latin1());
864 //US we need no names in the To field. The emailadresses are enough 864 //US we need no names in the To field. The emailadresses are enough
865 865
866 passParameters(&e, parameters, phonenumber, ""); 866 passParameters(&e, parameters, phonenumber, "");
867 867
868 868
869#else 869#else
870 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); 870 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
871#endif 871#endif
872 872
873 873
874 return true; 874 return true;
875} 875}
876 876
877/************************************************************************** 877/**************************************************************************
878 * 878 *
879 **************************************************************************/ 879 **************************************************************************/
880 880
881//calls the pagerapplication with the number 881//calls the pagerapplication with the number
882bool ExternalAppHandler::callByPager( const QString& pagernumber ) 882bool ExternalAppHandler::callByPager( const QString& pagernumber )
883{ 883{
884#ifndef DESKTOP_VERSION 884#ifndef DESKTOP_VERSION
885 QString channel; 885 QString channel;
886 QString message; 886 QString message;
887 QString parameters; 887 QString parameters;
888 888
889 889
890 int client = KPimGlobalPrefs::instance()->mPagerClient; 890 int client = KPimGlobalPrefs::instance()->mPagerClient;
891 if (client == KPimGlobalPrefs::OTHER_PAC) 891 if (client == KPimGlobalPrefs::OTHER_PAC)
892 { 892 {
893 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; 893 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel;
894 message = KPimGlobalPrefs::instance()->mPagerOtherMessage; 894 message = KPimGlobalPrefs::instance()->mPagerOtherMessage;
895 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; 895 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters;
896 } 896 }
897 else 897 else
898 { 898 {
899 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); 899 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client);
900 if (!dai) 900 if (!dai)
901 { 901 {
902 qDebug("could not find configured pager application."); 902 qDebug("could not find configured pager application.");
903 return false; 903 return false;
904 } 904 }
905 channel = dai->_channel; 905 channel = dai->_channel;
906 message = dai->_message; 906 message = dai->_message;
907 parameters = dai->_parameters; 907 parameters = dai->_parameters;
908 } 908 }
909 909
910 910
911 //first check if one of the mailers need the emails right in the message. 911 //first check if one of the mailers need the emails right in the message.
912 message = translateMessage(message, pagernumber, ""); 912 message = translateMessage(message, pagernumber, "");
913 913
914 914
915#ifdef DEBUG_EXT_APP_HANDLER 915#ifdef DEBUG_EXT_APP_HANDLER
916 qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 916 qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
917 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); 917 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1());
918#endif 918#endif
919 919
920 QCopEnvelope e(channel.latin1(), message.latin1()); 920 QCopEnvelope e(channel.latin1(), message.latin1());
921 //US we need no names in the To field. The emailadresses are enough 921 //US we need no names in the To field. The emailadresses are enough
922 922
923 passParameters(&e, parameters, pagernumber, ""); 923 passParameters(&e, parameters, pagernumber, "");
924 924
925 925
926#else 926#else
927 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); 927 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
928#endif 928#endif
929 929
930 930
931 return true; 931 return true;
932} 932}
933 933
934/************************************************************************** 934/**************************************************************************
935 * 935 *
936 **************************************************************************/ 936 **************************************************************************/
937 937
938//calls the faxapplication with the number 938//calls the faxapplication with the number
939bool ExternalAppHandler::callByFax( const QString& faxnumber ) 939bool ExternalAppHandler::callByFax( const QString& faxnumber )
940{ 940{
941#ifndef DESKTOP_VERSION 941#ifndef DESKTOP_VERSION
942 QString channel; 942 QString channel;
943 QString message; 943 QString message;
944 QString parameters; 944 QString parameters;
945 945
946 946
947 int client = KPimGlobalPrefs::instance()->mFaxClient; 947 int client = KPimGlobalPrefs::instance()->mFaxClient;
948 if (client == KPimGlobalPrefs::OTHER_FAC) 948 if (client == KPimGlobalPrefs::OTHER_FAC)
949 { 949 {
950 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; 950 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel;
951 message = KPimGlobalPrefs::instance()->mFaxOtherMessage; 951 message = KPimGlobalPrefs::instance()->mFaxOtherMessage;
952 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; 952 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters;
953 } 953 }
954 else 954 else
955 { 955 {
956 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); 956 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client);
957 if (!dai) 957 if (!dai)
958 { 958 {
959 qDebug("could not find configured fax application."); 959 qDebug("could not find configured fax application.");
960 return false; 960 return false;
961 } 961 }
962 channel = dai->_channel; 962 channel = dai->_channel;
963 message = dai->_message; 963 message = dai->_message;
964 parameters = dai->_parameters; 964 parameters = dai->_parameters;
965 } 965 }
966 966
967 967
968 //first check if one of the mailers need the emails right in the message. 968 //first check if one of the mailers need the emails right in the message.
969 message = translateMessage(message, faxnumber, ""); 969 message = translateMessage(message, faxnumber, "");
970 970
971 971
972#ifdef DEBUG_EXT_APP_HANDLER 972#ifdef DEBUG_EXT_APP_HANDLER
973 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 973 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
974 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); 974 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
975#endif 975#endif
976 976
977 QCopEnvelope e(channel.latin1(), message.latin1()); 977 QCopEnvelope e(channel.latin1(), message.latin1());
978 //US we need no names in the To field. The emailadresses are enough 978 //US we need no names in the To field. The emailadresses are enough
979 979
980 passParameters(&e, parameters, faxnumber, ""); 980 passParameters(&e, parameters, faxnumber, "");
981 981
982 982
983#else 983#else
984 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); 984 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
985#endif 985#endif
986 986
987 987
988 return true; 988 return true;
989} 989}
990 990
991/************************************************************************** 991/**************************************************************************
992 * 992 *
993 **************************************************************************/ 993 **************************************************************************/
994 994
995//calls the sipapplication with the number 995//calls the sipapplication with the number
996bool ExternalAppHandler::callBySIP( const QString& sipnumber ) 996bool ExternalAppHandler::callBySIP( const QString& sipnumber )
997{ 997{
998#ifndef DESKTOP_VERSION 998#ifndef DESKTOP_VERSION
999 QString channel; 999 QString channel;
1000 QString message; 1000 QString message;
1001 QString parameters; 1001 QString parameters;
1002 1002
1003 1003
1004 int client = KPimGlobalPrefs::instance()->mSipClient; 1004 int client = KPimGlobalPrefs::instance()->mSipClient;
1005 if (client == KPimGlobalPrefs::OTHER_SIC) 1005 if (client == KPimGlobalPrefs::OTHER_SIC)
1006 { 1006 {
1007 channel = KPimGlobalPrefs::instance()->mSipOtherChannel; 1007 channel = KPimGlobalPrefs::instance()->mSipOtherChannel;
1008 message = KPimGlobalPrefs::instance()->mSipOtherMessage; 1008 message = KPimGlobalPrefs::instance()->mSipOtherMessage;
1009 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; 1009 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters;
1010 } 1010 }
1011 else 1011 else
1012 { 1012 {
1013 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); 1013 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client);
1014 if (!dai) 1014 if (!dai)
1015 { 1015 {
1016 qDebug("could not find configured sip application."); 1016 qDebug("could not find configured sip application.");
1017 return false; 1017 return false;
1018 } 1018 }
1019 channel = dai->_channel; 1019 channel = dai->_channel;
1020 message = dai->_message; 1020 message = dai->_message;
1021 parameters = dai->_parameters; 1021 parameters = dai->_parameters;
1022 } 1022 }
1023 1023
1024 1024
1025 //first check if one of the sip apps need the emails right in the message. 1025 //first check if one of the sip apps need the emails right in the message.
1026 message = translateMessage(message, sipnumber, ""); 1026 message = translateMessage(message, sipnumber, "");
1027 1027
1028 1028
1029#ifdef DEBUG_EXT_APP_HANDLER 1029#ifdef DEBUG_EXT_APP_HANDLER
1030 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 1030 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
1031 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); 1031 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1());
1032#endif 1032#endif
1033 1033
1034 QCopEnvelope e(channel.latin1(), message.latin1()); 1034 QCopEnvelope e(channel.latin1(), message.latin1());
1035 //US we need no names in the To field. The emailadresses are enough 1035 //US we need no names in the To field. The emailadresses are enough
1036 1036
1037 passParameters(&e, parameters, sipnumber, ""); 1037 passParameters(&e, parameters, sipnumber, "");
1038 1038
1039 1039
1040#else 1040#else
1041 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); 1041 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) );
1042#endif 1042#endif
1043 1043
1044 1044
1045 return true; 1045 return true;
1046} 1046}
1047 1047
1048 1048
1049/************************************************************************** 1049/**************************************************************************
1050 * 1050 *
1051 **************************************************************************/ 1051 **************************************************************************/
1052 1052
1053 1053
1054QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const 1054QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const
1055{ 1055{
1056 message = message.replace( QRegExp("%1"), param1 ); 1056 message = message.replace( QRegExp("%1"), param1 );
1057 return message.replace( QRegExp("%2"), param2 ); 1057 return message.replace( QRegExp("%2"), param2 );
1058} 1058}
1059 1059
1060/************************************************************************** 1060/**************************************************************************
1061 * 1061 *
1062 **************************************************************************/ 1062 **************************************************************************/
1063 1063
1064void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const 1064void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const
1065{ 1065{
1066#ifndef DESKTOP_VERSION 1066#ifndef DESKTOP_VERSION
1067 QMap<QString, QString> valmap; 1067 QMap<QString, QString> valmap;
1068 bool useValMap = false; 1068 bool useValMap = false;
1069 1069
1070 // first extract all parts of the parameters. 1070 // first extract all parts of the parameters.
1071 QStringList paramlist = QStringList::split(";", parameters); 1071 QStringList paramlist = QStringList::split(";", parameters);
1072 1072
1073 //Now check how many parts we have. 1073 //Now check how many parts we have.
1074 //=0 :no params to pass 1074 //=0 :no params to pass
1075 //>0 :parameters to pass 1075 //>0 :parameters to pass
1076 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) 1076 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
1077 { 1077 {
1078 QString param = (*it); 1078 QString param = (*it);
1079 QStringList keyvallist = QStringList::split("=", param); 1079 QStringList keyvallist = QStringList::split("=", param);
1080 1080
1081 //if we have keyvalue pairs, we assume that we pass a map to the envelope 1081 //if we have keyvalue pairs, we assume that we pass a map to the envelope
1082 QStringList::Iterator it2 = keyvallist.begin(); 1082 QStringList::Iterator it2 = keyvallist.begin();
1083 QString key = (*it2); 1083 QString key = (*it2);
1084 key = key.replace( QRegExp("%1"), param1 ); 1084 key = key.replace( QRegExp("%1"), param1 );
1085 key = key.replace( QRegExp("%2"), param2 ); 1085 key = key.replace( QRegExp("%2"), param2 );
1086 ++it2; 1086 ++it2;
1087 1087
1088 if(it2 != keyvallist.end()) 1088 if(it2 != keyvallist.end())
1089 { 1089 {
1090 QString value = (*it2); 1090 QString value = (*it2);
1091 value = value.replace( QRegExp("%1"), param1 ); 1091 value = value.replace( QRegExp("%1"), param1 );
1092 value = value.replace( QRegExp("%2"), param2 ); 1092 value = value.replace( QRegExp("%2"), param2 );
1093 1093
1094 valmap.insert(key, value); 1094 valmap.insert(key, value);
1095 useValMap = true; 1095 useValMap = true;
1096 } 1096 }
1097 else 1097 else
1098 { 1098 {
1099 // qDebug("pass parameter << %s", key.latin1()); 1099 // qDebug("pass parameter << %s", key.latin1());
1100 (*e) << key; 1100 (*e) << key;
1101 } 1101 }
1102 } 1102 }
1103 1103
1104 if (useValMap == true) 1104 if (useValMap == true)
1105 (*e) << valmap; 1105 (*e) << valmap;
1106 1106
1107#endif 1107#endif
1108 1108
1109} 1109}
1110 1110
1111 1111
1112 1112
1113/************************************************************************** 1113/**************************************************************************
1114 * 1114 *
1115 **************************************************************************/ 1115 **************************************************************************/
1116 1116
1117void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 1117void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
1118{ 1118{
1119
1120 if ( cmsg == "nextView()" ) {
1121 emit nextView();
1122 return;
1123 }
1124
1119 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1125 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1120 if (!res) 1126 if (!res)
1121 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); 1127 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data );
1122 1128
1123 if (!res) 1129 if (!res)
1124 res = mDisplayDetails->appMessage( cmsg, data ); 1130 res = mDisplayDetails->appMessage( cmsg, data );
1125 1131
1126// if (!res) 1132// if (!res)
1127// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1133// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1128} 1134}
1129 1135
1130 1136
1131 1137
1132bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1138bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1133{ 1139{
1134 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1140 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1135 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); 1141 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
1136} 1142}
1137 1143
1138bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1144bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1139{ 1145{
1140 QStringList list4, list5, list6; 1146 QStringList list4, list5, list6;
1141 1147
1142 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1148 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1143 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1149 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1144} 1150}
1145 1151
1146bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 1152bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
1147{ 1153{
1148 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1154 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1149 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); 1155 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email);
1150} 1156}
1151 1157
1152bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1158bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1153{ 1159{
1154 QStringList list4, list5, list6; 1160 QStringList list4, list5, list6;
1155 1161
1156 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1162 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1157 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1163 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1158} 1164}
1159 1165
1160bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) 1166bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid)
1161{ 1167{
1162 mDisplayDetails->setSourceChannel(""); 1168 mDisplayDetails->setSourceChannel("");
1163 return mDisplayDetails->sendMessageToTarget("", name, email, uid); 1169 return mDisplayDetails->sendMessageToTarget("", name, email, uid);
1164} 1170}
1165 1171
1166bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1172bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1167{ 1173{
1168 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); 1174 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel);
1169 return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); 1175 return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid);
1170} 1176}
1171 1177
1172bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) 1178bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6)
1173{ 1179{
1174 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); 1180 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel);
1175 return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1181 return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1176} 1182}
1177 1183
1178 1184
1179 1185
1180 1186
1181 1187