summaryrefslogtreecommitdiffabout
path: root/kabc/addresseeview.cpp
authorzautrix <zautrix>2005-10-28 11:31:59 (UTC)
committer zautrix <zautrix>2005-10-28 11:31:59 (UTC)
commitb27cb619bb9005ad4345d38bbee3b1c3d0eda1b2 (patch) (unidiff)
treea7ac6002208ddedcd9dc13cd0e91294519883007 /kabc/addresseeview.cpp
parent5ceebb8563f134c789e9082d1bc49723beb28c8c (diff)
downloadkdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.zip
kdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.tar.gz
kdepimpi-b27cb619bb9005ad4345d38bbee3b1c3d0eda1b2.tar.bz2
commit
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
@@ -491,195 +491,197 @@ void AddresseeView::setAddressee( const KABC::Addressee& mAddressee )
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();