author | zautrix <zautrix> | 2004-10-13 13:18:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-13 13:18:51 (UTC) |
commit | d41893fb0a49fbb080326a4c1fd98e1a032a182a (patch) (unidiff) | |
tree | 9b95603ff93801accaa94de4b73d88ea9c5c9386 /kabc | |
parent | efdd0735bda81dcd82dfb6d6dc0d0c143f249336 (diff) | |
download | kdepimpi-d41893fb0a49fbb080326a4c1fd98e1a032a182a.zip kdepimpi-d41893fb0a49fbb080326a4c1fd98e1a032a182a.tar.gz kdepimpi-d41893fb0a49fbb080326a4c1fd98e1a032a182a.tar.bz2 |
merge contact fixes
-rw-r--r-- | kabc/addressbook.cpp | 8 | ||||
-rw-r--r-- | kabc/addressbook.h | 4 | ||||
-rw-r--r-- | kabc/addressee.cpp | 82 | ||||
-rw-r--r-- | kabc/addressee.h | 2 |
4 files changed, 65 insertions, 31 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index 19c26eb..8882259 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -482,718 +482,718 @@ void AddressBook::importFromFile( QString fileName, bool replaceLabel, bool rem | |||
482 | file.open( IO_ReadOnly ); | 482 | file.open( IO_ReadOnly ); |
483 | QByteArray rawData = file.readAll(); | 483 | QByteArray rawData = file.readAll(); |
484 | file.close(); | 484 | file.close(); |
485 | QString data; | 485 | QString data; |
486 | if ( replaceLabel ) { | 486 | if ( replaceLabel ) { |
487 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); | 487 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); |
488 | data.replace ( QRegExp("LABEL") , "ADR" ); | 488 | data.replace ( QRegExp("LABEL") , "ADR" ); |
489 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); | 489 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); |
490 | } else | 490 | } else |
491 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 491 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
492 | KABC::VCardTool tool; | 492 | KABC::VCardTool tool; |
493 | list = tool.parseVCards( data ); | 493 | list = tool.parseVCards( data ); |
494 | KABC::Addressee::List::Iterator it; | 494 | KABC::Addressee::List::Iterator it; |
495 | for ( it = list.begin(); it != list.end(); ++it ) { | 495 | for ( it = list.begin(); it != list.end(); ++it ) { |
496 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 496 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
497 | if ( !id.isEmpty() ) | 497 | if ( !id.isEmpty() ) |
498 | (*it).setIDStr(id ); | 498 | (*it).setIDStr(id ); |
499 | (*it).setResource( 0 ); | 499 | (*it).setResource( 0 ); |
500 | if ( replaceLabel ) | 500 | if ( replaceLabel ) |
501 | (*it).removeVoice(); | 501 | (*it).removeVoice(); |
502 | if ( removeOld ) | 502 | if ( removeOld ) |
503 | (*it).setTagged( true ); | 503 | (*it).setTagged( true ); |
504 | insertAddressee( (*it), false, true ); | 504 | insertAddressee( (*it), false, true ); |
505 | } | 505 | } |
506 | if ( removeOld ) | 506 | if ( removeOld ) |
507 | removeUntagged(); | 507 | removeUntagged(); |
508 | } | 508 | } |
509 | void AddressBook::setUntagged() | 509 | void AddressBook::setUntagged() |
510 | { | 510 | { |
511 | Iterator ait; | 511 | Iterator ait; |
512 | for ( ait = begin(); ait != end(); ++ait ) { | 512 | for ( ait = begin(); ait != end(); ++ait ) { |
513 | (*ait).setTagged( false ); | 513 | (*ait).setTagged( false ); |
514 | } | 514 | } |
515 | } | 515 | } |
516 | void AddressBook::removeUntagged() | 516 | void AddressBook::removeUntagged() |
517 | { | 517 | { |
518 | Iterator ait; | 518 | Iterator ait; |
519 | bool todelete = false; | 519 | bool todelete = false; |
520 | Iterator todel; | 520 | Iterator todel; |
521 | for ( ait = begin(); ait != end(); ++ait ) { | 521 | for ( ait = begin(); ait != end(); ++ait ) { |
522 | if ( todelete ) | 522 | if ( todelete ) |
523 | removeAddressee( todel ); | 523 | removeAddressee( todel ); |
524 | if (!(*ait).tagged()) { | 524 | if (!(*ait).tagged()) { |
525 | todelete = true; | 525 | todelete = true; |
526 | todel = ait; | 526 | todel = ait; |
527 | } else | 527 | } else |
528 | todelete = false; | 528 | todelete = false; |
529 | } | 529 | } |
530 | if ( todelete ) | 530 | if ( todelete ) |
531 | removeAddressee( todel ); | 531 | removeAddressee( todel ); |
532 | deleteRemovedAddressees(); | 532 | deleteRemovedAddressees(); |
533 | } | 533 | } |
534 | void AddressBook::smplifyAddressees() | 534 | void AddressBook::smplifyAddressees() |
535 | { | 535 | { |
536 | Iterator ait; | 536 | Iterator ait; |
537 | for ( ait = begin(); ait != end(); ++ait ) { | 537 | for ( ait = begin(); ait != end(); ++ait ) { |
538 | (*ait).simplifyEmails(); | 538 | (*ait).simplifyEmails(); |
539 | (*ait).simplifyPhoneNumbers(); | 539 | (*ait).simplifyPhoneNumbers(); |
540 | (*ait).simplifyPhoneNumberTypes(); | 540 | (*ait).simplifyPhoneNumberTypes(); |
541 | (*ait).simplifyAddresses(); | 541 | (*ait).simplifyAddresses(); |
542 | } | 542 | } |
543 | } | 543 | } |
544 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) | 544 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) |
545 | { | 545 | { |
546 | Iterator ait; | 546 | Iterator ait; |
547 | for ( ait = begin(); ait != end(); ++ait ) { | 547 | for ( ait = begin(); ait != end(); ++ait ) { |
548 | QString id = (*ait).IDStr(); | 548 | QString id = (*ait).IDStr(); |
549 | (*ait).setIDStr( ":"); | 549 | (*ait).setIDStr( ":"); |
550 | (*ait).setExternalUID( id ); | 550 | (*ait).setExternalUID( id ); |
551 | (*ait).setOriginalExternalUID( id ); | 551 | (*ait).setOriginalExternalUID( id ); |
552 | if ( isPreSync ) | 552 | if ( isPreSync ) |
553 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 553 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
554 | else { | 554 | else { |
555 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 555 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
556 | (*ait).setID( currentSyncDevice,id ); | 556 | (*ait).setID( currentSyncDevice,id ); |
557 | 557 | ||
558 | } | 558 | } |
559 | } | 559 | } |
560 | } | 560 | } |
561 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) | 561 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) |
562 | { | 562 | { |
563 | 563 | ||
564 | setUntagged(); | 564 | setUntagged(); |
565 | KABC::Addressee::List list; | 565 | KABC::Addressee::List list; |
566 | QFile file( fileName ); | 566 | QFile file( fileName ); |
567 | file.open( IO_ReadOnly ); | 567 | file.open( IO_ReadOnly ); |
568 | QByteArray rawData = file.readAll(); | 568 | QByteArray rawData = file.readAll(); |
569 | file.close(); | 569 | file.close(); |
570 | QString data; | 570 | QString data; |
571 | 571 | ||
572 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 572 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
573 | KABC::VCardTool tool; | 573 | KABC::VCardTool tool; |
574 | list = tool.parseVCards( data ); | 574 | list = tool.parseVCards( data ); |
575 | KABC::Addressee::List::Iterator it; | 575 | KABC::Addressee::List::Iterator it; |
576 | for ( it = list.begin(); it != list.end(); ++it ) { | 576 | for ( it = list.begin(); it != list.end(); ++it ) { |
577 | Iterator ait; | 577 | Iterator ait; |
578 | for ( ait = begin(); ait != end(); ++ait ) { | 578 | for ( ait = begin(); ait != end(); ++ait ) { |
579 | if ( !(*ait).tagged() ) { | 579 | if ( !(*ait).tagged() ) { |
580 | if ( (*ait).containsAdr(*it)) { | 580 | if ( (*ait).containsAdr(*it)) { |
581 | (*ait).setTagged(true); | 581 | (*ait).setTagged(true); |
582 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 582 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
583 | (*it).setIDStr( ":"); | 583 | (*it).setIDStr( ":"); |
584 | (*it).setID( currentSyncDevice,id ); | 584 | (*it).setID( currentSyncDevice,id ); |
585 | (*it).setExternalUID( id ); | 585 | (*it).setExternalUID( id ); |
586 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 586 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
587 | (*it).setUid( ( (*ait).uid() )); | 587 | (*it).setUid( ( (*ait).uid() )); |
588 | break; | 588 | break; |
589 | } | 589 | } |
590 | } | 590 | } |
591 | 591 | ||
592 | } | 592 | } |
593 | if ( ait == end() ) | 593 | if ( ait == end() ) |
594 | qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1()); | 594 | qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1()); |
595 | } | 595 | } |
596 | clear(); | 596 | clear(); |
597 | for ( it = list.begin(); it != list.end(); ++it ) { | 597 | for ( it = list.begin(); it != list.end(); ++it ) { |
598 | insertAddressee( (*it) ); | 598 | insertAddressee( (*it) ); |
599 | } | 599 | } |
600 | } | 600 | } |
601 | 601 | ||
602 | bool AddressBook::saveABphone( QString fileName ) | 602 | bool AddressBook::saveABphone( QString fileName ) |
603 | { | 603 | { |
604 | //smplifyAddressees(); | 604 | //smplifyAddressees(); |
605 | qDebug("saveABphone:: saving AB... "); | 605 | qDebug("saveABphone:: saving AB... "); |
606 | if ( ! export2PhoneFormat( QStringList() ,fileName ) ) | 606 | if ( ! export2PhoneFormat( QStringList() ,fileName ) ) |
607 | return false; | 607 | return false; |
608 | qDebug("saveABphone:: writing to phone... "); | 608 | qDebug("saveABphone:: writing to phone... "); |
609 | if ( !PhoneAccess::writeToPhone( fileName) ) { | 609 | if ( !PhoneAccess::writeToPhone( fileName) ) { |
610 | return false; | 610 | return false; |
611 | } | 611 | } |
612 | qDebug("saveABphone:: re-reading from phone... "); | 612 | qDebug("saveABphone:: re-reading from phone... "); |
613 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 613 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
614 | return false; | 614 | return false; |
615 | } | 615 | } |
616 | return true; | 616 | return true; |
617 | } | 617 | } |
618 | bool AddressBook::saveAB() | 618 | bool AddressBook::saveAB() |
619 | { | 619 | { |
620 | bool ok = true; | 620 | bool ok = true; |
621 | 621 | ||
622 | deleteRemovedAddressees(); | 622 | deleteRemovedAddressees(); |
623 | Iterator ait; | 623 | Iterator ait; |
624 | for ( ait = begin(); ait != end(); ++ait ) { | 624 | for ( ait = begin(); ait != end(); ++ait ) { |
625 | if ( !(*ait).IDStr().isEmpty() ) { | 625 | if ( !(*ait).IDStr().isEmpty() ) { |
626 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); | 626 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); |
627 | } | 627 | } |
628 | } | 628 | } |
629 | KRES::Manager<Resource>::ActiveIterator it; | 629 | KRES::Manager<Resource>::ActiveIterator it; |
630 | KRES::Manager<Resource> *manager = d->mManager; | 630 | KRES::Manager<Resource> *manager = d->mManager; |
631 | qDebug("SaveAB::saving..." ); | 631 | qDebug("SaveAB::saving..." ); |
632 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 632 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
633 | qDebug("SaveAB::checking resource..." ); | 633 | qDebug("SaveAB::checking resource..." ); |
634 | if ( (*it)->readOnly() ) | 634 | if ( (*it)->readOnly() ) |
635 | qDebug("resource is readonly." ); | 635 | qDebug("resource is readonly." ); |
636 | if ( (*it)->isOpen() ) | 636 | if ( (*it)->isOpen() ) |
637 | qDebug("resource is open" ); | 637 | qDebug("resource is open" ); |
638 | 638 | ||
639 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 639 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
640 | Ticket *ticket = requestSaveTicket( *it ); | 640 | Ticket *ticket = requestSaveTicket( *it ); |
641 | qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 641 | qDebug("StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
642 | if ( !ticket ) { | 642 | if ( !ticket ) { |
643 | qDebug( i18n( "Unable to save to resource '%1'. It is locked." ) | 643 | qDebug( i18n( "Unable to save to resource '%1'. It is locked." ) |
644 | .arg( (*it)->resourceName() ) ); | 644 | .arg( (*it)->resourceName() ) ); |
645 | return false; | 645 | return false; |
646 | } | 646 | } |
647 | 647 | ||
648 | //if ( !save( ticket ) ) | 648 | //if ( !save( ticket ) ) |
649 | if ( ticket->resource() ) { | 649 | if ( ticket->resource() ) { |
650 | QString name = ticket->resource()->resourceName(); | 650 | QString name = ticket->resource()->resourceName(); |
651 | if ( ! ticket->resource()->save( ticket ) ) | 651 | if ( ! ticket->resource()->save( ticket ) ) |
652 | ok = false; | 652 | ok = false; |
653 | else | 653 | else |
654 | qDebug("StdAddressBook::resource saved '%s'", name.latin1() ); | 654 | qDebug("StdAddressBook::resource saved '%s'", name.latin1() ); |
655 | 655 | ||
656 | } else | 656 | } else |
657 | ok = false; | 657 | ok = false; |
658 | 658 | ||
659 | } | 659 | } |
660 | } | 660 | } |
661 | return ok; | 661 | return ok; |
662 | } | 662 | } |
663 | 663 | ||
664 | AddressBook::Iterator AddressBook::begin() | 664 | AddressBook::Iterator AddressBook::begin() |
665 | { | 665 | { |
666 | Iterator it = Iterator(); | 666 | Iterator it = Iterator(); |
667 | it.d->mIt = d->mAddressees.begin(); | 667 | it.d->mIt = d->mAddressees.begin(); |
668 | return it; | 668 | return it; |
669 | } | 669 | } |
670 | 670 | ||
671 | AddressBook::ConstIterator AddressBook::begin() const | 671 | AddressBook::ConstIterator AddressBook::begin() const |
672 | { | 672 | { |
673 | ConstIterator it = ConstIterator(); | 673 | ConstIterator it = ConstIterator(); |
674 | it.d->mIt = d->mAddressees.begin(); | 674 | it.d->mIt = d->mAddressees.begin(); |
675 | return it; | 675 | return it; |
676 | } | 676 | } |
677 | 677 | ||
678 | AddressBook::Iterator AddressBook::end() | 678 | AddressBook::Iterator AddressBook::end() |
679 | { | 679 | { |
680 | Iterator it = Iterator(); | 680 | Iterator it = Iterator(); |
681 | it.d->mIt = d->mAddressees.end(); | 681 | it.d->mIt = d->mAddressees.end(); |
682 | return it; | 682 | return it; |
683 | } | 683 | } |
684 | 684 | ||
685 | AddressBook::ConstIterator AddressBook::end() const | 685 | AddressBook::ConstIterator AddressBook::end() const |
686 | { | 686 | { |
687 | ConstIterator it = ConstIterator(); | 687 | ConstIterator it = ConstIterator(); |
688 | it.d->mIt = d->mAddressees.end(); | 688 | it.d->mIt = d->mAddressees.end(); |
689 | return it; | 689 | return it; |
690 | } | 690 | } |
691 | 691 | ||
692 | void AddressBook::clear() | 692 | void AddressBook::clear() |
693 | { | 693 | { |
694 | d->mAddressees.clear(); | 694 | d->mAddressees.clear(); |
695 | } | 695 | } |
696 | 696 | ||
697 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 697 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
698 | { | 698 | { |
699 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 699 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
700 | 700 | ||
701 | if ( !resource ) | 701 | if ( !resource ) |
702 | { | 702 | { |
703 | qDebug("AddressBook::requestSaveTicket no resource" ); | 703 | qDebug("AddressBook::requestSaveTicket no resource" ); |
704 | resource = standardResource(); | 704 | resource = standardResource(); |
705 | } | 705 | } |
706 | 706 | ||
707 | KRES::Manager<Resource>::ActiveIterator it; | 707 | KRES::Manager<Resource>::ActiveIterator it; |
708 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 708 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
709 | if ( (*it) == resource ) { | 709 | if ( (*it) == resource ) { |
710 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 710 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
711 | return 0; | 711 | return 0; |
712 | else | 712 | else |
713 | return (*it)->requestSaveTicket(); | 713 | return (*it)->requestSaveTicket(); |
714 | } | 714 | } |
715 | } | 715 | } |
716 | 716 | ||
717 | return 0; | 717 | return 0; |
718 | } | 718 | } |
719 | //void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 719 | //void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
720 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) | 720 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) |
721 | { | 721 | { |
722 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { | 722 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { |
723 | //qDebug("block insert "); | 723 | //qDebug("block insert "); |
724 | return; | 724 | return; |
725 | } | 725 | } |
726 | //qDebug("inserting.... %s ",a.uid().latin1() ); | 726 | //qDebug("inserting.... %s ",a.uid().latin1() ); |
727 | bool found = false; | 727 | bool found = false; |
728 | Addressee::List::Iterator it; | 728 | Addressee::List::Iterator it; |
729 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 729 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
730 | if ( a.uid() == (*it).uid() ) { | 730 | if ( a.uid() == (*it).uid() ) { |
731 | 731 | ||
732 | bool changed = false; | 732 | bool changed = false; |
733 | Addressee addr = a; | 733 | Addressee addr = a; |
734 | if ( addr != (*it) ) | 734 | if ( addr != (*it) ) |
735 | changed = true; | 735 | changed = true; |
736 | 736 | ||
737 | if ( takeResource ) { | 737 | if ( takeResource ) { |
738 | Resource * res = (*it).resource(); | 738 | Resource * res = (*it).resource(); |
739 | (*it) = a; | 739 | (*it) = a; |
740 | (*it).setResource( res ); | 740 | (*it).setResource( res ); |
741 | } else { | 741 | } else { |
742 | (*it) = a; | 742 | (*it) = a; |
743 | if ( (*it).resource() == 0 ) | 743 | if ( (*it).resource() == 0 ) |
744 | (*it).setResource( standardResource() ); | 744 | (*it).setResource( standardResource() ); |
745 | } | 745 | } |
746 | if ( changed ) { | 746 | if ( changed ) { |
747 | if ( setRev ) { | 747 | if ( setRev ) { |
748 | 748 | ||
749 | // get rid of micro seconds | 749 | // get rid of micro seconds |
750 | QDateTime dt = QDateTime::currentDateTime(); | 750 | QDateTime dt = QDateTime::currentDateTime(); |
751 | QTime t = dt.time(); | 751 | QTime t = dt.time(); |
752 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); | 752 | dt.setTime( QTime (t.hour (), t.minute (), t.second () ) ); |
753 | (*it).setRevision( dt ); | 753 | (*it).setRevision( dt ); |
754 | } | 754 | } |
755 | (*it).setChanged( true ); | 755 | (*it).setChanged( true ); |
756 | } | 756 | } |
757 | 757 | ||
758 | found = true; | 758 | found = true; |
759 | } else { | 759 | } else { |
760 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 760 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
761 | QString name = (*it).uid().mid( 19 ); | 761 | QString name = (*it).uid().mid( 19 ); |
762 | Addressee b = a; | 762 | Addressee b = a; |
763 | QString id = b.getID( name ); | 763 | QString id = b.getID( name ); |
764 | if ( ! id.isEmpty() ) { | 764 | if ( ! id.isEmpty() ) { |
765 | QString des = (*it).note(); | 765 | QString des = (*it).note(); |
766 | int startN; | 766 | int startN; |
767 | if( (startN = des.find( id ) ) >= 0 ) { | 767 | if( (startN = des.find( id ) ) >= 0 ) { |
768 | int endN = des.find( ",", startN+1 ); | 768 | int endN = des.find( ",", startN+1 ); |
769 | des = des.left( startN ) + des.mid( endN+1 ); | 769 | des = des.left( startN ) + des.mid( endN+1 ); |
770 | (*it).setNote( des ); | 770 | (*it).setNote( des ); |
771 | } | 771 | } |
772 | } | 772 | } |
773 | } | 773 | } |
774 | } | 774 | } |
775 | } | 775 | } |
776 | if ( found ) | 776 | if ( found ) |
777 | return; | 777 | return; |
778 | d->mAddressees.append( a ); | 778 | d->mAddressees.append( a ); |
779 | Addressee& addr = d->mAddressees.last(); | 779 | Addressee& addr = d->mAddressees.last(); |
780 | if ( addr.resource() == 0 ) | 780 | if ( addr.resource() == 0 ) |
781 | addr.setResource( standardResource() ); | 781 | addr.setResource( standardResource() ); |
782 | 782 | ||
783 | addr.setChanged( true ); | 783 | addr.setChanged( true ); |
784 | } | 784 | } |
785 | 785 | ||
786 | void AddressBook::removeAddressee( const Addressee &a ) | 786 | void AddressBook::removeAddressee( const Addressee &a ) |
787 | { | 787 | { |
788 | Iterator it; | 788 | Iterator it; |
789 | Iterator it2; | 789 | Iterator it2; |
790 | bool found = false; | 790 | bool found = false; |
791 | for ( it = begin(); it != end(); ++it ) { | 791 | for ( it = begin(); it != end(); ++it ) { |
792 | if ( a.uid() == (*it).uid() ) { | 792 | if ( a.uid() == (*it).uid() ) { |
793 | found = true; | 793 | found = true; |
794 | it2 = it; | 794 | it2 = it; |
795 | } else { | 795 | } else { |
796 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 796 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
797 | QString name = (*it).uid().mid( 19 ); | 797 | QString name = (*it).uid().mid( 19 ); |
798 | Addressee b = a; | 798 | Addressee b = a; |
799 | QString id = b.getID( name ); | 799 | QString id = b.getID( name ); |
800 | if ( ! id.isEmpty() ) { | 800 | if ( ! id.isEmpty() ) { |
801 | QString des = (*it).note(); | 801 | QString des = (*it).note(); |
802 | if( des.find( id ) < 0 ) { | 802 | if( des.find( id ) < 0 ) { |
803 | des += id + ","; | 803 | des += id + ","; |
804 | (*it).setNote( des ); | 804 | (*it).setNote( des ); |
805 | } | 805 | } |
806 | } | 806 | } |
807 | } | 807 | } |
808 | 808 | ||
809 | } | 809 | } |
810 | } | 810 | } |
811 | 811 | ||
812 | if ( found ) | 812 | if ( found ) |
813 | removeAddressee( it2 ); | 813 | removeAddressee( it2 ); |
814 | 814 | ||
815 | } | 815 | } |
816 | 816 | ||
817 | void AddressBook::removeSyncAddressees( bool removeDeleted ) | 817 | void AddressBook::removeSyncAddressees( bool removeDeleted ) |
818 | { | 818 | { |
819 | Iterator it = begin(); | 819 | Iterator it = begin(); |
820 | Iterator it2 ; | 820 | Iterator it2 ; |
821 | QDateTime dt ( QDate( 2004,1,1) ); | 821 | QDateTime dt ( QDate( 2004,1,1) ); |
822 | while ( it != end() ) { | 822 | while ( it != end() ) { |
823 | (*it).setRevision( dt ); | 823 | (*it).setRevision( dt ); |
824 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | 824 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); |
825 | (*it).setIDStr(""); | 825 | (*it).setIDStr(""); |
826 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { | 826 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { |
827 | it2 = it; | 827 | it2 = it; |
828 | //qDebug("removing %s ",(*it).uid().latin1() ); | 828 | //qDebug("removing %s ",(*it).uid().latin1() ); |
829 | ++it; | 829 | ++it; |
830 | removeAddressee( it2 ); | 830 | removeAddressee( it2 ); |
831 | } else { | 831 | } else { |
832 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 832 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
833 | ++it; | 833 | ++it; |
834 | } | 834 | } |
835 | } | 835 | } |
836 | deleteRemovedAddressees(); | 836 | deleteRemovedAddressees(); |
837 | } | 837 | } |
838 | 838 | ||
839 | void AddressBook::removeAddressee( const Iterator &it ) | 839 | void AddressBook::removeAddressee( const Iterator &it ) |
840 | { | 840 | { |
841 | d->mRemovedAddressees.append( (*it) ); | 841 | d->mRemovedAddressees.append( (*it) ); |
842 | d->mAddressees.remove( it.d->mIt ); | 842 | d->mAddressees.remove( it.d->mIt ); |
843 | } | 843 | } |
844 | 844 | ||
845 | AddressBook::Iterator AddressBook::find( const Addressee &a ) | 845 | AddressBook::Iterator AddressBook::find( const Addressee &a ) |
846 | { | 846 | { |
847 | Iterator it; | 847 | Iterator it; |
848 | for ( it = begin(); it != end(); ++it ) { | 848 | for ( it = begin(); it != end(); ++it ) { |
849 | if ( a.uid() == (*it).uid() ) { | 849 | if ( a.uid() == (*it).uid() ) { |
850 | return it; | 850 | return it; |
851 | } | 851 | } |
852 | } | 852 | } |
853 | return end(); | 853 | return end(); |
854 | } | 854 | } |
855 | 855 | ||
856 | Addressee AddressBook::findByUid( const QString &uid ) | 856 | Addressee AddressBook::findByUid( const QString &uid ) |
857 | { | 857 | { |
858 | Iterator it; | 858 | Iterator it; |
859 | for ( it = begin(); it != end(); ++it ) { | 859 | for ( it = begin(); it != end(); ++it ) { |
860 | if ( uid == (*it).uid() ) { | 860 | if ( uid == (*it).uid() ) { |
861 | return *it; | 861 | return *it; |
862 | } | 862 | } |
863 | } | 863 | } |
864 | return Addressee(); | 864 | return Addressee(); |
865 | } | 865 | } |
866 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd ) | 866 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) |
867 | { | 867 | { |
868 | //qDebug("AddressBook::preExternSync "); | 868 | //qDebug("AddressBook::preExternSync "); |
869 | AddressBook::Iterator it; | 869 | AddressBook::Iterator it; |
870 | for ( it = begin(); it != end(); ++it ) { | 870 | for ( it = begin(); it != end(); ++it ) { |
871 | (*it).setID( csd, (*it).externalUID() ); | 871 | (*it).setID( csd, (*it).externalUID() ); |
872 | (*it).computeCsum( csd ); | 872 | (*it).computeCsum( csd ); |
873 | } | 873 | } |
874 | mergeAB( aBook ,csd ); | 874 | mergeAB( aBook ,csd, isSubset ); |
875 | } | 875 | } |
876 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd) | 876 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd) |
877 | { | 877 | { |
878 | //qDebug("AddressBook::postExternSync "); | 878 | //qDebug("AddressBook::postExternSync "); |
879 | AddressBook::Iterator it; | 879 | AddressBook::Iterator it; |
880 | for ( it = begin(); it != end(); ++it ) { | 880 | for ( it = begin(); it != end(); ++it ) { |
881 | // qDebug("check uid %s ", (*it).uid().latin1() ); | 881 | // qDebug("check uid %s ", (*it).uid().latin1() ); |
882 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || | 882 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || |
883 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { | 883 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM ) { |
884 | Addressee ad = aBook->findByUid( ( (*it).uid() )); | 884 | Addressee ad = aBook->findByUid( ( (*it).uid() )); |
885 | if ( ad.isEmpty() ) { | 885 | if ( ad.isEmpty() ) { |
886 | qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); | 886 | qDebug("postExternSync:ERROR addressee is empty: %s ", (*it).uid().latin1()); |
887 | } else { | 887 | } else { |
888 | (*it).computeCsum( csd ); | 888 | (*it).computeCsum( csd ); |
889 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) | 889 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) |
890 | ad.setID( csd, (*it).externalUID() ); | 890 | ad.setID( csd, (*it).externalUID() ); |
891 | ad.setCsum( csd, (*it).getCsum( csd ) ); | 891 | ad.setCsum( csd, (*it).getCsum( csd ) ); |
892 | aBook->insertAddressee( ad ); | 892 | aBook->insertAddressee( ad ); |
893 | } | 893 | } |
894 | } | 894 | } |
895 | } | 895 | } |
896 | } | 896 | } |
897 | 897 | ||
898 | bool AddressBook::containsExternalUid( const QString& uid ) | 898 | bool AddressBook::containsExternalUid( const QString& uid ) |
899 | { | 899 | { |
900 | Iterator it; | 900 | Iterator it; |
901 | for ( it = begin(); it != end(); ++it ) { | 901 | for ( it = begin(); it != end(); ++it ) { |
902 | if ( uid == (*it).externalUID( ) ) | 902 | if ( uid == (*it).externalUID( ) ) |
903 | return true; | 903 | return true; |
904 | } | 904 | } |
905 | return false; | 905 | return false; |
906 | } | 906 | } |
907 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) | 907 | Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) |
908 | { | 908 | { |
909 | Iterator it; | 909 | Iterator it; |
910 | for ( it = begin(); it != end(); ++it ) { | 910 | for ( it = begin(); it != end(); ++it ) { |
911 | if ( uid == (*it).getID( profile ) ) | 911 | if ( uid == (*it).getID( profile ) ) |
912 | return (*it); | 912 | return (*it); |
913 | } | 913 | } |
914 | return Addressee(); | 914 | return Addressee(); |
915 | } | 915 | } |
916 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile ) | 916 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) |
917 | { | 917 | { |
918 | Iterator it; | 918 | Iterator it; |
919 | Addressee ad; | 919 | Addressee ad; |
920 | for ( it = begin(); it != end(); ++it ) { | 920 | for ( it = begin(); it != end(); ++it ) { |
921 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); | 921 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); |
922 | if ( !ad.isEmpty() ) { | 922 | if ( !ad.isEmpty() ) { |
923 | (*it).mergeContact( ad ); | 923 | (*it).mergeContact( ad ,isSubset); |
924 | } | 924 | } |
925 | } | 925 | } |
926 | #if 0 | 926 | #if 0 |
927 | // test only | 927 | // test only |
928 | for ( it = begin(); it != end(); ++it ) { | 928 | for ( it = begin(); it != end(); ++it ) { |
929 | 929 | ||
930 | qDebug("uid %s ", (*it).uid().latin1()); | 930 | qDebug("uid %s ", (*it).uid().latin1()); |
931 | } | 931 | } |
932 | #endif | 932 | #endif |
933 | } | 933 | } |
934 | 934 | ||
935 | #if 0 | 935 | #if 0 |
936 | Addressee::List AddressBook::getExternLastSyncAddressees() | 936 | Addressee::List AddressBook::getExternLastSyncAddressees() |
937 | { | 937 | { |
938 | Addressee::List results; | 938 | Addressee::List results; |
939 | 939 | ||
940 | Iterator it; | 940 | Iterator it; |
941 | for ( it = begin(); it != end(); ++it ) { | 941 | for ( it = begin(); it != end(); ++it ) { |
942 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { | 942 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { |
943 | if ( (*it).familyName().left(4) == "!E: " ) | 943 | if ( (*it).familyName().left(4) == "!E: " ) |
944 | results.append( *it ); | 944 | results.append( *it ); |
945 | } | 945 | } |
946 | } | 946 | } |
947 | 947 | ||
948 | return results; | 948 | return results; |
949 | } | 949 | } |
950 | #endif | 950 | #endif |
951 | void AddressBook::resetTempSyncStat() | 951 | void AddressBook::resetTempSyncStat() |
952 | { | 952 | { |
953 | Iterator it; | 953 | Iterator it; |
954 | for ( it = begin(); it != end(); ++it ) { | 954 | for ( it = begin(); it != end(); ++it ) { |
955 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); | 955 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); |
956 | } | 956 | } |
957 | 957 | ||
958 | } | 958 | } |
959 | 959 | ||
960 | QStringList AddressBook:: uidList() | 960 | QStringList AddressBook:: uidList() |
961 | { | 961 | { |
962 | QStringList results; | 962 | QStringList results; |
963 | Iterator it; | 963 | Iterator it; |
964 | for ( it = begin(); it != end(); ++it ) { | 964 | for ( it = begin(); it != end(); ++it ) { |
965 | results.append( (*it).uid() ); | 965 | results.append( (*it).uid() ); |
966 | } | 966 | } |
967 | return results; | 967 | return results; |
968 | } | 968 | } |
969 | 969 | ||
970 | 970 | ||
971 | Addressee::List AddressBook::allAddressees() | 971 | Addressee::List AddressBook::allAddressees() |
972 | { | 972 | { |
973 | return d->mAddressees; | 973 | return d->mAddressees; |
974 | 974 | ||
975 | } | 975 | } |
976 | 976 | ||
977 | Addressee::List AddressBook::findByName( const QString &name ) | 977 | Addressee::List AddressBook::findByName( const QString &name ) |
978 | { | 978 | { |
979 | Addressee::List results; | 979 | Addressee::List results; |
980 | 980 | ||
981 | Iterator it; | 981 | Iterator it; |
982 | for ( it = begin(); it != end(); ++it ) { | 982 | for ( it = begin(); it != end(); ++it ) { |
983 | if ( name == (*it).realName() ) { | 983 | if ( name == (*it).realName() ) { |
984 | results.append( *it ); | 984 | results.append( *it ); |
985 | } | 985 | } |
986 | } | 986 | } |
987 | 987 | ||
988 | return results; | 988 | return results; |
989 | } | 989 | } |
990 | 990 | ||
991 | Addressee::List AddressBook::findByEmail( const QString &email ) | 991 | Addressee::List AddressBook::findByEmail( const QString &email ) |
992 | { | 992 | { |
993 | Addressee::List results; | 993 | Addressee::List results; |
994 | QStringList mailList; | 994 | QStringList mailList; |
995 | 995 | ||
996 | Iterator it; | 996 | Iterator it; |
997 | for ( it = begin(); it != end(); ++it ) { | 997 | for ( it = begin(); it != end(); ++it ) { |
998 | mailList = (*it).emails(); | 998 | mailList = (*it).emails(); |
999 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { | 999 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { |
1000 | if ( email == (*ite) ) { | 1000 | if ( email == (*ite) ) { |
1001 | results.append( *it ); | 1001 | results.append( *it ); |
1002 | } | 1002 | } |
1003 | } | 1003 | } |
1004 | } | 1004 | } |
1005 | 1005 | ||
1006 | return results; | 1006 | return results; |
1007 | } | 1007 | } |
1008 | 1008 | ||
1009 | Addressee::List AddressBook::findByCategory( const QString &category ) | 1009 | Addressee::List AddressBook::findByCategory( const QString &category ) |
1010 | { | 1010 | { |
1011 | Addressee::List results; | 1011 | Addressee::List results; |
1012 | 1012 | ||
1013 | Iterator it; | 1013 | Iterator it; |
1014 | for ( it = begin(); it != end(); ++it ) { | 1014 | for ( it = begin(); it != end(); ++it ) { |
1015 | if ( (*it).hasCategory( category) ) { | 1015 | if ( (*it).hasCategory( category) ) { |
1016 | results.append( *it ); | 1016 | results.append( *it ); |
1017 | } | 1017 | } |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | return results; | 1020 | return results; |
1021 | } | 1021 | } |
1022 | 1022 | ||
1023 | void AddressBook::dump() const | 1023 | void AddressBook::dump() const |
1024 | { | 1024 | { |
1025 | kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; | 1025 | kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; |
1026 | 1026 | ||
1027 | ConstIterator it; | 1027 | ConstIterator it; |
1028 | for( it = begin(); it != end(); ++it ) { | 1028 | for( it = begin(); it != end(); ++it ) { |
1029 | (*it).dump(); | 1029 | (*it).dump(); |
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; | 1032 | kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; |
1033 | } | 1033 | } |
1034 | 1034 | ||
1035 | QString AddressBook::identifier() | 1035 | QString AddressBook::identifier() |
1036 | { | 1036 | { |
1037 | QStringList identifier; | 1037 | QStringList identifier; |
1038 | 1038 | ||
1039 | 1039 | ||
1040 | KRES::Manager<Resource>::ActiveIterator it; | 1040 | KRES::Manager<Resource>::ActiveIterator it; |
1041 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 1041 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
1042 | if ( !(*it)->identifier().isEmpty() ) | 1042 | if ( !(*it)->identifier().isEmpty() ) |
1043 | identifier.append( (*it)->identifier() ); | 1043 | identifier.append( (*it)->identifier() ); |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | return identifier.join( ":" ); | 1046 | return identifier.join( ":" ); |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | Field::List AddressBook::fields( int category ) | 1049 | Field::List AddressBook::fields( int category ) |
1050 | { | 1050 | { |
1051 | if ( d->mAllFields.isEmpty() ) { | 1051 | if ( d->mAllFields.isEmpty() ) { |
1052 | d->mAllFields = Field::allFields(); | 1052 | d->mAllFields = Field::allFields(); |
1053 | } | 1053 | } |
1054 | 1054 | ||
1055 | if ( category == Field::All ) return d->mAllFields; | 1055 | if ( category == Field::All ) return d->mAllFields; |
1056 | 1056 | ||
1057 | Field::List result; | 1057 | Field::List result; |
1058 | Field::List::ConstIterator it; | 1058 | Field::List::ConstIterator it; |
1059 | for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) { | 1059 | for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) { |
1060 | if ( (*it)->category() & category ) result.append( *it ); | 1060 | if ( (*it)->category() & category ) result.append( *it ); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | return result; | 1063 | return result; |
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | bool AddressBook::addCustomField( const QString &label, int category, | 1066 | bool AddressBook::addCustomField( const QString &label, int category, |
1067 | const QString &key, const QString &app ) | 1067 | const QString &key, const QString &app ) |
1068 | { | 1068 | { |
1069 | if ( d->mAllFields.isEmpty() ) { | 1069 | if ( d->mAllFields.isEmpty() ) { |
1070 | d->mAllFields = Field::allFields(); | 1070 | d->mAllFields = Field::allFields(); |
1071 | } | 1071 | } |
1072 | //US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app; | 1072 | //US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app; |
1073 | QString a = app.isNull() ? KGlobal::getAppName() : app; | 1073 | QString a = app.isNull() ? KGlobal::getAppName() : app; |
1074 | 1074 | ||
1075 | QString k = key.isNull() ? label : key; | 1075 | QString k = key.isNull() ? label : key; |
1076 | 1076 | ||
1077 | Field *field = Field::createCustomField( label, category, k, a ); | 1077 | Field *field = Field::createCustomField( label, category, k, a ); |
1078 | 1078 | ||
1079 | if ( !field ) return false; | 1079 | if ( !field ) return false; |
1080 | 1080 | ||
1081 | d->mAllFields.append( field ); | 1081 | d->mAllFields.append( field ); |
1082 | 1082 | ||
1083 | return true; | 1083 | return true; |
1084 | } | 1084 | } |
1085 | 1085 | ||
1086 | QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab ) | 1086 | QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab ) |
1087 | { | 1087 | { |
1088 | if (!ab.d) return s; | 1088 | if (!ab.d) return s; |
1089 | 1089 | ||
1090 | return s << ab.d->mAddressees; | 1090 | return s << ab.d->mAddressees; |
1091 | } | 1091 | } |
1092 | 1092 | ||
1093 | QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab ) | 1093 | QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab ) |
1094 | { | 1094 | { |
1095 | if (!ab.d) return s; | 1095 | if (!ab.d) return s; |
1096 | 1096 | ||
1097 | s >> ab.d->mAddressees; | 1097 | s >> ab.d->mAddressees; |
1098 | 1098 | ||
1099 | return s; | 1099 | return s; |
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | bool AddressBook::addResource( Resource *resource ) | 1102 | bool AddressBook::addResource( Resource *resource ) |
1103 | { | 1103 | { |
1104 | if ( !resource->open() ) { | 1104 | if ( !resource->open() ) { |
1105 | kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; | 1105 | kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; |
1106 | return false; | 1106 | return false; |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | resource->setAddressBook( this ); | 1109 | resource->setAddressBook( this ); |
1110 | 1110 | ||
1111 | d->mManager->add( resource ); | 1111 | d->mManager->add( resource ); |
1112 | return true; | 1112 | return true; |
1113 | } | 1113 | } |
1114 | 1114 | ||
1115 | bool AddressBook::removeResource( Resource *resource ) | 1115 | bool AddressBook::removeResource( Resource *resource ) |
1116 | { | 1116 | { |
1117 | resource->close(); | 1117 | resource->close(); |
1118 | 1118 | ||
1119 | if ( resource == standardResource() ) | 1119 | if ( resource == standardResource() ) |
1120 | d->mManager->setStandardResource( 0 ); | 1120 | d->mManager->setStandardResource( 0 ); |
1121 | 1121 | ||
1122 | resource->setAddressBook( 0 ); | 1122 | resource->setAddressBook( 0 ); |
1123 | 1123 | ||
1124 | d->mManager->remove( resource ); | 1124 | d->mManager->remove( resource ); |
1125 | return true; | 1125 | return true; |
1126 | } | 1126 | } |
1127 | 1127 | ||
1128 | QPtrList<Resource> AddressBook::resources() | 1128 | QPtrList<Resource> AddressBook::resources() |
1129 | { | 1129 | { |
1130 | QPtrList<Resource> list; | 1130 | QPtrList<Resource> list; |
1131 | 1131 | ||
1132 | // qDebug("AddressBook::resources() 1"); | 1132 | // qDebug("AddressBook::resources() 1"); |
1133 | 1133 | ||
1134 | KRES::Manager<Resource>::ActiveIterator it; | 1134 | KRES::Manager<Resource>::ActiveIterator it; |
1135 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 1135 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
1136 | list.append( *it ); | 1136 | list.append( *it ); |
1137 | 1137 | ||
1138 | return list; | 1138 | return list; |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | /*US | 1141 | /*US |
1142 | void AddressBook::setErrorHandler( ErrorHandler *handler ) | 1142 | void AddressBook::setErrorHandler( ErrorHandler *handler ) |
1143 | { | 1143 | { |
1144 | delete d->mErrorHandler; | 1144 | delete d->mErrorHandler; |
1145 | d->mErrorHandler = handler; | 1145 | d->mErrorHandler = handler; |
1146 | } | 1146 | } |
1147 | */ | 1147 | */ |
1148 | 1148 | ||
1149 | void AddressBook::error( const QString& msg ) | 1149 | void AddressBook::error( const QString& msg ) |
1150 | { | 1150 | { |
1151 | /*US | 1151 | /*US |
1152 | if ( !d->mErrorHandler ) // create default error handler | 1152 | if ( !d->mErrorHandler ) // create default error handler |
1153 | d->mErrorHandler = new ConsoleErrorHandler; | 1153 | d->mErrorHandler = new ConsoleErrorHandler; |
1154 | 1154 | ||
1155 | if ( d->mErrorHandler ) | 1155 | if ( d->mErrorHandler ) |
1156 | d->mErrorHandler->error( msg ); | 1156 | d->mErrorHandler->error( msg ); |
1157 | else | 1157 | else |
1158 | kdError(5700) << "no error handler defined" << endl; | 1158 | kdError(5700) << "no error handler defined" << endl; |
1159 | */ | 1159 | */ |
1160 | kdDebug(5700) << "msg" << endl; | 1160 | kdDebug(5700) << "msg" << endl; |
1161 | qDebug(msg); | 1161 | qDebug(msg); |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | void AddressBook::deleteRemovedAddressees() | 1164 | void AddressBook::deleteRemovedAddressees() |
1165 | { | 1165 | { |
1166 | Addressee::List::Iterator it; | 1166 | Addressee::List::Iterator it; |
1167 | for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) { | 1167 | for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) { |
1168 | Resource *resource = (*it).resource(); | 1168 | Resource *resource = (*it).resource(); |
1169 | if ( resource && !resource->readOnly() && resource->isOpen() ) | 1169 | if ( resource && !resource->readOnly() && resource->isOpen() ) |
1170 | resource->removeAddressee( *it ); | 1170 | resource->removeAddressee( *it ); |
1171 | } | 1171 | } |
1172 | 1172 | ||
1173 | d->mRemovedAddressees.clear(); | 1173 | d->mRemovedAddressees.clear(); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | void AddressBook::setStandardResource( Resource *resource ) | 1176 | void AddressBook::setStandardResource( Resource *resource ) |
1177 | { | 1177 | { |
1178 | // qDebug("AddressBook::setStandardResource 1"); | 1178 | // qDebug("AddressBook::setStandardResource 1"); |
1179 | d->mManager->setStandardResource( resource ); | 1179 | d->mManager->setStandardResource( resource ); |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | Resource *AddressBook::standardResource() | 1182 | Resource *AddressBook::standardResource() |
1183 | { | 1183 | { |
1184 | return d->mManager->standardResource(); | 1184 | return d->mManager->standardResource(); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | KRES::Manager<Resource> *AddressBook::resourceManager() | 1187 | KRES::Manager<Resource> *AddressBook::resourceManager() |
1188 | { | 1188 | { |
1189 | return d->mManager; | 1189 | return d->mManager; |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | void AddressBook::cleanUp() | 1192 | void AddressBook::cleanUp() |
1193 | { | 1193 | { |
1194 | KRES::Manager<Resource>::ActiveIterator it; | 1194 | KRES::Manager<Resource>::ActiveIterator it; |
1195 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 1195 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
1196 | if ( !(*it)->readOnly() && (*it)->isOpen() ) | 1196 | if ( !(*it)->readOnly() && (*it)->isOpen() ) |
1197 | (*it)->cleanUp(); | 1197 | (*it)->cleanUp(); |
1198 | } | 1198 | } |
1199 | } | 1199 | } |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index df9048b..a6bf451 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -1,348 +1,348 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_ADDRESSBOOK_H | 28 | #ifndef KABC_ADDRESSBOOK_H |
29 | #define KABC_ADDRESSBOOK_H | 29 | #define KABC_ADDRESSBOOK_H |
30 | 30 | ||
31 | #include <qobject.h> | 31 | #include <qobject.h> |
32 | 32 | ||
33 | #include <kresources/manager.h> | 33 | #include <kresources/manager.h> |
34 | #include <qptrlist.h> | 34 | #include <qptrlist.h> |
35 | 35 | ||
36 | #include "addressee.h" | 36 | #include "addressee.h" |
37 | #include "field.h" | 37 | #include "field.h" |
38 | 38 | ||
39 | namespace KABC { | 39 | namespace KABC { |
40 | 40 | ||
41 | class ErrorHandler; | 41 | class ErrorHandler; |
42 | class Resource; | 42 | class Resource; |
43 | class Ticket; | 43 | class Ticket; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | @short Address Book | 46 | @short Address Book |
47 | 47 | ||
48 | This class provides access to a collection of address book entries. | 48 | This class provides access to a collection of address book entries. |
49 | */ | 49 | */ |
50 | class AddressBook : public QObject | 50 | class AddressBook : public QObject |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | friend QDataStream &operator<<( QDataStream &, const AddressBook & ); | 54 | friend QDataStream &operator<<( QDataStream &, const AddressBook & ); |
55 | friend QDataStream &operator>>( QDataStream &, AddressBook & ); | 55 | friend QDataStream &operator>>( QDataStream &, AddressBook & ); |
56 | friend class StdAddressBook; | 56 | friend class StdAddressBook; |
57 | 57 | ||
58 | public: | 58 | public: |
59 | /** | 59 | /** |
60 | @short Address Book Iterator | 60 | @short Address Book Iterator |
61 | 61 | ||
62 | This class provides an iterator for address book entries. | 62 | This class provides an iterator for address book entries. |
63 | */ | 63 | */ |
64 | class Iterator | 64 | class Iterator |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | Iterator(); | 67 | Iterator(); |
68 | Iterator( const Iterator & ); | 68 | Iterator( const Iterator & ); |
69 | ~Iterator(); | 69 | ~Iterator(); |
70 | 70 | ||
71 | Iterator &operator=( const Iterator & ); | 71 | Iterator &operator=( const Iterator & ); |
72 | const Addressee &operator*() const; | 72 | const Addressee &operator*() const; |
73 | Addressee &operator*(); | 73 | Addressee &operator*(); |
74 | Addressee* operator->(); | 74 | Addressee* operator->(); |
75 | Iterator &operator++(); | 75 | Iterator &operator++(); |
76 | Iterator &operator++(int); | 76 | Iterator &operator++(int); |
77 | Iterator &operator--(); | 77 | Iterator &operator--(); |
78 | Iterator &operator--(int); | 78 | Iterator &operator--(int); |
79 | bool operator==( const Iterator &it ); | 79 | bool operator==( const Iterator &it ); |
80 | bool operator!=( const Iterator &it ); | 80 | bool operator!=( const Iterator &it ); |
81 | 81 | ||
82 | struct IteratorData; | 82 | struct IteratorData; |
83 | IteratorData *d; | 83 | IteratorData *d; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | @short Address Book Const Iterator | 87 | @short Address Book Const Iterator |
88 | 88 | ||
89 | This class provides a const iterator for address book entries. | 89 | This class provides a const iterator for address book entries. |
90 | */ | 90 | */ |
91 | class ConstIterator | 91 | class ConstIterator |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | ConstIterator(); | 94 | ConstIterator(); |
95 | ConstIterator( const ConstIterator & ); | 95 | ConstIterator( const ConstIterator & ); |
96 | ~ConstIterator(); | 96 | ~ConstIterator(); |
97 | 97 | ||
98 | ConstIterator &operator=( const ConstIterator & ); | 98 | ConstIterator &operator=( const ConstIterator & ); |
99 | const Addressee &operator*() const; | 99 | const Addressee &operator*() const; |
100 | const Addressee* operator->() const; | 100 | const Addressee* operator->() const; |
101 | ConstIterator &operator++(); | 101 | ConstIterator &operator++(); |
102 | ConstIterator &operator++(int); | 102 | ConstIterator &operator++(int); |
103 | ConstIterator &operator--(); | 103 | ConstIterator &operator--(); |
104 | ConstIterator &operator--(int); | 104 | ConstIterator &operator--(int); |
105 | bool operator==( const ConstIterator &it ); | 105 | bool operator==( const ConstIterator &it ); |
106 | bool operator!=( const ConstIterator &it ); | 106 | bool operator!=( const ConstIterator &it ); |
107 | 107 | ||
108 | struct ConstIteratorData; | 108 | struct ConstIteratorData; |
109 | ConstIteratorData *d; | 109 | ConstIteratorData *d; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | Constructs a address book object. | 113 | Constructs a address book object. |
114 | 114 | ||
115 | @param format File format class. | 115 | @param format File format class. |
116 | */ | 116 | */ |
117 | AddressBook(); | 117 | AddressBook(); |
118 | AddressBook( const QString &config ); | 118 | AddressBook( const QString &config ); |
119 | AddressBook( const QString &config, const QString &family ); | 119 | AddressBook( const QString &config, const QString &family ); |
120 | virtual ~AddressBook(); | 120 | virtual ~AddressBook(); |
121 | 121 | ||
122 | /** | 122 | /** |
123 | Requests a ticket for saving the addressbook. Calling this function locks | 123 | Requests a ticket for saving the addressbook. Calling this function locks |
124 | the addressbook for all other processes. If the address book is already | 124 | the addressbook for all other processes. If the address book is already |
125 | locked the function returns 0. You need the returned @ref Ticket object | 125 | locked the function returns 0. You need the returned @ref Ticket object |
126 | for calling the @ref save() function. | 126 | for calling the @ref save() function. |
127 | 127 | ||
128 | @see save() | 128 | @see save() |
129 | */ | 129 | */ |
130 | Ticket *requestSaveTicket( Resource *resource=0 ); | 130 | Ticket *requestSaveTicket( Resource *resource=0 ); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | Load address book from file. | 133 | Load address book from file. |
134 | */ | 134 | */ |
135 | bool load(); | 135 | bool load(); |
136 | 136 | ||
137 | /** | 137 | /** |
138 | Save address book. The address book is saved to the file, the Ticket | 138 | Save address book. The address book is saved to the file, the Ticket |
139 | object has been requested for by @ref requestSaveTicket(). | 139 | object has been requested for by @ref requestSaveTicket(). |
140 | 140 | ||
141 | @param ticket a ticket object returned by @ref requestSaveTicket() | 141 | @param ticket a ticket object returned by @ref requestSaveTicket() |
142 | */ | 142 | */ |
143 | bool save( Ticket *ticket ); | 143 | bool save( Ticket *ticket ); |
144 | bool saveAB( ); | 144 | bool saveAB( ); |
145 | bool saveABphone( QString fileName ); | 145 | bool saveABphone( QString fileName ); |
146 | void smplifyAddressees(); | 146 | void smplifyAddressees(); |
147 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | 147 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); |
148 | void export2File( QString fileName ); | 148 | void export2File( QString fileName ); |
149 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 149 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
150 | void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); | 150 | void importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false ); |
151 | void setUntagged(); | 151 | void setUntagged(); |
152 | void removeUntagged(); | 152 | void removeUntagged(); |
153 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 153 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
154 | /** | 154 | /** |
155 | Returns a iterator for first entry of address book. | 155 | Returns a iterator for first entry of address book. |
156 | */ | 156 | */ |
157 | Iterator begin(); | 157 | Iterator begin(); |
158 | 158 | ||
159 | /** | 159 | /** |
160 | Returns a const iterator for first entry of address book. | 160 | Returns a const iterator for first entry of address book. |
161 | */ | 161 | */ |
162 | ConstIterator begin() const; | 162 | ConstIterator begin() const; |
163 | 163 | ||
164 | /** | 164 | /** |
165 | Returns a iterator for first entry of address book. | 165 | Returns a iterator for first entry of address book. |
166 | */ | 166 | */ |
167 | Iterator end(); | 167 | Iterator end(); |
168 | 168 | ||
169 | /** | 169 | /** |
170 | Returns a const iterator for first entry of address book. | 170 | Returns a const iterator for first entry of address book. |
171 | */ | 171 | */ |
172 | ConstIterator end() const; | 172 | ConstIterator end() const; |
173 | 173 | ||
174 | /** | 174 | /** |
175 | Removes all entries from address book. | 175 | Removes all entries from address book. |
176 | */ | 176 | */ |
177 | void clear(); | 177 | void clear(); |
178 | 178 | ||
179 | /** | 179 | /** |
180 | Insert an Addressee object into address book. If an object with the same | 180 | Insert an Addressee object into address book. If an object with the same |
181 | unique id already exists in the address book it it replaced by the new | 181 | unique id already exists in the address book it it replaced by the new |
182 | one. If not the new object is appended to the address book. | 182 | one. If not the new object is appended to the address book. |
183 | */ | 183 | */ |
184 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 184 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
185 | 185 | ||
186 | /** | 186 | /** |
187 | Removes entry from the address book. | 187 | Removes entry from the address book. |
188 | */ | 188 | */ |
189 | void removeAddressee( const Addressee & ); | 189 | void removeAddressee( const Addressee & ); |
190 | 190 | ||
191 | /** | 191 | /** |
192 | This is like @ref removeAddressee() just above, with the difference that | 192 | This is like @ref removeAddressee() just above, with the difference that |
193 | the first element is a iterator, returned by @ref begin(). | 193 | the first element is a iterator, returned by @ref begin(). |
194 | */ | 194 | */ |
195 | void removeAddressee( const Iterator & ); | 195 | void removeAddressee( const Iterator & ); |
196 | 196 | ||
197 | /** | 197 | /** |
198 | Find the specified entry in address book. Returns end(), if the entry | 198 | Find the specified entry in address book. Returns end(), if the entry |
199 | couldn't be found. | 199 | couldn't be found. |
200 | */ | 200 | */ |
201 | Iterator find( const Addressee & ); | 201 | Iterator find( const Addressee & ); |
202 | 202 | ||
203 | /** | 203 | /** |
204 | Find the entry specified by an unique id. Returns an empty Addressee | 204 | Find the entry specified by an unique id. Returns an empty Addressee |
205 | object, if the address book does not contain an entry with this id. | 205 | object, if the address book does not contain an entry with this id. |
206 | */ | 206 | */ |
207 | Addressee findByUid( const QString & ); | 207 | Addressee findByUid( const QString & ); |
208 | 208 | ||
209 | 209 | ||
210 | /** | 210 | /** |
211 | Returns a list of all addressees in the address book. This list can | 211 | Returns a list of all addressees in the address book. This list can |
212 | be sorted with @ref KABC::AddresseeList for example. | 212 | be sorted with @ref KABC::AddresseeList for example. |
213 | */ | 213 | */ |
214 | Addressee::List allAddressees(); | 214 | Addressee::List allAddressees(); |
215 | 215 | ||
216 | /** | 216 | /** |
217 | Find all entries with the specified name in the address book. Returns | 217 | Find all entries with the specified name in the address book. Returns |
218 | an empty list, if no entries could be found. | 218 | an empty list, if no entries could be found. |
219 | */ | 219 | */ |
220 | Addressee::List findByName( const QString & ); | 220 | Addressee::List findByName( const QString & ); |
221 | 221 | ||
222 | /** | 222 | /** |
223 | Find all entries with the specified email address in the address book. | 223 | Find all entries with the specified email address in the address book. |
224 | Returns an empty list, if no entries could be found. | 224 | Returns an empty list, if no entries could be found. |
225 | */ | 225 | */ |
226 | Addressee::List findByEmail( const QString & ); | 226 | Addressee::List findByEmail( const QString & ); |
227 | 227 | ||
228 | /** | 228 | /** |
229 | Find all entries wich have the specified category in the address book. | 229 | Find all entries wich have the specified category in the address book. |
230 | Returns an empty list, if no entries could be found. | 230 | Returns an empty list, if no entries could be found. |
231 | */ | 231 | */ |
232 | Addressee::List findByCategory( const QString & ); | 232 | Addressee::List findByCategory( const QString & ); |
233 | 233 | ||
234 | /** | 234 | /** |
235 | Return a string identifying this addressbook. | 235 | Return a string identifying this addressbook. |
236 | */ | 236 | */ |
237 | virtual QString identifier(); | 237 | virtual QString identifier(); |
238 | 238 | ||
239 | /** | 239 | /** |
240 | Used for debug output. | 240 | Used for debug output. |
241 | */ | 241 | */ |
242 | void dump() const; | 242 | void dump() const; |
243 | 243 | ||
244 | void emitAddressBookLocked() { emit addressBookLocked( this ); } | 244 | void emitAddressBookLocked() { emit addressBookLocked( this ); } |
245 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } | 245 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } |
246 | void emitAddressBookChanged() { emit addressBookChanged( this ); } | 246 | void emitAddressBookChanged() { emit addressBookChanged( this ); } |
247 | 247 | ||
248 | /** | 248 | /** |
249 | Return list of all Fields known to the address book which are associated | 249 | Return list of all Fields known to the address book which are associated |
250 | with the given field category. | 250 | with the given field category. |
251 | */ | 251 | */ |
252 | Field::List fields( int category = Field::All ); | 252 | Field::List fields( int category = Field::All ); |
253 | 253 | ||
254 | /** | 254 | /** |
255 | Add custom field to address book. | 255 | Add custom field to address book. |
256 | 256 | ||
257 | @param label User visible label of the field. | 257 | @param label User visible label of the field. |
258 | @param category Ored list of field categories. | 258 | @param category Ored list of field categories. |
259 | @param key Identifier used as key for reading and writing the field. | 259 | @param key Identifier used as key for reading and writing the field. |
260 | @param app String used as application key for reading and writing | 260 | @param app String used as application key for reading and writing |
261 | the field. | 261 | the field. |
262 | */ | 262 | */ |
263 | bool addCustomField( const QString &label, int category = Field::All, | 263 | bool addCustomField( const QString &label, int category = Field::All, |
264 | const QString &key = QString::null, | 264 | const QString &key = QString::null, |
265 | const QString &app = QString::null ); | 265 | const QString &app = QString::null ); |
266 | 266 | ||
267 | 267 | ||
268 | /** | 268 | /** |
269 | Add address book resource. | 269 | Add address book resource. |
270 | */ | 270 | */ |
271 | bool addResource( Resource * ); | 271 | bool addResource( Resource * ); |
272 | 272 | ||
273 | /** | 273 | /** |
274 | Remove address book resource. | 274 | Remove address book resource. |
275 | */ | 275 | */ |
276 | bool removeResource( Resource * ); | 276 | bool removeResource( Resource * ); |
277 | 277 | ||
278 | /** | 278 | /** |
279 | Return pointer list of all resources. | 279 | Return pointer list of all resources. |
280 | */ | 280 | */ |
281 | QPtrList<Resource> resources(); | 281 | QPtrList<Resource> resources(); |
282 | 282 | ||
283 | /** | 283 | /** |
284 | Set the @p ErrorHandler, that is used by @ref error() to | 284 | Set the @p ErrorHandler, that is used by @ref error() to |
285 | provide gui-independend error messages. | 285 | provide gui-independend error messages. |
286 | */ | 286 | */ |
287 | void setErrorHandler( ErrorHandler * ); | 287 | void setErrorHandler( ErrorHandler * ); |
288 | 288 | ||
289 | /** | 289 | /** |
290 | Shows gui independend error messages. | 290 | Shows gui independend error messages. |
291 | */ | 291 | */ |
292 | void error( const QString& ); | 292 | void error( const QString& ); |
293 | 293 | ||
294 | /** | 294 | /** |
295 | Query all resources to clean up their lock files | 295 | Query all resources to clean up their lock files |
296 | */ | 296 | */ |
297 | void cleanUp(); | 297 | void cleanUp(); |
298 | 298 | ||
299 | // sync stuff | 299 | // sync stuff |
300 | //Addressee::List getExternLastSyncAddressees(); | 300 | //Addressee::List getExternLastSyncAddressees(); |
301 | void resetTempSyncStat(); | 301 | void resetTempSyncStat(); |
302 | QStringList uidList(); | 302 | QStringList uidList(); |
303 | void removeSyncAddressees( bool removeDeleted = false ); | 303 | void removeSyncAddressees( bool removeDeleted = false ); |
304 | void mergeAB( AddressBook *aBook, const QString& profile ); | 304 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); |
305 | Addressee findByExternUid( const QString& uid , const QString& profile ); | 305 | Addressee findByExternUid( const QString& uid , const QString& profile ); |
306 | bool containsExternalUid( const QString& uid ); | 306 | bool containsExternalUid( const QString& uid ); |
307 | 307 | ||
308 | void preExternSync( AddressBook* aBook, const QString& csd ); | 308 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); |
309 | void postExternSync( AddressBook* aBook, const QString& csd ); | 309 | void postExternSync( AddressBook* aBook, const QString& csd ); |
310 | signals: | 310 | signals: |
311 | /** | 311 | /** |
312 | Emitted, when the address book has changed on disk. | 312 | Emitted, when the address book has changed on disk. |
313 | */ | 313 | */ |
314 | void addressBookChanged( AddressBook * ); | 314 | void addressBookChanged( AddressBook * ); |
315 | 315 | ||
316 | /** | 316 | /** |
317 | Emitted, when the address book has been locked for writing. | 317 | Emitted, when the address book has been locked for writing. |
318 | */ | 318 | */ |
319 | void addressBookLocked( AddressBook * ); | 319 | void addressBookLocked( AddressBook * ); |
320 | 320 | ||
321 | /** | 321 | /** |
322 | Emitted, when the address book has been unlocked. | 322 | Emitted, when the address book has been unlocked. |
323 | */ | 323 | */ |
324 | void addressBookUnlocked( AddressBook * ); | 324 | void addressBookUnlocked( AddressBook * ); |
325 | 325 | ||
326 | protected: | 326 | protected: |
327 | void deleteRemovedAddressees(); | 327 | void deleteRemovedAddressees(); |
328 | void setStandardResource( Resource * ); | 328 | void setStandardResource( Resource * ); |
329 | Resource *standardResource(); | 329 | Resource *standardResource(); |
330 | KRES::Manager<Resource> *resourceManager(); | 330 | KRES::Manager<Resource> *resourceManager(); |
331 | 331 | ||
332 | void init(const QString &config, const QString &family); | 332 | void init(const QString &config, const QString &family); |
333 | 333 | ||
334 | private: | 334 | private: |
335 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 | 335 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 |
336 | 336 | ||
337 | 337 | ||
338 | struct AddressBookData; | 338 | struct AddressBookData; |
339 | AddressBookData *d; | 339 | AddressBookData *d; |
340 | bool blockLSEchange; | 340 | bool blockLSEchange; |
341 | }; | 341 | }; |
342 | 342 | ||
343 | QDataStream &operator<<( QDataStream &, const AddressBook & ); | 343 | QDataStream &operator<<( QDataStream &, const AddressBook & ); |
344 | QDataStream &operator>>( QDataStream &, AddressBook & ); | 344 | QDataStream &operator>>( QDataStream &, AddressBook & ); |
345 | 345 | ||
346 | } | 346 | } |
347 | 347 | ||
348 | #endif | 348 | #endif |
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 2aca559..295ee4f 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,866 +1,900 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | 30 | ||
31 | #include <ksharedptr.h> | 31 | #include <ksharedptr.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kidmanager.h> | 35 | #include <kidmanager.h> |
36 | //US | 36 | //US |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <libkcal/syncdefines.h> | 38 | #include <libkcal/syncdefines.h> |
39 | 39 | ||
40 | //US #include "resource.h" | 40 | //US #include "resource.h" |
41 | #include "addressee.h" | 41 | #include "addressee.h" |
42 | 42 | ||
43 | using namespace KABC; | 43 | using namespace KABC; |
44 | 44 | ||
45 | static bool matchBinaryPattern( int value, int pattern ); | 45 | static bool matchBinaryPattern( int value, int pattern ); |
46 | static bool matchBinaryPatternA( int value, int pattern ); | 46 | static bool matchBinaryPatternA( int value, int pattern ); |
47 | static bool matchBinaryPatternP( int value, int pattern ); | 47 | static bool matchBinaryPatternP( int value, int pattern ); |
48 | 48 | ||
49 | struct Addressee::AddresseeData : public KShared | 49 | struct Addressee::AddresseeData : public KShared |
50 | { | 50 | { |
51 | QString uid; | 51 | QString uid; |
52 | QString name; | 52 | QString name; |
53 | QString formattedName; | 53 | QString formattedName; |
54 | QString familyName; | 54 | QString familyName; |
55 | QString givenName; | 55 | QString givenName; |
56 | QString additionalName; | 56 | QString additionalName; |
57 | QString prefix; | 57 | QString prefix; |
58 | QString suffix; | 58 | QString suffix; |
59 | QString nickName; | 59 | QString nickName; |
60 | QDateTime birthday; | 60 | QDateTime birthday; |
61 | QString mailer; | 61 | QString mailer; |
62 | TimeZone timeZone; | 62 | TimeZone timeZone; |
63 | Geo geo; | 63 | Geo geo; |
64 | QString title; | 64 | QString title; |
65 | QString role; | 65 | QString role; |
66 | QString organization; | 66 | QString organization; |
67 | QString note; | 67 | QString note; |
68 | QString productId; | 68 | QString productId; |
69 | QDateTime revision; | 69 | QDateTime revision; |
70 | QString sortString; | 70 | QString sortString; |
71 | QString externalUID; | 71 | QString externalUID; |
72 | QString originalExternalUID; | 72 | QString originalExternalUID; |
73 | KURL url; | 73 | KURL url; |
74 | Secrecy secrecy; | 74 | Secrecy secrecy; |
75 | Picture logo; | 75 | Picture logo; |
76 | Picture photo; | 76 | Picture photo; |
77 | Sound sound; | 77 | Sound sound; |
78 | Agent agent; | 78 | Agent agent; |
79 | QString mExternalId; | 79 | QString mExternalId; |
80 | PhoneNumber::List phoneNumbers; | 80 | PhoneNumber::List phoneNumbers; |
81 | Address::List addresses; | 81 | Address::List addresses; |
82 | Key::List keys; | 82 | Key::List keys; |
83 | QStringList emails; | 83 | QStringList emails; |
84 | QStringList categories; | 84 | QStringList categories; |
85 | QStringList custom; | 85 | QStringList custom; |
86 | int mTempSyncStat; | 86 | int mTempSyncStat; |
87 | Resource *resource; | 87 | Resource *resource; |
88 | 88 | ||
89 | bool empty :1; | 89 | bool empty :1; |
90 | bool changed :1; | 90 | bool changed :1; |
91 | bool tagged :1; | 91 | bool tagged :1; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | Addressee::Addressee() | 94 | Addressee::Addressee() |
95 | { | 95 | { |
96 | mData = new AddresseeData; | 96 | mData = new AddresseeData; |
97 | mData->empty = true; | 97 | mData->empty = true; |
98 | mData->changed = false; | 98 | mData->changed = false; |
99 | mData->resource = 0; | 99 | mData->resource = 0; |
100 | mData->mExternalId = ":"; | 100 | mData->mExternalId = ":"; |
101 | mData->revision = QDateTime ( QDate( 2003,1,1)); | 101 | mData->revision = QDateTime ( QDate( 2003,1,1)); |
102 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 102 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
103 | } | 103 | } |
104 | 104 | ||
105 | Addressee::~Addressee() | 105 | Addressee::~Addressee() |
106 | { | 106 | { |
107 | } | 107 | } |
108 | 108 | ||
109 | Addressee::Addressee( const Addressee &a ) | 109 | Addressee::Addressee( const Addressee &a ) |
110 | { | 110 | { |
111 | mData = a.mData; | 111 | mData = a.mData; |
112 | } | 112 | } |
113 | 113 | ||
114 | Addressee &Addressee::operator=( const Addressee &a ) | 114 | Addressee &Addressee::operator=( const Addressee &a ) |
115 | { | 115 | { |
116 | mData = a.mData; | 116 | mData = a.mData; |
117 | return (*this); | 117 | return (*this); |
118 | } | 118 | } |
119 | 119 | ||
120 | Addressee Addressee::copy() | 120 | Addressee Addressee::copy() |
121 | { | 121 | { |
122 | Addressee a; | 122 | Addressee a; |
123 | *(a.mData) = *mData; | 123 | *(a.mData) = *mData; |
124 | return a; | 124 | return a; |
125 | } | 125 | } |
126 | 126 | ||
127 | void Addressee::detach() | 127 | void Addressee::detach() |
128 | { | 128 | { |
129 | if ( mData.count() == 1 ) return; | 129 | if ( mData.count() == 1 ) return; |
130 | *this = copy(); | 130 | *this = copy(); |
131 | } | 131 | } |
132 | 132 | ||
133 | bool Addressee::operator==( const Addressee &a ) const | 133 | bool Addressee::operator==( const Addressee &a ) const |
134 | { | 134 | { |
135 | if ( uid() != a.uid() ) return false; | 135 | if ( uid() != a.uid() ) return false; |
136 | if ( mData->name != a.mData->name ) return false; | 136 | if ( mData->name != a.mData->name ) return false; |
137 | if ( mData->formattedName != a.mData->formattedName ) return false; | 137 | if ( mData->formattedName != a.mData->formattedName ) return false; |
138 | if ( mData->familyName != a.mData->familyName ) return false; | 138 | if ( mData->familyName != a.mData->familyName ) return false; |
139 | if ( mData->givenName != a.mData->givenName ) return false; | 139 | if ( mData->givenName != a.mData->givenName ) return false; |
140 | if ( mData->additionalName != a.mData->additionalName ) return false; | 140 | if ( mData->additionalName != a.mData->additionalName ) return false; |
141 | if ( mData->prefix != a.mData->prefix ) return false; | 141 | if ( mData->prefix != a.mData->prefix ) return false; |
142 | if ( mData->suffix != a.mData->suffix ) return false; | 142 | if ( mData->suffix != a.mData->suffix ) return false; |
143 | if ( mData->nickName != a.mData->nickName ) return false; | 143 | if ( mData->nickName != a.mData->nickName ) return false; |
144 | if ( mData->birthday != a.mData->birthday ) return false; | 144 | if ( mData->birthday != a.mData->birthday ) return false; |
145 | if ( mData->mailer != a.mData->mailer ) return false; | 145 | if ( mData->mailer != a.mData->mailer ) return false; |
146 | if ( mData->timeZone != a.mData->timeZone ) return false; | 146 | if ( mData->timeZone != a.mData->timeZone ) return false; |
147 | if ( mData->geo != a.mData->geo ) return false; | 147 | if ( mData->geo != a.mData->geo ) return false; |
148 | if ( mData->title != a.mData->title ) return false; | 148 | if ( mData->title != a.mData->title ) return false; |
149 | if ( mData->role != a.mData->role ) return false; | 149 | if ( mData->role != a.mData->role ) return false; |
150 | if ( mData->organization != a.mData->organization ) return false; | 150 | if ( mData->organization != a.mData->organization ) return false; |
151 | if ( mData->note != a.mData->note ) return false; | 151 | if ( mData->note != a.mData->note ) return false; |
152 | if ( mData->productId != a.mData->productId ) return false; | 152 | if ( mData->productId != a.mData->productId ) return false; |
153 | //if ( mData->revision != a.mData->revision ) return false; | 153 | //if ( mData->revision != a.mData->revision ) return false; |
154 | if ( mData->sortString != a.mData->sortString ) return false; | 154 | if ( mData->sortString != a.mData->sortString ) return false; |
155 | if ( mData->secrecy != a.mData->secrecy ) return false; | 155 | if ( mData->secrecy != a.mData->secrecy ) return false; |
156 | if ( mData->logo != a.mData->logo ) return false; | 156 | if ( mData->logo != a.mData->logo ) return false; |
157 | if ( mData->photo != a.mData->photo ) return false; | 157 | if ( mData->photo != a.mData->photo ) return false; |
158 | if ( mData->sound != a.mData->sound ) return false; | 158 | if ( mData->sound != a.mData->sound ) return false; |
159 | if ( mData->agent != a.mData->agent ) return false; | 159 | if ( mData->agent != a.mData->agent ) return false; |
160 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 160 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
161 | ( mData->url != a.mData->url ) ) return false; | 161 | ( mData->url != a.mData->url ) ) return false; |
162 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 162 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
163 | if ( mData->addresses != a.mData->addresses ) return false; | 163 | if ( mData->addresses != a.mData->addresses ) return false; |
164 | if ( mData->keys != a.mData->keys ) return false; | 164 | if ( mData->keys != a.mData->keys ) return false; |
165 | if ( mData->emails != a.mData->emails ) return false; | 165 | if ( mData->emails != a.mData->emails ) return false; |
166 | if ( mData->categories != a.mData->categories ) return false; | 166 | if ( mData->categories != a.mData->categories ) return false; |
167 | if ( mData->custom != a.mData->custom ) return false; | 167 | if ( mData->custom != a.mData->custom ) return false; |
168 | 168 | ||
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | 171 | ||
172 | bool Addressee::operator!=( const Addressee &a ) const | 172 | bool Addressee::operator!=( const Addressee &a ) const |
173 | { | 173 | { |
174 | return !( a == *this ); | 174 | return !( a == *this ); |
175 | } | 175 | } |
176 | 176 | ||
177 | bool Addressee::isEmpty() const | 177 | bool Addressee::isEmpty() const |
178 | { | 178 | { |
179 | return mData->empty; | 179 | return mData->empty; |
180 | } | 180 | } |
181 | ulong Addressee::getCsum4List( const QStringList & attList) | 181 | ulong Addressee::getCsum4List( const QStringList & attList) |
182 | { | 182 | { |
183 | int max = attList.count(); | 183 | int max = attList.count(); |
184 | ulong cSum = 0; | 184 | ulong cSum = 0; |
185 | int j,k,i; | 185 | int j,k,i; |
186 | int add; | 186 | int add; |
187 | for ( i = 0; i < max ; ++i ) { | 187 | for ( i = 0; i < max ; ++i ) { |
188 | QString s = attList[i]; | 188 | QString s = attList[i]; |
189 | if ( ! s.isEmpty() ){ | 189 | if ( ! s.isEmpty() ){ |
190 | j = s.length(); | 190 | j = s.length(); |
191 | for ( k = 0; k < j; ++k ) { | 191 | for ( k = 0; k < j; ++k ) { |
192 | int mul = k +1; | 192 | int mul = k +1; |
193 | add = s[k].unicode (); | 193 | add = s[k].unicode (); |
194 | if ( k < 16 ) | 194 | if ( k < 16 ) |
195 | mul = mul * mul; | 195 | mul = mul * mul; |
196 | int ii = i+1; | 196 | int ii = i+1; |
197 | add = add * mul *ii*ii*ii; | 197 | add = add * mul *ii*ii*ii; |
198 | cSum += add; | 198 | cSum += add; |
199 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | //QString dump = attList.join(","); | 203 | //QString dump = attList.join(","); |
204 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 204 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
205 | 205 | ||
206 | return cSum; | 206 | return cSum; |
207 | 207 | ||
208 | } | 208 | } |
209 | void Addressee::computeCsum(const QString &dev) | 209 | void Addressee::computeCsum(const QString &dev) |
210 | { | 210 | { |
211 | QStringList l; | 211 | QStringList l; |
212 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 212 | if ( !mData->name.isEmpty() ) l.append(mData->name); |
213 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 213 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
214 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 214 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
215 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 215 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
216 | if ( !mData->additionalName ) l.append( mData->additionalName ); | 216 | if ( !mData->additionalName ) l.append( mData->additionalName ); |
217 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 217 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
218 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 218 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
219 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 219 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
220 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 220 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
221 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 221 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
222 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 222 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
223 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 223 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
224 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 224 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
225 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 225 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
226 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 226 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
227 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 227 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
228 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 228 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
229 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 229 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
230 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 230 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
231 | // if ( !mData->logo.isEmpty() ) l.append( ); | 231 | // if ( !mData->logo.isEmpty() ) l.append( ); |
232 | //if ( !mData->photo.isEmpty() ) l.append( ); | 232 | //if ( !mData->photo.isEmpty() ) l.append( ); |
233 | //if ( !mData->sound.isEmpty() ) l.append( ); | 233 | //if ( !mData->sound.isEmpty() ) l.append( ); |
234 | //if ( !mData->agent.isEmpty() ) l.append( ); | 234 | //if ( !mData->agent.isEmpty() ) l.append( ); |
235 | if ( mData->url.isValid() ) | 235 | if ( mData->url.isValid() ) |
236 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); | 236 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); |
237 | KABC::PhoneNumber::List phoneNumbers; | 237 | KABC::PhoneNumber::List phoneNumbers; |
238 | KABC::PhoneNumber::List::Iterator phoneIter; | 238 | KABC::PhoneNumber::List::Iterator phoneIter; |
239 | 239 | ||
240 | QStringList t; | 240 | QStringList t; |
241 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 241 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
242 | ++phoneIter ) | 242 | ++phoneIter ) |
243 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 243 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
244 | t.sort(); | 244 | t.sort(); |
245 | uint iii; | 245 | uint iii; |
246 | for ( iii = 0; iii < t.count(); ++iii) | 246 | for ( iii = 0; iii < t.count(); ++iii) |
247 | l.append( t[iii] ); | 247 | l.append( t[iii] ); |
248 | t = mData->emails; | 248 | t = mData->emails; |
249 | t.sort(); | 249 | t.sort(); |
250 | for ( iii = 0; iii < t.count(); ++iii) | 250 | for ( iii = 0; iii < t.count(); ++iii) |
251 | l.append( t[iii] ); | 251 | l.append( t[iii] ); |
252 | t = mData->categories; | 252 | t = mData->categories; |
253 | t.sort(); | 253 | t.sort(); |
254 | for ( iii = 0; iii < t.count(); ++iii) | 254 | for ( iii = 0; iii < t.count(); ++iii) |
255 | l.append( t[iii] ); | 255 | l.append( t[iii] ); |
256 | t = mData->custom; | 256 | t = mData->custom; |
257 | t.sort(); | 257 | t.sort(); |
258 | for ( iii = 0; iii < t.count(); ++iii) | 258 | for ( iii = 0; iii < t.count(); ++iii) |
259 | l.append( t[iii] ); | 259 | l.append( t[iii] ); |
260 | KABC::Address::List::Iterator addressIter; | 260 | KABC::Address::List::Iterator addressIter; |
261 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 261 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
262 | ++addressIter ) { | 262 | ++addressIter ) { |
263 | t = (*addressIter).asList(); | 263 | t = (*addressIter).asList(); |
264 | t.sort(); | 264 | t.sort(); |
265 | for ( iii = 0; iii < t.count(); ++iii) | 265 | for ( iii = 0; iii < t.count(); ++iii) |
266 | l.append( t[iii] ); | 266 | l.append( t[iii] ); |
267 | } | 267 | } |
268 | uint cs = getCsum4List(l); | 268 | uint cs = getCsum4List(l); |
269 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 269 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
270 | setCsum( dev, QString::number (cs )); | 270 | setCsum( dev, QString::number (cs )); |
271 | } | 271 | } |
272 | 272 | ||
273 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 273 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
274 | { | 274 | { |
275 | 275 | ||
276 | detach(); | 276 | detach(); |
277 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 277 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
278 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 278 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
279 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 279 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
280 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 280 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
281 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 281 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
282 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 282 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
283 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 283 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
284 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 284 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
285 | if ( !mData->birthday.isValid() ) | 285 | if ( !mData->birthday.isValid() ) |
286 | if ( ad.mData->birthday.isValid()) | 286 | if ( ad.mData->birthday.isValid()) |
287 | mData->birthday = ad.mData->birthday; | 287 | mData->birthday = ad.mData->birthday; |
288 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 288 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
289 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 289 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
290 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 290 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
291 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 291 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
292 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 292 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
293 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 293 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
294 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 294 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
295 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 295 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
296 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 296 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
297 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 297 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
298 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 298 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
299 | QStringList t; | 299 | QStringList t; |
300 | QStringList tAD; | 300 | QStringList tAD; |
301 | uint iii; | 301 | uint iii; |
302 | if ( isSubSet ) { | 302 | |
303 | // ********** phone numbers | 303 | // ********** phone numbers |
304 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 304 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
305 | PhoneNumber::List::Iterator phoneItAD; | 305 | PhoneNumber::List::Iterator phoneItAD; |
306 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 306 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
307 | bool found = false; | 307 | bool found = false; |
308 | PhoneNumber::List::Iterator it; | 308 | PhoneNumber::List::Iterator it; |
309 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 309 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
310 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 310 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
311 | found = true; | 311 | found = true; |
312 | (*it).setType( ( *phoneItAD ).type() ); | 312 | (*it).setType( ( *phoneItAD ).type() ); |
313 | break; | 313 | break; |
314 | } | ||
315 | } | 314 | } |
316 | if ( ! found ) | ||
317 | mData->phoneNumbers.append( *phoneItAD ); | ||
318 | } | 315 | } |
316 | if ( isSubSet && ! found ) | ||
317 | mData->phoneNumbers.append( *phoneItAD ); | ||
318 | } | ||
319 | if ( isSubSet ) { | ||
319 | // ************* emails; | 320 | // ************* emails; |
320 | t = mData->emails; | 321 | t = mData->emails; |
321 | tAD = ad.mData->emails; | 322 | tAD = ad.mData->emails; |
322 | for ( iii = 0; iii < tAD.count(); ++iii) | 323 | for ( iii = 0; iii < tAD.count(); ++iii) |
323 | if ( !t.contains(tAD[iii] ) ) | 324 | if ( !t.contains(tAD[iii] ) ) |
324 | mData->emails.append( tAD[iii] ); | 325 | mData->emails.append( tAD[iii] ); |
325 | // ************* categories; | ||
326 | t = mData->categories; | ||
327 | tAD = ad.mData->categories; | ||
328 | for ( iii = 0; iii < tAD.count(); ++iii) | ||
329 | if ( !t.contains(tAD[iii] ) ) | ||
330 | mData->categories.append( tAD[iii] ); | ||
331 | |||
332 | |||
333 | } | 326 | } |
334 | 327 | ||
328 | // ************* categories; | ||
329 | t = mData->categories; | ||
330 | tAD = ad.mData->categories; | ||
331 | for ( iii = 0; iii < tAD.count(); ++iii) | ||
332 | if ( !t.contains(tAD[iii] ) ) | ||
333 | mData->categories.append( tAD[iii] ); | ||
335 | QStringList::ConstIterator it; | 334 | QStringList::ConstIterator it; |
336 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 335 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
337 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 336 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
338 | bool found = false; | 337 | bool found = false; |
339 | QStringList::ConstIterator itL; | 338 | QStringList::ConstIterator itL; |
340 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { | 339 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { |
341 | if ( (*itL).startsWith( qualifiedName ) ) { | 340 | if ( (*itL).startsWith( qualifiedName ) ) { |
342 | found = true; | 341 | found = true; |
343 | break; | 342 | break; |
344 | } | 343 | } |
345 | } | 344 | } |
346 | if ( ! found ) { | 345 | if ( ! found ) { |
347 | mData->custom.append( *it ); | 346 | mData->custom.append( *it ); |
348 | } | 347 | } |
349 | } | 348 | } |
350 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 349 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
351 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 350 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
352 | if ( !mData->sound.isIntern() ) { | 351 | if ( !mData->sound.isIntern() ) { |
353 | if ( mData->sound.url().isEmpty() ) { | 352 | if ( mData->sound.url().isEmpty() ) { |
354 | mData->sound = ad.mData->sound; | 353 | mData->sound = ad.mData->sound; |
355 | } | 354 | } |
356 | } | 355 | } |
357 | if ( !mData->agent.isIntern() ) { | 356 | if ( !mData->agent.isIntern() ) { |
358 | if ( mData->agent.url().isEmpty() ) { | 357 | if ( mData->agent.url().isEmpty() ) { |
359 | mData->agent = ad.mData->agent; | 358 | mData->agent = ad.mData->agent; |
360 | } | 359 | } |
361 | } | 360 | } |
362 | { | 361 | { |
363 | Key::List::Iterator itA; | 362 | Key::List::Iterator itA; |
364 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { | 363 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { |
365 | bool found = false; | 364 | bool found = false; |
366 | Key::List::Iterator it; | 365 | Key::List::Iterator it; |
367 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 366 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
368 | if ( (*it) == (*itA)) { | 367 | if ( (*it) == (*itA)) { |
369 | found = true; | 368 | found = true; |
370 | break; | 369 | break; |
371 | 370 | ||
372 | } | 371 | } |
373 | } | 372 | } |
374 | if ( ! found ) { | 373 | if ( ! found ) { |
375 | mData->keys.append( *itA ); | 374 | mData->keys.append( *itA ); |
376 | } | 375 | } |
377 | } | 376 | } |
378 | } | 377 | } |
379 | KABC::Address::List::Iterator addressIterA; | 378 | KABC::Address::List::Iterator addressIterA; |
380 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | 379 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { |
381 | bool found = false; | 380 | bool found = false; |
382 | KABC::Address::List::Iterator addressIter; | 381 | KABC::Address::List::Iterator addressIter; |
383 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 382 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
384 | ++addressIter ) { | 383 | ++addressIter ) { |
385 | if ( (*addressIter) == (*addressIterA)) { | 384 | if ( (*addressIter) == (*addressIterA)) { |
386 | found = true; | 385 | found = true; |
387 | (*addressIter).setType( (*addressIterA).type() ); | 386 | (*addressIter).setType( (*addressIterA).type() ); |
388 | break; | 387 | break; |
389 | } | 388 | } |
390 | 389 | ||
391 | } | 390 | } |
392 | if ( ! found ) { | 391 | if ( isSubSet && ! found ) { |
393 | mData->addresses.append( *addressIterA ); | 392 | mData->addresses.append( *addressIterA ); |
394 | } | 393 | } |
395 | } | 394 | } |
396 | //qDebug("merge contact %s ", ad.uid().latin1()); | 395 | //qDebug("merge contact %s ", ad.uid().latin1()); |
397 | setUid( ad.uid() ); | 396 | setUid( ad.uid() ); |
398 | setRevision( ad.revision() ); | 397 | setRevision( ad.revision() ); |
399 | } | 398 | } |
400 | 399 | ||
401 | bool Addressee::removeVoice() | 400 | bool Addressee::removeVoice() |
402 | { | 401 | { |
403 | PhoneNumber::List phoneN = phoneNumbers(); | 402 | PhoneNumber::List phoneN = phoneNumbers(); |
404 | PhoneNumber::List::Iterator phoneIt; | 403 | PhoneNumber::List::Iterator phoneIt; |
405 | bool found = false; | 404 | bool found = false; |
406 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 405 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
407 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 406 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
408 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 407 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
409 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 408 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
410 | insertPhoneNumber( (*phoneIt) ); | 409 | insertPhoneNumber( (*phoneIt) ); |
411 | found = true; | 410 | found = true; |
412 | } | 411 | } |
413 | } | 412 | } |
414 | 413 | ||
415 | } | 414 | } |
416 | return found; | 415 | return found; |
417 | } | 416 | } |
418 | 417 | ||
419 | bool Addressee::containsAdr(const Addressee& ad ) | 418 | bool Addressee::containsAdr(const Addressee& ad ) |
420 | { | 419 | { |
421 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; | 420 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; |
422 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; | 421 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; |
423 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; | 422 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; |
424 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; | 423 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; |
425 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; | 424 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; |
426 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; | 425 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; |
427 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; | 426 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; |
428 | 427 | ||
429 | // compare phone numbers | 428 | // compare phone numbers |
430 | PhoneNumber::List phoneN = ad.phoneNumbers(); | 429 | PhoneNumber::List phoneN = ad.phoneNumbers(); |
431 | PhoneNumber::List::Iterator phoneIt; | 430 | PhoneNumber::List::Iterator phoneIt; |
432 | bool found = false; | 431 | bool found = false; |
433 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 432 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
434 | bool found = false; | 433 | bool found = false; |
435 | PhoneNumber::List phoneL = ad.phoneNumbers(); | 434 | PhoneNumber::List phoneL = ad.phoneNumbers(); |
436 | PhoneNumber::List::Iterator phoneItL; | 435 | PhoneNumber::List::Iterator phoneItL; |
437 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { | 436 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { |
438 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { | 437 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { |
439 | found = true; | 438 | found = true; |
440 | break; | 439 | break; |
441 | } | 440 | } |
442 | } | 441 | } |
443 | if ( ! found ) | 442 | if ( ! found ) |
444 | return false; | 443 | return false; |
445 | } | 444 | } |
446 | return true; | 445 | return true; |
447 | 446 | ||
448 | } | 447 | } |
449 | void Addressee::simplifyAddresses() | 448 | void Addressee::simplifyAddresses() |
450 | { | 449 | { |
451 | int max = 2; | 450 | int max = 2; |
452 | if ( mData->url.isValid() ) | 451 | if ( mData->url.isValid() ) |
453 | max = 1; | 452 | max = 1; |
454 | if ( mData->addresses.count() <= max ) return ; | 453 | if ( mData->addresses.count() <= max ) return ; |
455 | int count = 0; | 454 | int count = 0; |
456 | Address::List list; | 455 | Address::List list; |
457 | Address::List::Iterator it; | 456 | Address::List::Iterator it; |
458 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 457 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
459 | if ( count >= max ) | 458 | if ( count >= max ) |
460 | list.append( *it ); | 459 | list.append( *it ); |
461 | ++count; | 460 | ++count; |
462 | } | 461 | } |
463 | for( it = list.begin(); it != list.end(); ++it ) { | 462 | for( it = list.begin(); it != list.end(); ++it ) { |
464 | removeAddress( (*it) ); | 463 | removeAddress( (*it) ); |
465 | } | 464 | } |
466 | } | 465 | } |
467 | 466 | ||
468 | // removes all emails but the first | 467 | // removes all emails but the first |
469 | // needed by phone sync | 468 | // needed by phone sync |
470 | void Addressee::simplifyEmails() | 469 | void Addressee::simplifyEmails() |
471 | { | 470 | { |
472 | if ( mData->emails.count() == 0 ) return ; | 471 | if ( mData->emails.count() == 0 ) return ; |
473 | QString email = mData->emails.first(); | 472 | QString email = mData->emails.first(); |
474 | detach(); | 473 | detach(); |
475 | mData->emails.clear(); | 474 | mData->emails.clear(); |
476 | mData->emails.append( email ); | 475 | mData->emails.append( email ); |
477 | } | 476 | } |
478 | 477 | ||
479 | void Addressee::simplifyPhoneNumbers() | 478 | void Addressee::simplifyPhoneNumbers() |
480 | { | 479 | { |
480 | int max = 4; | ||
481 | int inList = mData->phoneNumbers.count(); | ||
481 | KABC::PhoneNumber::List removeNumbers; | 482 | KABC::PhoneNumber::List removeNumbers; |
482 | KABC::PhoneNumber::List::Iterator phoneIter; | 483 | KABC::PhoneNumber::List::Iterator phoneIter; |
484 | if ( inList > max ) { | ||
485 | // delete non-preferred numbers | ||
486 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | ||
487 | ++phoneIter ) { | ||
488 | if ( inList > max ) { | ||
489 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { | ||
490 | removeNumbers.append( ( *phoneIter ) ); | ||
491 | --inList; | ||
492 | } | ||
493 | } else | ||
494 | break; | ||
495 | } | ||
496 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | ||
497 | ++phoneIter ) { | ||
498 | removePhoneNumber(( *phoneIter )); | ||
499 | } | ||
500 | // delete preferred numbers | ||
501 | if ( inList > max ) { | ||
502 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | ||
503 | ++phoneIter ) { | ||
504 | if ( inList > max ) { | ||
505 | removeNumbers.append( ( *phoneIter ) ); | ||
506 | --inList; | ||
507 | } else | ||
508 | break; | ||
509 | } | ||
510 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | ||
511 | ++phoneIter ) { | ||
512 | removePhoneNumber(( *phoneIter )); | ||
513 | } | ||
514 | } | ||
515 | } | ||
516 | // remove non-numeric characters | ||
483 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 517 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
484 | ++phoneIter ) { | 518 | ++phoneIter ) { |
485 | if ( ! ( *phoneIter ).simplifyNumber() ) | 519 | if ( ! ( *phoneIter ).simplifyNumber() ) |
486 | removeNumbers.append( ( *phoneIter ) ); | 520 | removeNumbers.append( ( *phoneIter ) ); |
487 | } | 521 | } |
488 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 522 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
489 | ++phoneIter ) { | 523 | ++phoneIter ) { |
490 | removePhoneNumber(( *phoneIter )); | 524 | removePhoneNumber(( *phoneIter )); |
491 | } | 525 | } |
492 | } | 526 | } |
493 | void Addressee::simplifyPhoneNumberTypes() | 527 | void Addressee::simplifyPhoneNumberTypes() |
494 | { | 528 | { |
495 | KABC::PhoneNumber::List::Iterator phoneIter; | 529 | KABC::PhoneNumber::List::Iterator phoneIter; |
496 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 530 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
497 | ++phoneIter ) | 531 | ++phoneIter ) |
498 | ( *phoneIter ).simplifyType(); | 532 | ( *phoneIter ).simplifyType(); |
499 | } | 533 | } |
500 | void Addressee::removeID(const QString &prof) | 534 | void Addressee::removeID(const QString &prof) |
501 | { | 535 | { |
502 | detach(); | 536 | detach(); |
503 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 537 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
504 | 538 | ||
505 | } | 539 | } |
506 | void Addressee::setID( const QString & prof , const QString & id ) | 540 | void Addressee::setID( const QString & prof , const QString & id ) |
507 | { | 541 | { |
508 | detach(); | 542 | detach(); |
509 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 543 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
510 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 544 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
511 | } | 545 | } |
512 | void Addressee::setTempSyncStat( int id ) | 546 | void Addressee::setTempSyncStat( int id ) |
513 | { | 547 | { |
514 | if ( mData->mTempSyncStat == id ) return; | 548 | if ( mData->mTempSyncStat == id ) return; |
515 | detach(); | 549 | detach(); |
516 | mData->mTempSyncStat = id; | 550 | mData->mTempSyncStat = id; |
517 | } | 551 | } |
518 | int Addressee::tempSyncStat() const | 552 | int Addressee::tempSyncStat() const |
519 | { | 553 | { |
520 | return mData->mTempSyncStat; | 554 | return mData->mTempSyncStat; |
521 | } | 555 | } |
522 | 556 | ||
523 | QString Addressee::getID( const QString & prof) | 557 | QString Addressee::getID( const QString & prof) |
524 | { | 558 | { |
525 | return KIdManager::getId ( mData->mExternalId, prof ); | 559 | return KIdManager::getId ( mData->mExternalId, prof ); |
526 | } | 560 | } |
527 | 561 | ||
528 | void Addressee::setCsum( const QString & prof , const QString & id ) | 562 | void Addressee::setCsum( const QString & prof , const QString & id ) |
529 | { | 563 | { |
530 | detach(); | 564 | detach(); |
531 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 565 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
532 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 566 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
533 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 567 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
534 | } | 568 | } |
535 | 569 | ||
536 | QString Addressee::getCsum( const QString & prof) | 570 | QString Addressee::getCsum( const QString & prof) |
537 | { | 571 | { |
538 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 572 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
539 | } | 573 | } |
540 | 574 | ||
541 | void Addressee::setIDStr( const QString & s ) | 575 | void Addressee::setIDStr( const QString & s ) |
542 | { | 576 | { |
543 | detach(); | 577 | detach(); |
544 | mData->mExternalId = s; | 578 | mData->mExternalId = s; |
545 | } | 579 | } |
546 | 580 | ||
547 | QString Addressee::IDStr() const | 581 | QString Addressee::IDStr() const |
548 | { | 582 | { |
549 | return mData->mExternalId; | 583 | return mData->mExternalId; |
550 | } | 584 | } |
551 | 585 | ||
552 | void Addressee::setExternalUID( const QString &id ) | 586 | void Addressee::setExternalUID( const QString &id ) |
553 | { | 587 | { |
554 | if ( id == mData->externalUID ) return; | 588 | if ( id == mData->externalUID ) return; |
555 | detach(); | 589 | detach(); |
556 | mData->empty = false; | 590 | mData->empty = false; |
557 | mData->externalUID = id; | 591 | mData->externalUID = id; |
558 | } | 592 | } |
559 | 593 | ||
560 | QString Addressee::externalUID() const | 594 | QString Addressee::externalUID() const |
561 | { | 595 | { |
562 | return mData->externalUID; | 596 | return mData->externalUID; |
563 | } | 597 | } |
564 | void Addressee::setOriginalExternalUID( const QString &id ) | 598 | void Addressee::setOriginalExternalUID( const QString &id ) |
565 | { | 599 | { |
566 | if ( id == mData->originalExternalUID ) return; | 600 | if ( id == mData->originalExternalUID ) return; |
567 | detach(); | 601 | detach(); |
568 | mData->empty = false; | 602 | mData->empty = false; |
569 | //qDebug("*******Set orig uid %s ", id.latin1()); | 603 | //qDebug("*******Set orig uid %s ", id.latin1()); |
570 | mData->originalExternalUID = id; | 604 | mData->originalExternalUID = id; |
571 | } | 605 | } |
572 | 606 | ||
573 | QString Addressee::originalExternalUID() const | 607 | QString Addressee::originalExternalUID() const |
574 | { | 608 | { |
575 | return mData->originalExternalUID; | 609 | return mData->originalExternalUID; |
576 | } | 610 | } |
577 | 611 | ||
578 | void Addressee::setUid( const QString &id ) | 612 | void Addressee::setUid( const QString &id ) |
579 | { | 613 | { |
580 | if ( id == mData->uid ) return; | 614 | if ( id == mData->uid ) return; |
581 | detach(); | 615 | detach(); |
582 | //qDebug("****setuid %s ", id.latin1()); | 616 | //qDebug("****setuid %s ", id.latin1()); |
583 | mData->empty = false; | 617 | mData->empty = false; |
584 | mData->uid = id; | 618 | mData->uid = id; |
585 | } | 619 | } |
586 | 620 | ||
587 | QString Addressee::uid() const | 621 | QString Addressee::uid() const |
588 | { | 622 | { |
589 | if ( mData->uid.isEmpty() ) | 623 | if ( mData->uid.isEmpty() ) |
590 | mData->uid = KApplication::randomString( 10 ); | 624 | mData->uid = KApplication::randomString( 10 ); |
591 | 625 | ||
592 | return mData->uid; | 626 | return mData->uid; |
593 | } | 627 | } |
594 | 628 | ||
595 | QString Addressee::uidLabel() | 629 | QString Addressee::uidLabel() |
596 | { | 630 | { |
597 | return i18n("Unique Identifier"); | 631 | return i18n("Unique Identifier"); |
598 | } | 632 | } |
599 | 633 | ||
600 | void Addressee::setName( const QString &name ) | 634 | void Addressee::setName( const QString &name ) |
601 | { | 635 | { |
602 | if ( name == mData->name ) return; | 636 | if ( name == mData->name ) return; |
603 | detach(); | 637 | detach(); |
604 | mData->empty = false; | 638 | mData->empty = false; |
605 | mData->name = name; | 639 | mData->name = name; |
606 | } | 640 | } |
607 | 641 | ||
608 | QString Addressee::name() const | 642 | QString Addressee::name() const |
609 | { | 643 | { |
610 | return mData->name; | 644 | return mData->name; |
611 | } | 645 | } |
612 | 646 | ||
613 | QString Addressee::nameLabel() | 647 | QString Addressee::nameLabel() |
614 | { | 648 | { |
615 | return i18n("Name"); | 649 | return i18n("Name"); |
616 | } | 650 | } |
617 | 651 | ||
618 | 652 | ||
619 | void Addressee::setFormattedName( const QString &formattedName ) | 653 | void Addressee::setFormattedName( const QString &formattedName ) |
620 | { | 654 | { |
621 | if ( formattedName == mData->formattedName ) return; | 655 | if ( formattedName == mData->formattedName ) return; |
622 | detach(); | 656 | detach(); |
623 | mData->empty = false; | 657 | mData->empty = false; |
624 | mData->formattedName = formattedName; | 658 | mData->formattedName = formattedName; |
625 | } | 659 | } |
626 | 660 | ||
627 | QString Addressee::formattedName() const | 661 | QString Addressee::formattedName() const |
628 | { | 662 | { |
629 | return mData->formattedName; | 663 | return mData->formattedName; |
630 | } | 664 | } |
631 | 665 | ||
632 | QString Addressee::formattedNameLabel() | 666 | QString Addressee::formattedNameLabel() |
633 | { | 667 | { |
634 | return i18n("Formatted Name"); | 668 | return i18n("Formatted Name"); |
635 | } | 669 | } |
636 | 670 | ||
637 | 671 | ||
638 | void Addressee::setFamilyName( const QString &familyName ) | 672 | void Addressee::setFamilyName( const QString &familyName ) |
639 | { | 673 | { |
640 | if ( familyName == mData->familyName ) return; | 674 | if ( familyName == mData->familyName ) return; |
641 | detach(); | 675 | detach(); |
642 | mData->empty = false; | 676 | mData->empty = false; |
643 | mData->familyName = familyName; | 677 | mData->familyName = familyName; |
644 | } | 678 | } |
645 | 679 | ||
646 | QString Addressee::familyName() const | 680 | QString Addressee::familyName() const |
647 | { | 681 | { |
648 | return mData->familyName; | 682 | return mData->familyName; |
649 | } | 683 | } |
650 | 684 | ||
651 | QString Addressee::familyNameLabel() | 685 | QString Addressee::familyNameLabel() |
652 | { | 686 | { |
653 | return i18n("Family Name"); | 687 | return i18n("Family Name"); |
654 | } | 688 | } |
655 | 689 | ||
656 | 690 | ||
657 | void Addressee::setGivenName( const QString &givenName ) | 691 | void Addressee::setGivenName( const QString &givenName ) |
658 | { | 692 | { |
659 | if ( givenName == mData->givenName ) return; | 693 | if ( givenName == mData->givenName ) return; |
660 | detach(); | 694 | detach(); |
661 | mData->empty = false; | 695 | mData->empty = false; |
662 | mData->givenName = givenName; | 696 | mData->givenName = givenName; |
663 | } | 697 | } |
664 | 698 | ||
665 | QString Addressee::givenName() const | 699 | QString Addressee::givenName() const |
666 | { | 700 | { |
667 | return mData->givenName; | 701 | return mData->givenName; |
668 | } | 702 | } |
669 | 703 | ||
670 | QString Addressee::givenNameLabel() | 704 | QString Addressee::givenNameLabel() |
671 | { | 705 | { |
672 | return i18n("Given Name"); | 706 | return i18n("Given Name"); |
673 | } | 707 | } |
674 | 708 | ||
675 | 709 | ||
676 | void Addressee::setAdditionalName( const QString &additionalName ) | 710 | void Addressee::setAdditionalName( const QString &additionalName ) |
677 | { | 711 | { |
678 | if ( additionalName == mData->additionalName ) return; | 712 | if ( additionalName == mData->additionalName ) return; |
679 | detach(); | 713 | detach(); |
680 | mData->empty = false; | 714 | mData->empty = false; |
681 | mData->additionalName = additionalName; | 715 | mData->additionalName = additionalName; |
682 | } | 716 | } |
683 | 717 | ||
684 | QString Addressee::additionalName() const | 718 | QString Addressee::additionalName() const |
685 | { | 719 | { |
686 | return mData->additionalName; | 720 | return mData->additionalName; |
687 | } | 721 | } |
688 | 722 | ||
689 | QString Addressee::additionalNameLabel() | 723 | QString Addressee::additionalNameLabel() |
690 | { | 724 | { |
691 | return i18n("Additional Names"); | 725 | return i18n("Additional Names"); |
692 | } | 726 | } |
693 | 727 | ||
694 | 728 | ||
695 | void Addressee::setPrefix( const QString &prefix ) | 729 | void Addressee::setPrefix( const QString &prefix ) |
696 | { | 730 | { |
697 | if ( prefix == mData->prefix ) return; | 731 | if ( prefix == mData->prefix ) return; |
698 | detach(); | 732 | detach(); |
699 | mData->empty = false; | 733 | mData->empty = false; |
700 | mData->prefix = prefix; | 734 | mData->prefix = prefix; |
701 | } | 735 | } |
702 | 736 | ||
703 | QString Addressee::prefix() const | 737 | QString Addressee::prefix() const |
704 | { | 738 | { |
705 | return mData->prefix; | 739 | return mData->prefix; |
706 | } | 740 | } |
707 | 741 | ||
708 | QString Addressee::prefixLabel() | 742 | QString Addressee::prefixLabel() |
709 | { | 743 | { |
710 | return i18n("Honorific Prefixes"); | 744 | return i18n("Honorific Prefixes"); |
711 | } | 745 | } |
712 | 746 | ||
713 | 747 | ||
714 | void Addressee::setSuffix( const QString &suffix ) | 748 | void Addressee::setSuffix( const QString &suffix ) |
715 | { | 749 | { |
716 | if ( suffix == mData->suffix ) return; | 750 | if ( suffix == mData->suffix ) return; |
717 | detach(); | 751 | detach(); |
718 | mData->empty = false; | 752 | mData->empty = false; |
719 | mData->suffix = suffix; | 753 | mData->suffix = suffix; |
720 | } | 754 | } |
721 | 755 | ||
722 | QString Addressee::suffix() const | 756 | QString Addressee::suffix() const |
723 | { | 757 | { |
724 | return mData->suffix; | 758 | return mData->suffix; |
725 | } | 759 | } |
726 | 760 | ||
727 | QString Addressee::suffixLabel() | 761 | QString Addressee::suffixLabel() |
728 | { | 762 | { |
729 | return i18n("Honorific Suffixes"); | 763 | return i18n("Honorific Suffixes"); |
730 | } | 764 | } |
731 | 765 | ||
732 | 766 | ||
733 | void Addressee::setNickName( const QString &nickName ) | 767 | void Addressee::setNickName( const QString &nickName ) |
734 | { | 768 | { |
735 | if ( nickName == mData->nickName ) return; | 769 | if ( nickName == mData->nickName ) return; |
736 | detach(); | 770 | detach(); |
737 | mData->empty = false; | 771 | mData->empty = false; |
738 | mData->nickName = nickName; | 772 | mData->nickName = nickName; |
739 | } | 773 | } |
740 | 774 | ||
741 | QString Addressee::nickName() const | 775 | QString Addressee::nickName() const |
742 | { | 776 | { |
743 | return mData->nickName; | 777 | return mData->nickName; |
744 | } | 778 | } |
745 | 779 | ||
746 | QString Addressee::nickNameLabel() | 780 | QString Addressee::nickNameLabel() |
747 | { | 781 | { |
748 | return i18n("Nick Name"); | 782 | return i18n("Nick Name"); |
749 | } | 783 | } |
750 | 784 | ||
751 | 785 | ||
752 | void Addressee::setBirthday( const QDateTime &birthday ) | 786 | void Addressee::setBirthday( const QDateTime &birthday ) |
753 | { | 787 | { |
754 | if ( birthday == mData->birthday ) return; | 788 | if ( birthday == mData->birthday ) return; |
755 | detach(); | 789 | detach(); |
756 | mData->empty = false; | 790 | mData->empty = false; |
757 | mData->birthday = birthday; | 791 | mData->birthday = birthday; |
758 | } | 792 | } |
759 | 793 | ||
760 | QDateTime Addressee::birthday() const | 794 | QDateTime Addressee::birthday() const |
761 | { | 795 | { |
762 | return mData->birthday; | 796 | return mData->birthday; |
763 | } | 797 | } |
764 | 798 | ||
765 | QString Addressee::birthdayLabel() | 799 | QString Addressee::birthdayLabel() |
766 | { | 800 | { |
767 | return i18n("Birthday"); | 801 | return i18n("Birthday"); |
768 | } | 802 | } |
769 | 803 | ||
770 | 804 | ||
771 | QString Addressee::homeAddressStreetLabel() | 805 | QString Addressee::homeAddressStreetLabel() |
772 | { | 806 | { |
773 | return i18n("Home Address Street"); | 807 | return i18n("Home Address Street"); |
774 | } | 808 | } |
775 | 809 | ||
776 | 810 | ||
777 | QString Addressee::homeAddressLocalityLabel() | 811 | QString Addressee::homeAddressLocalityLabel() |
778 | { | 812 | { |
779 | return i18n("Home Address Locality"); | 813 | return i18n("Home Address Locality"); |
780 | } | 814 | } |
781 | 815 | ||
782 | 816 | ||
783 | QString Addressee::homeAddressRegionLabel() | 817 | QString Addressee::homeAddressRegionLabel() |
784 | { | 818 | { |
785 | return i18n("Home Address Region"); | 819 | return i18n("Home Address Region"); |
786 | } | 820 | } |
787 | 821 | ||
788 | 822 | ||
789 | QString Addressee::homeAddressPostalCodeLabel() | 823 | QString Addressee::homeAddressPostalCodeLabel() |
790 | { | 824 | { |
791 | return i18n("Home Address Postal Code"); | 825 | return i18n("Home Address Postal Code"); |
792 | } | 826 | } |
793 | 827 | ||
794 | 828 | ||
795 | QString Addressee::homeAddressCountryLabel() | 829 | QString Addressee::homeAddressCountryLabel() |
796 | { | 830 | { |
797 | return i18n("Home Address Country"); | 831 | return i18n("Home Address Country"); |
798 | } | 832 | } |
799 | 833 | ||
800 | 834 | ||
801 | QString Addressee::homeAddressLabelLabel() | 835 | QString Addressee::homeAddressLabelLabel() |
802 | { | 836 | { |
803 | return i18n("Home Address Label"); | 837 | return i18n("Home Address Label"); |
804 | } | 838 | } |
805 | 839 | ||
806 | 840 | ||
807 | QString Addressee::businessAddressStreetLabel() | 841 | QString Addressee::businessAddressStreetLabel() |
808 | { | 842 | { |
809 | return i18n("Business Address Street"); | 843 | return i18n("Business Address Street"); |
810 | } | 844 | } |
811 | 845 | ||
812 | 846 | ||
813 | QString Addressee::businessAddressLocalityLabel() | 847 | QString Addressee::businessAddressLocalityLabel() |
814 | { | 848 | { |
815 | return i18n("Business Address Locality"); | 849 | return i18n("Business Address Locality"); |
816 | } | 850 | } |
817 | 851 | ||
818 | 852 | ||
819 | QString Addressee::businessAddressRegionLabel() | 853 | QString Addressee::businessAddressRegionLabel() |
820 | { | 854 | { |
821 | return i18n("Business Address Region"); | 855 | return i18n("Business Address Region"); |
822 | } | 856 | } |
823 | 857 | ||
824 | 858 | ||
825 | QString Addressee::businessAddressPostalCodeLabel() | 859 | QString Addressee::businessAddressPostalCodeLabel() |
826 | { | 860 | { |
827 | return i18n("Business Address Postal Code"); | 861 | return i18n("Business Address Postal Code"); |
828 | } | 862 | } |
829 | 863 | ||
830 | 864 | ||
831 | QString Addressee::businessAddressCountryLabel() | 865 | QString Addressee::businessAddressCountryLabel() |
832 | { | 866 | { |
833 | return i18n("Business Address Country"); | 867 | return i18n("Business Address Country"); |
834 | } | 868 | } |
835 | 869 | ||
836 | 870 | ||
837 | QString Addressee::businessAddressLabelLabel() | 871 | QString Addressee::businessAddressLabelLabel() |
838 | { | 872 | { |
839 | return i18n("Business Address Label"); | 873 | return i18n("Business Address Label"); |
840 | } | 874 | } |
841 | 875 | ||
842 | 876 | ||
843 | QString Addressee::homePhoneLabel() | 877 | QString Addressee::homePhoneLabel() |
844 | { | 878 | { |
845 | return i18n("Home Phone"); | 879 | return i18n("Home Phone"); |
846 | } | 880 | } |
847 | 881 | ||
848 | 882 | ||
849 | QString Addressee::businessPhoneLabel() | 883 | QString Addressee::businessPhoneLabel() |
850 | { | 884 | { |
851 | return i18n("Business Phone"); | 885 | return i18n("Business Phone"); |
852 | } | 886 | } |
853 | 887 | ||
854 | 888 | ||
855 | QString Addressee::mobilePhoneLabel() | 889 | QString Addressee::mobilePhoneLabel() |
856 | { | 890 | { |
857 | return i18n("Mobile Phone"); | 891 | return i18n("Mobile Phone"); |
858 | } | 892 | } |
859 | 893 | ||
860 | 894 | ||
861 | QString Addressee::homeFaxLabel() | 895 | QString Addressee::homeFaxLabel() |
862 | { | 896 | { |
863 | return i18n("Home Fax"); | 897 | return i18n("Home Fax"); |
864 | } | 898 | } |
865 | 899 | ||
866 | 900 | ||
diff --git a/kabc/addressee.h b/kabc/addressee.h index e7900c6..2c81c1a 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -1,503 +1,503 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #ifndef KABC_ADDRESSEE_H | 29 | #ifndef KABC_ADDRESSEE_H |
30 | #define KABC_ADDRESSEE_H | 30 | #define KABC_ADDRESSEE_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <qvaluelist.h> | 35 | #include <qvaluelist.h> |
36 | 36 | ||
37 | #include <ksharedptr.h> | 37 | #include <ksharedptr.h> |
38 | #include <kurl.h> | 38 | #include <kurl.h> |
39 | 39 | ||
40 | #include "address.h" | 40 | #include "address.h" |
41 | #include "agent.h" | 41 | #include "agent.h" |
42 | #include "geo.h" | 42 | #include "geo.h" |
43 | #include "key.h" | 43 | #include "key.h" |
44 | #include "phonenumber.h" | 44 | #include "phonenumber.h" |
45 | #include "picture.h" | 45 | #include "picture.h" |
46 | #include "secrecy.h" | 46 | #include "secrecy.h" |
47 | #include "sound.h" | 47 | #include "sound.h" |
48 | #include "timezone.h" | 48 | #include "timezone.h" |
49 | 49 | ||
50 | namespace KABC { | 50 | namespace KABC { |
51 | 51 | ||
52 | class Resource; | 52 | class Resource; |
53 | 53 | ||
54 | /** | 54 | /** |
55 | @short address book entry | 55 | @short address book entry |
56 | 56 | ||
57 | This class represents an entry in the address book. | 57 | This class represents an entry in the address book. |
58 | 58 | ||
59 | The data of this class is implicitly shared. You can pass this class by value. | 59 | The data of this class is implicitly shared. You can pass this class by value. |
60 | 60 | ||
61 | If you need the name of a field for presenting it to the user you should use | 61 | If you need the name of a field for presenting it to the user you should use |
62 | the functions ending in Label(). They return a translated string which can be | 62 | the functions ending in Label(). They return a translated string which can be |
63 | used as label for the corresponding field. | 63 | used as label for the corresponding field. |
64 | 64 | ||
65 | About the name fields: | 65 | About the name fields: |
66 | 66 | ||
67 | givenName() is the first name and familyName() the last name. In some | 67 | givenName() is the first name and familyName() the last name. In some |
68 | countries the family name comes first, that's the reason for the | 68 | countries the family name comes first, that's the reason for the |
69 | naming. formattedName() is the full name with the correct formatting. | 69 | naming. formattedName() is the full name with the correct formatting. |
70 | It is used as an override, when the correct formatting can't be generated | 70 | It is used as an override, when the correct formatting can't be generated |
71 | from the other name fields automatically. | 71 | from the other name fields automatically. |
72 | 72 | ||
73 | realName() returns a fully formatted name(). It uses formattedName, if set, | 73 | realName() returns a fully formatted name(). It uses formattedName, if set, |
74 | otherwise it constucts the name from the name fields. As fallback, if | 74 | otherwise it constucts the name from the name fields. As fallback, if |
75 | nothing else is set it uses name(). | 75 | nothing else is set it uses name(). |
76 | 76 | ||
77 | name() is the NAME type of RFC2426. It can be used as internal name for the | 77 | name() is the NAME type of RFC2426. It can be used as internal name for the |
78 | data enty, but shouldn't be used for displaying the data to the user. | 78 | data enty, but shouldn't be used for displaying the data to the user. |
79 | */ | 79 | */ |
80 | class Addressee | 80 | class Addressee |
81 | { | 81 | { |
82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 82 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 83 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
84 | 84 | ||
85 | public: | 85 | public: |
86 | typedef QValueList<Addressee> List; | 86 | typedef QValueList<Addressee> List; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Construct an empty address book entry. | 89 | Construct an empty address book entry. |
90 | */ | 90 | */ |
91 | Addressee(); | 91 | Addressee(); |
92 | ~Addressee(); | 92 | ~Addressee(); |
93 | 93 | ||
94 | Addressee( const Addressee & ); | 94 | Addressee( const Addressee & ); |
95 | Addressee &operator=( const Addressee & ); | 95 | Addressee &operator=( const Addressee & ); |
96 | 96 | ||
97 | bool operator==( const Addressee & ) const; | 97 | bool operator==( const Addressee & ) const; |
98 | bool operator!=( const Addressee & ) const; | 98 | bool operator!=( const Addressee & ) const; |
99 | // sync stuff | 99 | // sync stuff |
100 | void setTempSyncStat(int id); | 100 | void setTempSyncStat(int id); |
101 | int tempSyncStat() const; | 101 | int tempSyncStat() const; |
102 | void setIDStr( const QString & ); | 102 | void setIDStr( const QString & ); |
103 | QString IDStr() const; | 103 | QString IDStr() const; |
104 | void setID( const QString &, const QString & ); | 104 | void setID( const QString &, const QString & ); |
105 | QString getID( const QString & ); | 105 | QString getID( const QString & ); |
106 | void setCsum( const QString &, const QString & ); | 106 | void setCsum( const QString &, const QString & ); |
107 | QString getCsum( const QString & ); | 107 | QString getCsum( const QString & ); |
108 | void removeID(const QString &); | 108 | void removeID(const QString &); |
109 | void computeCsum(const QString &dev); | 109 | void computeCsum(const QString &dev); |
110 | ulong getCsum4List( const QStringList & attList); | 110 | ulong getCsum4List( const QStringList & attList); |
111 | /** | 111 | /** |
112 | Return, if the address book entry is empty. | 112 | Return, if the address book entry is empty. |
113 | */ | 113 | */ |
114 | bool isEmpty() const; | 114 | bool isEmpty() const; |
115 | void setExternalUID( const QString &id ); | 115 | void setExternalUID( const QString &id ); |
116 | QString externalUID() const; | 116 | QString externalUID() const; |
117 | void setOriginalExternalUID( const QString &id ); | 117 | void setOriginalExternalUID( const QString &id ); |
118 | QString originalExternalUID() const; | 118 | QString originalExternalUID() const; |
119 | void mergeContact( const Addressee& ad, bool isSubSet = false ); | 119 | void mergeContact( const Addressee& ad, bool isSubSet ); |
120 | void simplifyEmails(); | 120 | void simplifyEmails(); |
121 | void simplifyAddresses(); | 121 | void simplifyAddresses(); |
122 | void simplifyPhoneNumbers(); | 122 | void simplifyPhoneNumbers(); |
123 | void simplifyPhoneNumberTypes(); | 123 | void simplifyPhoneNumberTypes(); |
124 | bool removeVoice(); | 124 | bool removeVoice(); |
125 | bool containsAdr(const Addressee& addr ); | 125 | bool containsAdr(const Addressee& addr ); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | Set unique identifier. | 128 | Set unique identifier. |
129 | */ | 129 | */ |
130 | void setUid( const QString &uid ); | 130 | void setUid( const QString &uid ); |
131 | /** | 131 | /** |
132 | Return unique identifier. | 132 | Return unique identifier. |
133 | */ | 133 | */ |
134 | QString uid() const; | 134 | QString uid() const; |
135 | /** | 135 | /** |
136 | Return translated label for uid field. | 136 | Return translated label for uid field. |
137 | */ | 137 | */ |
138 | static QString uidLabel(); | 138 | static QString uidLabel(); |
139 | 139 | ||
140 | /** | 140 | /** |
141 | Set name. | 141 | Set name. |
142 | */ | 142 | */ |
143 | void setName( const QString &name ); | 143 | void setName( const QString &name ); |
144 | /** | 144 | /** |
145 | Return name. | 145 | Return name. |
146 | */ | 146 | */ |
147 | QString name() const; | 147 | QString name() const; |
148 | /** | 148 | /** |
149 | Return translated label for name field. | 149 | Return translated label for name field. |
150 | */ | 150 | */ |
151 | static QString nameLabel(); | 151 | static QString nameLabel(); |
152 | 152 | ||
153 | /** | 153 | /** |
154 | Set formatted name. | 154 | Set formatted name. |
155 | */ | 155 | */ |
156 | void setFormattedName( const QString &formattedName ); | 156 | void setFormattedName( const QString &formattedName ); |
157 | /** | 157 | /** |
158 | Return formatted name. | 158 | Return formatted name. |
159 | */ | 159 | */ |
160 | QString formattedName() const; | 160 | QString formattedName() const; |
161 | /** | 161 | /** |
162 | Return translated label for formattedName field. | 162 | Return translated label for formattedName field. |
163 | */ | 163 | */ |
164 | static QString formattedNameLabel(); | 164 | static QString formattedNameLabel(); |
165 | 165 | ||
166 | /** | 166 | /** |
167 | Set family name. | 167 | Set family name. |
168 | */ | 168 | */ |
169 | void setFamilyName( const QString &familyName ); | 169 | void setFamilyName( const QString &familyName ); |
170 | /** | 170 | /** |
171 | Return family name. | 171 | Return family name. |
172 | */ | 172 | */ |
173 | QString familyName() const; | 173 | QString familyName() const; |
174 | /** | 174 | /** |
175 | Return translated label for familyName field. | 175 | Return translated label for familyName field. |
176 | */ | 176 | */ |
177 | static QString familyNameLabel(); | 177 | static QString familyNameLabel(); |
178 | 178 | ||
179 | /** | 179 | /** |
180 | Set given name. | 180 | Set given name. |
181 | */ | 181 | */ |
182 | void setGivenName( const QString &givenName ); | 182 | void setGivenName( const QString &givenName ); |
183 | /** | 183 | /** |
184 | Return given name. | 184 | Return given name. |
185 | */ | 185 | */ |
186 | QString givenName() const; | 186 | QString givenName() const; |
187 | /** | 187 | /** |
188 | Return translated label for givenName field. | 188 | Return translated label for givenName field. |
189 | */ | 189 | */ |
190 | static QString givenNameLabel(); | 190 | static QString givenNameLabel(); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | Set additional names. | 193 | Set additional names. |
194 | */ | 194 | */ |
195 | void setAdditionalName( const QString &additionalName ); | 195 | void setAdditionalName( const QString &additionalName ); |
196 | /** | 196 | /** |
197 | Return additional names. | 197 | Return additional names. |
198 | */ | 198 | */ |
199 | QString additionalName() const; | 199 | QString additionalName() const; |
200 | /** | 200 | /** |
201 | Return translated label for additionalName field. | 201 | Return translated label for additionalName field. |
202 | */ | 202 | */ |
203 | static QString additionalNameLabel(); | 203 | static QString additionalNameLabel(); |
204 | 204 | ||
205 | /** | 205 | /** |
206 | Set honorific prefixes. | 206 | Set honorific prefixes. |
207 | */ | 207 | */ |
208 | void setPrefix( const QString &prefix ); | 208 | void setPrefix( const QString &prefix ); |
209 | /** | 209 | /** |
210 | Return honorific prefixes. | 210 | Return honorific prefixes. |
211 | */ | 211 | */ |
212 | QString prefix() const; | 212 | QString prefix() const; |
213 | /** | 213 | /** |
214 | Return translated label for prefix field. | 214 | Return translated label for prefix field. |
215 | */ | 215 | */ |
216 | static QString prefixLabel(); | 216 | static QString prefixLabel(); |
217 | 217 | ||
218 | /** | 218 | /** |
219 | Set honorific suffixes. | 219 | Set honorific suffixes. |
220 | */ | 220 | */ |
221 | void setSuffix( const QString &suffix ); | 221 | void setSuffix( const QString &suffix ); |
222 | /** | 222 | /** |
223 | Return honorific suffixes. | 223 | Return honorific suffixes. |
224 | */ | 224 | */ |
225 | QString suffix() const; | 225 | QString suffix() const; |
226 | /** | 226 | /** |
227 | Return translated label for suffix field. | 227 | Return translated label for suffix field. |
228 | */ | 228 | */ |
229 | static QString suffixLabel(); | 229 | static QString suffixLabel(); |
230 | 230 | ||
231 | /** | 231 | /** |
232 | Set nick name. | 232 | Set nick name. |
233 | */ | 233 | */ |
234 | void setNickName( const QString &nickName ); | 234 | void setNickName( const QString &nickName ); |
235 | /** | 235 | /** |
236 | Return nick name. | 236 | Return nick name. |
237 | */ | 237 | */ |
238 | QString nickName() const; | 238 | QString nickName() const; |
239 | /** | 239 | /** |
240 | Return translated label for nickName field. | 240 | Return translated label for nickName field. |
241 | */ | 241 | */ |
242 | static QString nickNameLabel(); | 242 | static QString nickNameLabel(); |
243 | 243 | ||
244 | /** | 244 | /** |
245 | Set birthday. | 245 | Set birthday. |
246 | */ | 246 | */ |
247 | void setBirthday( const QDateTime &birthday ); | 247 | void setBirthday( const QDateTime &birthday ); |
248 | /** | 248 | /** |
249 | Return birthday. | 249 | Return birthday. |
250 | */ | 250 | */ |
251 | QDateTime birthday() const; | 251 | QDateTime birthday() const; |
252 | /** | 252 | /** |
253 | Return translated label for birthday field. | 253 | Return translated label for birthday field. |
254 | */ | 254 | */ |
255 | static QString birthdayLabel(); | 255 | static QString birthdayLabel(); |
256 | 256 | ||
257 | /** | 257 | /** |
258 | Return translated label for homeAddressStreet field. | 258 | Return translated label for homeAddressStreet field. |
259 | */ | 259 | */ |
260 | static QString homeAddressStreetLabel(); | 260 | static QString homeAddressStreetLabel(); |
261 | 261 | ||
262 | /** | 262 | /** |
263 | Return translated label for homeAddressLocality field. | 263 | Return translated label for homeAddressLocality field. |
264 | */ | 264 | */ |
265 | static QString homeAddressLocalityLabel(); | 265 | static QString homeAddressLocalityLabel(); |
266 | 266 | ||
267 | /** | 267 | /** |
268 | Return translated label for homeAddressRegion field. | 268 | Return translated label for homeAddressRegion field. |
269 | */ | 269 | */ |
270 | static QString homeAddressRegionLabel(); | 270 | static QString homeAddressRegionLabel(); |
271 | 271 | ||
272 | /** | 272 | /** |
273 | Return translated label for homeAddressPostalCode field. | 273 | Return translated label for homeAddressPostalCode field. |
274 | */ | 274 | */ |
275 | static QString homeAddressPostalCodeLabel(); | 275 | static QString homeAddressPostalCodeLabel(); |
276 | 276 | ||
277 | /** | 277 | /** |
278 | Return translated label for homeAddressCountry field. | 278 | Return translated label for homeAddressCountry field. |
279 | */ | 279 | */ |
280 | static QString homeAddressCountryLabel(); | 280 | static QString homeAddressCountryLabel(); |
281 | 281 | ||
282 | /** | 282 | /** |
283 | Return translated label for homeAddressLabel field. | 283 | Return translated label for homeAddressLabel field. |
284 | */ | 284 | */ |
285 | static QString homeAddressLabelLabel(); | 285 | static QString homeAddressLabelLabel(); |
286 | 286 | ||
287 | /** | 287 | /** |
288 | Return translated label for businessAddressStreet field. | 288 | Return translated label for businessAddressStreet field. |
289 | */ | 289 | */ |
290 | static QString businessAddressStreetLabel(); | 290 | static QString businessAddressStreetLabel(); |
291 | 291 | ||
292 | /** | 292 | /** |
293 | Return translated label for businessAddressLocality field. | 293 | Return translated label for businessAddressLocality field. |
294 | */ | 294 | */ |
295 | static QString businessAddressLocalityLabel(); | 295 | static QString businessAddressLocalityLabel(); |
296 | 296 | ||
297 | /** | 297 | /** |
298 | Return translated label for businessAddressRegion field. | 298 | Return translated label for businessAddressRegion field. |
299 | */ | 299 | */ |
300 | static QString businessAddressRegionLabel(); | 300 | static QString businessAddressRegionLabel(); |
301 | 301 | ||
302 | /** | 302 | /** |
303 | Return translated label for businessAddressPostalCode field. | 303 | Return translated label for businessAddressPostalCode field. |
304 | */ | 304 | */ |
305 | static QString businessAddressPostalCodeLabel(); | 305 | static QString businessAddressPostalCodeLabel(); |
306 | 306 | ||
307 | /** | 307 | /** |
308 | Return translated label for businessAddressCountry field. | 308 | Return translated label for businessAddressCountry field. |
309 | */ | 309 | */ |
310 | static QString businessAddressCountryLabel(); | 310 | static QString businessAddressCountryLabel(); |
311 | 311 | ||
312 | /** | 312 | /** |
313 | Return translated label for businessAddressLabel field. | 313 | Return translated label for businessAddressLabel field. |
314 | */ | 314 | */ |
315 | static QString businessAddressLabelLabel(); | 315 | static QString businessAddressLabelLabel(); |
316 | 316 | ||
317 | /** | 317 | /** |
318 | Return translated label for homePhone field. | 318 | Return translated label for homePhone field. |
319 | */ | 319 | */ |
320 | static QString homePhoneLabel(); | 320 | static QString homePhoneLabel(); |
321 | 321 | ||
322 | /** | 322 | /** |
323 | Return translated label for businessPhone field. | 323 | Return translated label for businessPhone field. |
324 | */ | 324 | */ |
325 | static QString businessPhoneLabel(); | 325 | static QString businessPhoneLabel(); |
326 | 326 | ||
327 | /** | 327 | /** |
328 | Return translated label for mobilePhone field. | 328 | Return translated label for mobilePhone field. |
329 | */ | 329 | */ |
330 | static QString mobilePhoneLabel(); | 330 | static QString mobilePhoneLabel(); |
331 | 331 | ||
332 | /** | 332 | /** |
333 | Return translated label for homeFax field. | 333 | Return translated label for homeFax field. |
334 | */ | 334 | */ |
335 | static QString homeFaxLabel(); | 335 | static QString homeFaxLabel(); |
336 | 336 | ||
337 | /** | 337 | /** |
338 | Return translated label for businessFax field. | 338 | Return translated label for businessFax field. |
339 | */ | 339 | */ |
340 | static QString businessFaxLabel(); | 340 | static QString businessFaxLabel(); |
341 | 341 | ||
342 | /** | 342 | /** |
343 | Return translated label for carPhone field. | 343 | Return translated label for carPhone field. |
344 | */ | 344 | */ |
345 | static QString carPhoneLabel(); | 345 | static QString carPhoneLabel(); |
346 | 346 | ||
347 | /** | 347 | /** |
348 | Return translated label for isdn field. | 348 | Return translated label for isdn field. |
349 | */ | 349 | */ |
350 | static QString isdnLabel(); | 350 | static QString isdnLabel(); |
351 | 351 | ||
352 | /** | 352 | /** |
353 | Return translated label for pager field. | 353 | Return translated label for pager field. |
354 | */ | 354 | */ |
355 | static QString pagerLabel(); | 355 | static QString pagerLabel(); |
356 | 356 | ||
357 | /** | 357 | /** |
358 | Return translated label for sip field. | 358 | Return translated label for sip field. |
359 | */ | 359 | */ |
360 | static QString sipLabel(); | 360 | static QString sipLabel(); |
361 | 361 | ||
362 | /** | 362 | /** |
363 | Return translated label for email field. | 363 | Return translated label for email field. |
364 | */ | 364 | */ |
365 | static QString emailLabel(); | 365 | static QString emailLabel(); |
366 | 366 | ||
367 | /** | 367 | /** |
368 | Set mail client. | 368 | Set mail client. |
369 | */ | 369 | */ |
370 | void setMailer( const QString &mailer ); | 370 | void setMailer( const QString &mailer ); |
371 | /** | 371 | /** |
372 | Return mail client. | 372 | Return mail client. |
373 | */ | 373 | */ |
374 | QString mailer() const; | 374 | QString mailer() const; |
375 | /** | 375 | /** |
376 | Return translated label for mailer field. | 376 | Return translated label for mailer field. |
377 | */ | 377 | */ |
378 | static QString mailerLabel(); | 378 | static QString mailerLabel(); |
379 | 379 | ||
380 | /** | 380 | /** |
381 | Set time zone. | 381 | Set time zone. |
382 | */ | 382 | */ |
383 | void setTimeZone( const TimeZone &timeZone ); | 383 | void setTimeZone( const TimeZone &timeZone ); |
384 | /** | 384 | /** |
385 | Return time zone. | 385 | Return time zone. |
386 | */ | 386 | */ |
387 | TimeZone timeZone() const; | 387 | TimeZone timeZone() const; |
388 | /** | 388 | /** |
389 | Return translated label for timeZone field. | 389 | Return translated label for timeZone field. |
390 | */ | 390 | */ |
391 | static QString timeZoneLabel(); | 391 | static QString timeZoneLabel(); |
392 | 392 | ||
393 | /** | 393 | /** |
394 | Set geographic position. | 394 | Set geographic position. |
395 | */ | 395 | */ |
396 | void setGeo( const Geo &geo ); | 396 | void setGeo( const Geo &geo ); |
397 | /** | 397 | /** |
398 | Return geographic position. | 398 | Return geographic position. |
399 | */ | 399 | */ |
400 | Geo geo() const; | 400 | Geo geo() const; |
401 | /** | 401 | /** |
402 | Return translated label for geo field. | 402 | Return translated label for geo field. |
403 | */ | 403 | */ |
404 | static QString geoLabel(); | 404 | static QString geoLabel(); |
405 | 405 | ||
406 | /** | 406 | /** |
407 | Set title. | 407 | Set title. |
408 | */ | 408 | */ |
409 | void setTitle( const QString &title ); | 409 | void setTitle( const QString &title ); |
410 | /** | 410 | /** |
411 | Return title. | 411 | Return title. |
412 | */ | 412 | */ |
413 | QString title() const; | 413 | QString title() const; |
414 | /** | 414 | /** |
415 | Return translated label for title field. | 415 | Return translated label for title field. |
416 | */ | 416 | */ |
417 | static QString titleLabel(); | 417 | static QString titleLabel(); |
418 | 418 | ||
419 | /** | 419 | /** |
420 | Set role. | 420 | Set role. |
421 | */ | 421 | */ |
422 | void setRole( const QString &role ); | 422 | void setRole( const QString &role ); |
423 | /** | 423 | /** |
424 | Return role. | 424 | Return role. |
425 | */ | 425 | */ |
426 | QString role() const; | 426 | QString role() const; |
427 | /** | 427 | /** |
428 | Return translated label for role field. | 428 | Return translated label for role field. |
429 | */ | 429 | */ |
430 | static QString roleLabel(); | 430 | static QString roleLabel(); |
431 | 431 | ||
432 | /** | 432 | /** |
433 | Set organization. | 433 | Set organization. |
434 | */ | 434 | */ |
435 | void setOrganization( const QString &organization ); | 435 | void setOrganization( const QString &organization ); |
436 | /** | 436 | /** |
437 | Return organization. | 437 | Return organization. |
438 | */ | 438 | */ |
439 | QString organization() const; | 439 | QString organization() const; |
440 | /** | 440 | /** |
441 | Return translated label for organization field. | 441 | Return translated label for organization field. |
442 | */ | 442 | */ |
443 | static QString organizationLabel(); | 443 | static QString organizationLabel(); |
444 | 444 | ||
445 | /** | 445 | /** |
446 | Set note. | 446 | Set note. |
447 | */ | 447 | */ |
448 | void setNote( const QString ¬e ); | 448 | void setNote( const QString ¬e ); |
449 | /** | 449 | /** |
450 | Return note. | 450 | Return note. |
451 | */ | 451 | */ |
452 | QString note() const; | 452 | QString note() const; |
453 | /** | 453 | /** |
454 | Return translated label for note field. | 454 | Return translated label for note field. |
455 | */ | 455 | */ |
456 | static QString noteLabel(); | 456 | static QString noteLabel(); |
457 | 457 | ||
458 | /** | 458 | /** |
459 | Set product identifier. | 459 | Set product identifier. |
460 | */ | 460 | */ |
461 | void setProductId( const QString &productId ); | 461 | void setProductId( const QString &productId ); |
462 | /** | 462 | /** |
463 | Return product identifier. | 463 | Return product identifier. |
464 | */ | 464 | */ |
465 | QString productId() const; | 465 | QString productId() const; |
466 | /** | 466 | /** |
467 | Return translated label for productId field. | 467 | Return translated label for productId field. |
468 | */ | 468 | */ |
469 | static QString productIdLabel(); | 469 | static QString productIdLabel(); |
470 | 470 | ||
471 | /** | 471 | /** |
472 | Set revision date. | 472 | Set revision date. |
473 | */ | 473 | */ |
474 | void setRevision( const QDateTime &revision ); | 474 | void setRevision( const QDateTime &revision ); |
475 | /** | 475 | /** |
476 | Return revision date. | 476 | Return revision date. |
477 | */ | 477 | */ |
478 | QDateTime revision() const; | 478 | QDateTime revision() const; |
479 | /** | 479 | /** |
480 | Return translated label for revision field. | 480 | Return translated label for revision field. |
481 | */ | 481 | */ |
482 | static QString revisionLabel(); | 482 | static QString revisionLabel(); |
483 | 483 | ||
484 | /** | 484 | /** |
485 | Set sort string. | 485 | Set sort string. |
486 | */ | 486 | */ |
487 | void setSortString( const QString &sortString ); | 487 | void setSortString( const QString &sortString ); |
488 | /** | 488 | /** |
489 | Return sort string. | 489 | Return sort string. |
490 | */ | 490 | */ |
491 | QString sortString() const; | 491 | QString sortString() const; |
492 | /** | 492 | /** |
493 | Return translated label for sortString field. | 493 | Return translated label for sortString field. |
494 | */ | 494 | */ |
495 | static QString sortStringLabel(); | 495 | static QString sortStringLabel(); |
496 | 496 | ||
497 | /** | 497 | /** |
498 | Set URL. | 498 | Set URL. |
499 | */ | 499 | */ |
500 | void setUrl( const KURL &url ); | 500 | void setUrl( const KURL &url ); |
501 | /** | 501 | /** |
502 | Return URL. | 502 | Return URL. |
503 | */ | 503 | */ |