summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
Unidiff
Diffstat (limited to 'kabc/addresseeview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 05d604f..aae923c 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -331,380 +331,382 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
331 QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d"); 331 QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d");
332 if ( dt.isValid () ) { 332 if ( dt.isValid () ) {
333 tempX = KGlobal::locale()->formatDate(dt, true); 333 tempX = KGlobal::locale()->formatDate(dt, true);
334 notes += QString( 334 notes += QString(
335 "<tr><td align=\"right\"><b>%1</b></td>" 335 "<tr><td align=\"right\"><b>%1</b></td>"
336 "<td align=\"left\">%2</td></tr>" ) 336 "<td align=\"left\">%2</td></tr>" )
337 .arg( i18n( "Anniversary" ) ) 337 .arg( i18n( "Anniversary" ) )
338 .arg( tempX ); 338 .arg( tempX );
339 } 339 }
340 } 340 }
341 tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ); 341 tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" );
342 if ( !tempX.isEmpty() ) { 342 if ( !tempX.isEmpty() ) {
343 notes += QString( 343 notes += QString(
344 "<tr><td align=\"right\"><b>%1</b></td>" 344 "<tr><td align=\"right\"><b>%1</b></td>"
345 "<td align=\"left\">%2</td></tr>" ) 345 "<td align=\"left\">%2</td></tr>" )
346 .arg( i18n( "Spouse" ) ) 346 .arg( i18n( "Spouse" ) )
347 .arg( tempX ); 347 .arg( tempX );
348 } 348 }
349 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" ); 349 tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" );
350 if ( !tempX.isEmpty() ) { 350 if ( !tempX.isEmpty() ) {
351 notes += QString( 351 notes += QString(
352 "<tr><td align=\"right\"><b>%1</b></td>" 352 "<tr><td align=\"right\"><b>%1</b></td>"
353 "<td align=\"left\">%2</td></tr>" ) 353 "<td align=\"left\">%2</td></tr>" )
354 .arg( i18n( "Children" ) ) 354 .arg( i18n( "Children" ) )
355 .arg( tempX ); 355 .arg( tempX );
356 } 356 }
357 357
358 if ( !mAddressee.note().isEmpty() ) { 358 if ( !mAddressee.note().isEmpty() ) {
359 notes += QString( 359 notes += QString(
360 "<tr>" 360 "<tr>"
361 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label 361 "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label
362 "<td align=\"left\">%2</td>" // note 362 "<td align=\"left\">%2</td>" // note
363 "</tr>" ).arg( i18n( "Notes" ) ) 363 "</tr>" ).arg( i18n( "Notes" ) )
364 //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); 364 //US .arg( mAddressee.note().replace( '\n', "<br>" ) );
365 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); 365 .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) );
366 //qDebug("AddresseeView::setAddressee has to be verified."); 366 //qDebug("AddresseeView::setAddressee has to be verified.");
367 } 367 }
368 } else { 368 } else {
369 notes = QString( 369 notes = QString(
370 "<tr><td align=\"right\"><b>%1</b></td>" 370 "<tr><td align=\"right\"><b>%1</b></td>"
371 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) 371 "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" )
372 .arg( i18n("Details") ) 372 .arg( i18n("Details") )
373 .arg( i18n("Show!") ); 373 .arg( i18n("Show!") );
374 374
375 375
376 } 376 }
377 377
378 QString aRole = ""; 378 QString aRole = "";
379 QString aOrga = ""; 379 QString aOrga = "";
380 if ( true /*!mAddressee.role().isEmpty()*/ ) { 380 if ( true /*!mAddressee.role().isEmpty()*/ ) {
381 aRole = "<tr>" 381 aRole = "<tr>"
382 "<td align=\"left\">" + mAddressee.role() + "</td>" 382 "<td align=\"left\">" + mAddressee.role() + "</td>"
383 "</tr>"; 383 "</tr>";
384 } 384 }
385 if ( true /*!mAddressee.organization().isEmpty()*/ ) { 385 if ( true /*!mAddressee.organization().isEmpty()*/ ) {
386 aOrga = "<tr>" 386 aOrga = "<tr>"
387 "<td align=\"left\">" + mAddressee.organization() + "</td>" 387 "<td align=\"left\">" + mAddressee.organization() + "</td>"
388 "</tr>"; 388 "</tr>";
389 } 389 }
390 mText = ""; 390 mText = "";
391 QString picString = ""; 391 QString picString = "";
392 KABC::Picture picture = mAddressee.photo(); 392 KABC::Picture picture = mAddressee.photo();
393 if (picture.undefined() ) picture = mAddressee.logo(); 393 if (picture.undefined() ) picture = mAddressee.logo();
394 bool picAvailintern = false; 394 bool picAvailintern = false;
395 bool picAvailUrl = false; 395 bool picAvailUrl = false;
396 if (! picture.undefined() ) { 396 if (! picture.undefined() ) {
397 picAvailintern = (picture.isIntern() && !picture.data().isNull()); 397 picAvailintern = (picture.isIntern() && !picture.data().isNull());
398 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); 398 picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() );
399 } 399 }
400 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { 400 if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) {
401 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; 401 picString = "<img src=\"myimage\" width=\"50\" height=\"70\">";
402 if ( picAvailintern ) { 402 if ( picAvailintern ) {
403 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); 403 QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() );
404 int wid = picture.data().width(); 404 int wid = picture.data().width();
405 int hei = picture.data().height(); 405 int hei = picture.data().height();
406 if ( wid > 128 || hei > 128 ) { 406 if ( wid > 128 || hei > 128 ) {
407 if ( wid > hei ) { 407 if ( wid > hei ) {
408 hei = (hei*128)/wid; 408 hei = (hei*128)/wid;
409 wid = 128; 409 wid = 128;
410 } else { 410 } else {
411 wid = (wid*128)/hei; 411 wid = (wid*128)/hei;
412 hei = 128; 412 hei = 128;
413 } 413 }
414 } 414 }
415 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); 415 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
416 } else { 416 } else {
417 if ( picAvailUrl ) { 417 if ( picAvailUrl ) {
418 QPixmap picPix( picture.url() ); 418 QPixmap picPix( picture.url() );
419 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); 419 QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix );
420 int wid = picPix.width(); 420 int wid = picPix.width();
421 int hei = picPix.height(); 421 int hei = picPix.height();
422 if ( wid > 128 || hei > 128 ) { 422 if ( wid > 128 || hei > 128 ) {
423 if ( wid > hei ) { 423 if ( wid > hei ) {
424 hei = (hei*128)/wid; 424 hei = (hei*128)/wid;
425 wid = 128; 425 wid = 128;
426 } else { 426 } else {
427 wid = (wid*128)/hei; 427 wid = (wid*128)/hei;
428 hei = 128; 428 hei = 128;
429 } 429 }
430 } 430 }
431 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); 431 picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei);
432 } else { 432 } else {
433 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { 433 if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) {
434 static bool setDefaultImageChildren = false; 434 static bool setDefaultImageChildren = false;
435 if ( !setDefaultImageChildren ) { 435 if ( !setDefaultImageChildren ) {
436 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); 436 QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) );
437 setDefaultImageChildren = true; 437 setDefaultImageChildren = true;
438 } 438 }
439 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; 439 picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">";
440 440
441 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { 441 } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) {
442 static bool setDefaultImagepouses = false; 442 static bool setDefaultImagepouses = false;
443 if ( !setDefaultImagepouses ) { 443 if ( !setDefaultImagepouses ) {
444 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); 444 QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) );
445 setDefaultImagepouses = true; 445 setDefaultImagepouses = true;
446 } 446 }
447 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; 447 picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">";
448 } else { 448 } else {
449 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); 449 QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" );
450 if ( gen == "male" ) { 450 if ( gen == "male" ) {
451 static bool setDefaultImageMale = false; 451 static bool setDefaultImageMale = false;
452 if ( !setDefaultImageMale ) { 452 if ( !setDefaultImageMale ) {
453 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); 453 QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) );
454 setDefaultImageMale = true; 454 setDefaultImageMale = true;
455 } 455 }
456 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; 456 picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">";
457 457
458 } else if ( gen == "female" ) { 458 } else if ( gen == "female" ) {
459 static bool setDefaultImageFemale = false; 459 static bool setDefaultImageFemale = false;
460 if ( !setDefaultImageFemale ) { 460 if ( !setDefaultImageFemale ) {
461 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); 461 QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) );
462 setDefaultImageFemale = true; 462 setDefaultImageFemale = true;
463 } 463 }
464 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; 464 picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">";
465 465
466 } else { 466 } else {
467 static bool setDefaultImage = false; 467 static bool setDefaultImage = false;
468 if ( !setDefaultImage ) { 468 if ( !setDefaultImage ) {
469 //qDebug("Setting default pixmap "); 469 //qDebug("Setting default pixmap ");
470 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); 470 QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) );
471 setDefaultImage = true; 471 setDefaultImage = true;
472 } 472 }
473 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; 473 picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">";
474 } 474 }
475 } 475 }
476 } 476 }
477 } 477 }
478 mText = QString::fromLatin1( 478 mText = QString::fromLatin1(
479 "<html>" 479 "<html>"
480 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color 480 "<body text=\"%1\" bgcolor=\"%2\">" // text and background color
481 "<table>" 481 "<table>"
482 "<tr>" 482 "<tr>"
483 "<td rowspan=\"3\" align=\"right\" valign=\"top\">" 483 "<td rowspan=\"3\" align=\"right\" valign=\"top\">"
484 "%3" 484 "%3"
485 "</td>" 485 "</td>"
486 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name 486 "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name
487 "</tr>" 487 "</tr>"
488 "%5" // role 488 "%5" // role
489 "%6" // organization 489 "%6" // organization
490 "<td colspan=\"2\">&nbsp;</td>" 490 "<td colspan=\"2\">&nbsp;</td>"
491 "%7" // dynamic part 491 "%7" // dynamic part
492 "%8" // notes 492 "%8" // notes
493 "</table>" 493 "</table>"
494 "</body>" 494 "</body>"
495 "</html>") 495 "</html>")
496//US 496//US
497 .arg( /*KGlobalSettings::textColor().name()*/ "black" ) 497 .arg( /*KGlobalSettings::textColor().name()*/ "black" )
498//US 498//US
499 .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) 499 .arg( /*KGlobalSettings::baseColor().name()*/ "white" )
500 .arg( picString ) 500 .arg( picString )
501 .arg( name ) 501 .arg( name )
502 .arg( aRole ) 502 .arg( aRole )
503 .arg( aOrga ) 503 .arg( aOrga )
504 .arg( dynamicPart ) 504 .arg( dynamicPart )
505 .arg( notes ); 505 .arg( notes );
506 506
507 } else { // no picture! 507 } else { // no picture!
508 508
509mText = "<table width=\"100%\">\n"; 509mText = "<table width=\"100%\">\n";
510 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 510 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
511#ifdef DESKTOP_VERSION 511#ifdef DESKTOP_VERSION
512 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; 512 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>";
513 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; 513 mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>";
514#else 514#else
515 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; 515 mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>";
516 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; 516 mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>";
517#endif 517#endif
518 518
519 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 519 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
520 520
521 mText += "<table><td colspan=\"2\">&nbsp;</td>"; 521 mText += "<table><td colspan=\"2\">&nbsp;</td>";
522 /* 522 /*
523 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" 523 mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>"
524 "<td align=\"left\"><b>%2</b></td></tr>" ) 524 "<td align=\"left\"><b>%2</b></td></tr>" )
525 .arg( i18n(" ") ) 525 .arg( i18n(" ") )
526 .arg( name ); 526 .arg( name );
527 */ 527 */
528 if ( ! mAddressee.role().isEmpty() ) 528 if ( ! mAddressee.role().isEmpty() )
529 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 529 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
530 "<td align=\"left\">%2</td></tr>" ) 530 "<td align=\"left\">%2</td></tr>" )
531 .arg( i18n(" ") ) 531 .arg( i18n(" ") )
532 .arg( mAddressee.role()); 532 .arg( mAddressee.role());
533 if ( ! mAddressee.organization().isEmpty() ) 533 if ( ! mAddressee.organization().isEmpty() )
534 mText += QString("<tr><td align=\"right\"><b>%1</b></td>" 534 mText += QString("<tr><td align=\"right\"><b>%1</b></td>"
535 "<td align=\"left\">%2</td></tr>" ) 535 "<td align=\"left\">%2</td></tr>" )
536 .arg( i18n(" ") ) 536 .arg( i18n(" ") )
537 .arg( mAddressee.organization()); 537 .arg( mAddressee.organization());
538 mText += dynamicPart; 538 mText += dynamicPart;
539 mText += notes; 539 mText += notes;
540 mText += "</table>"; 540 mText += "</table>";
541 541
542 } 542 }
543 543
544 // at last display it... 544 // at last display it...
545 setText( mText ); 545 setText( mText );
546 546
547} 547}
548 548
549QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred ) 549QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones ,bool preferred )
550{ 550{
551 ExternalAppHandler* eah = ExternalAppHandler::instance(); 551 ExternalAppHandler* eah = ExternalAppHandler::instance();
552 bool kphoneAvail = eah->isPhoneAppAvailable(); 552 bool kphoneAvail = eah->isPhoneAppAvailable();
553 bool kfaxAvail = eah->isFaxAppAvailable(); 553 bool kfaxAvail = eah->isFaxAppAvailable();
554 bool ksmsAvail = eah->isSMSAppAvailable(); 554 bool ksmsAvail = eah->isSMSAppAvailable();
555 bool kpagerAvail = eah->isPagerAppAvailable(); 555 bool kpagerAvail = eah->isPagerAppAvailable();
556 bool ksipAvail = eah->isSIPAppAvailable(); 556 bool ksipAvail = eah->isSIPAppAvailable();
557 QString dynamicPart; 557 QString dynamicPart;
558 KABC::PhoneNumber::List::ConstIterator phoneIt; 558 KABC::PhoneNumber::List::ConstIterator phoneIt;
559 QString extension; 559 QString extension;
560 int phonetype; 560 int phonetype;
561 QString sms; 561 QString sms;
562 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { 562 for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) {
563 phonetype = (*phoneIt).type(); 563 phonetype = (*phoneIt).type();
564 if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) 564 if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred )
565 continue; 565 continue;
566 if (ksmsAvail && 566 if (ksmsAvail &&
567 ( 567 (
568 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || 568 ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) ||
569 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) 569 ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell)
570 ) 570 )
571 ) 571 )
572 { 572 {
573 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) 573 sms = QString("<a href=\"smsto:%1 \">(sms)</a>" )
574 .arg( (*phoneIt).number() ); 574 .arg( (*phoneIt).number() );
575 575
576 } 576 }
577 else 577 else
578 sms = ""; 578 sms = "";
579 579
580 extension = QString::null; 580 extension = QString::null;
581 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { 581 if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) {
582 if (kfaxAvail) extension = "faxto:"; 582 if (kfaxAvail) extension = "faxto:";
583 } 583 }
584 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { 584 else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) {
585 if (kpagerAvail) extension = "pagerto:"; 585 if (kpagerAvail) extension = "pagerto:";
586 } 586 }
587#if 0
587 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { 588 else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) {
588 if (ksipAvail) extension = "sipto:"; 589 if (ksipAvail) extension = "sipto:";
589 } 590 }
591#endif
590 else if (kphoneAvail) { 592 else if (kphoneAvail) {
591 extension = "phoneto:"; 593 extension = "phoneto:";
592 } 594 }
593 else 595 else
594 extension = QString::null; 596 extension = QString::null;
595 597
596 if ( !extension.isEmpty() ) { 598 if ( !extension.isEmpty() ) {
597 dynamicPart += QString( 599 dynamicPart += QString(
598 "<tr><td align=\"right\"><b>%1</b></td>" 600 "<tr><td align=\"right\"><b>%1</b></td>"
599 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) 601 "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" )
600 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 602 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
601 .arg( extension ) 603 .arg( extension )
602 .arg( (*phoneIt).number() ) 604 .arg( (*phoneIt).number() )
603 .arg( (*phoneIt).number() ) 605 .arg( (*phoneIt).number() )
604 .arg( sms ); 606 .arg( sms );
605 607
606 } else { 608 } else {
607 dynamicPart += QString( 609 dynamicPart += QString(
608 "<tr><td align=\"right\"><b>%1</b></td>" 610 "<tr><td align=\"right\"><b>%1</b></td>"
609 "<td align=\"left\">%2 %3</td></tr>" ) 611 "<td align=\"left\">%2 %3</td></tr>" )
610 .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) 612 .arg( KABC::PhoneNumber::typeLabel( phonetype ) )
611 .arg( (*phoneIt).number() ) 613 .arg( (*phoneIt).number() )
612 .arg( sms ); 614 .arg( sms );
613 } 615 }
614 } 616 }
615 return dynamicPart; 617 return dynamicPart;
616} 618}
617/* 619/*
618KABC::Addressee AddresseeView::addressee() const 620KABC::Addressee AddresseeView::addressee() const
619{ 621{
620 return mAddressee; 622 return mAddressee;
621} 623}
622*/ 624*/
623void AddresseeView::addTag(const QString & tag,const QString & text) 625void AddresseeView::addTag(const QString & tag,const QString & text)
624{ 626{
625 if ( text.isEmpty() ) 627 if ( text.isEmpty() )
626 return; 628 return;
627 int number=text.contains("\n"); 629 int number=text.contains("\n");
628 QString str = "<" + tag + ">"; 630 QString str = "<" + tag + ">";
629 QString tmpText=text; 631 QString tmpText=text;
630 QString tmpStr=str; 632 QString tmpStr=str;
631 if(number !=-1) 633 if(number !=-1)
632 { 634 {
633 if (number > 0) { 635 if (number > 0) {
634 int pos=0; 636 int pos=0;
635 QString tmp; 637 QString tmp;
636 for(int i=0;i<=number;i++) { 638 for(int i=0;i<=number;i++) {
637 pos=tmpText.find("\n"); 639 pos=tmpText.find("\n");
638 tmp=tmpText.left(pos); 640 tmp=tmpText.left(pos);
639 tmpText=tmpText.right(tmpText.length()-pos-1); 641 tmpText=tmpText.right(tmpText.length()-pos-1);
640 tmpStr+=tmp+"<br>"; 642 tmpStr+=tmp+"<br>";
641 } 643 }
642 } 644 }
643 else tmpStr += tmpText; 645 else tmpStr += tmpText;
644 tmpStr+="</" + tag + ">"; 646 tmpStr+="</" + tag + ">";
645 mText.append(tmpStr); 647 mText.append(tmpStr);
646 } 648 }
647 else 649 else
648 { 650 {
649 str += text + "</" + tag + ">"; 651 str += text + "</" + tag + ">";
650 mText.append(str); 652 mText.append(str);
651 } 653 }
652} 654}
653 655
654AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 656AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
655 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) 657 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
656{ 658{
657 findButton( Close )->setText( i18n("Cancel Sync")); 659 findButton( Close )->setText( i18n("Cancel Sync"));
658 findButton( Ok )->setText( i18n("Remote")); 660 findButton( Ok )->setText( i18n("Remote"));
659 findButton( User1 )->setText( i18n("Local")); 661 findButton( User1 )->setText( i18n("Local"));
660 QWidget* topframe = new QWidget( this ); 662 QWidget* topframe = new QWidget( this );
661 setMainWidget( topframe ); 663 setMainWidget( topframe );
662 QBoxLayout* bl; 664 QBoxLayout* bl;
663 if ( QApplication::desktop()->width() < 640 ) { 665 if ( QApplication::desktop()->width() < 640 ) {
664 bl = new QVBoxLayout( topframe ); 666 bl = new QVBoxLayout( topframe );
665 } else { 667 } else {
666 bl = new QHBoxLayout( topframe ); 668 bl = new QHBoxLayout( topframe );
667 } 669 }
668 QVBox* subframe = new QVBox( topframe ); 670 QVBox* subframe = new QVBox( topframe );
669 bl->addWidget(subframe ); 671 bl->addWidget(subframe );
670 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); 672 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
671 if ( takeloc ) 673 if ( takeloc )
672 lab->setBackgroundColor(Qt::green.light() ); 674 lab->setBackgroundColor(Qt::green.light() );
673 AddresseeView * av = new AddresseeView( subframe ); 675 AddresseeView * av = new AddresseeView( subframe );
674 av->setAddressee( loc ); 676 av->setAddressee( loc );
675 subframe = new QVBox( topframe ); 677 subframe = new QVBox( topframe );
676 bl->addWidget(subframe ); 678 bl->addWidget(subframe );
677 lab = new QLabel( i18n("Remote Addressee"), subframe ); 679 lab = new QLabel( i18n("Remote Addressee"), subframe );
678 if ( !takeloc ) 680 if ( !takeloc )
679 lab->setBackgroundColor(Qt::green.light() ); 681 lab->setBackgroundColor(Qt::green.light() );
680 av = new AddresseeView( subframe ); 682 av = new AddresseeView( subframe );
681 av->setAddressee( rem ); 683 av->setAddressee( rem );
682 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); 684 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
683 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); 685 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
684#ifndef DESKTOP_VERSION 686#ifndef DESKTOP_VERSION
685 showMaximized(); 687 showMaximized();
686#else 688#else
687 resize ( 640, 400 ); 689 resize ( 640, 400 );
688#endif 690#endif
689} 691}
690 692
691int AddresseeChooser::executeD( bool local ) 693int AddresseeChooser::executeD( bool local )
692{ 694{
693 mSyncResult = 3; 695 mSyncResult = 3;
694 if ( local ) 696 if ( local )
695 findButton( User1 )->setFocus(); 697 findButton( User1 )->setFocus();
696 else 698 else
697 findButton( Ok )->setFocus(); 699 findButton( Ok )->setFocus();
698 exec(); 700 exec();
699 return mSyncResult; 701 return mSyncResult;
700} 702}
701void AddresseeChooser::slot_remote() 703void AddresseeChooser::slot_remote()
702{ 704{
703 mSyncResult = 2; 705 mSyncResult = 2;
704 accept(); 706 accept();
705} 707}
706void AddresseeChooser::slot_local() 708void AddresseeChooser::slot_local()
707{ 709{
708 mSyncResult = 1; 710 mSyncResult = 1;
709 accept(); 711 accept();
710} 712}