-rw-r--r-- | kabc/addressbook.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index ad0f702..19c26eb 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -603,83 +603,84 @@ 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("readonly." ); | 635 | qDebug("resource is readonly." ); |
636 | if ( (*it)->isOpen() ) | 636 | if ( (*it)->isOpen() ) |
637 | qDebug("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 | if ( ! ticket->resource()->save( ticket ) ) | 651 | if ( ! ticket->resource()->save( ticket ) ) |
651 | ok = false; | 652 | ok = false; |
652 | else | 653 | else |
653 | qDebug("StdAddressBook::saved '%s'", ticket->resource()->resourceName().latin1() ); | 654 | qDebug("StdAddressBook::resource saved '%s'", name.latin1() ); |
654 | 655 | ||
655 | } else | 656 | } else |
656 | ok = false; | 657 | ok = false; |
657 | 658 | ||
658 | } | 659 | } |
659 | } | 660 | } |
660 | return ok; | 661 | return ok; |
661 | } | 662 | } |
662 | 663 | ||
663 | AddressBook::Iterator AddressBook::begin() | 664 | AddressBook::Iterator AddressBook::begin() |
664 | { | 665 | { |
665 | Iterator it = Iterator(); | 666 | Iterator it = Iterator(); |
666 | it.d->mIt = d->mAddressees.begin(); | 667 | it.d->mIt = d->mAddressees.begin(); |
667 | return it; | 668 | return it; |
668 | } | 669 | } |
669 | 670 | ||
670 | AddressBook::ConstIterator AddressBook::begin() const | 671 | AddressBook::ConstIterator AddressBook::begin() const |
671 | { | 672 | { |
672 | ConstIterator it = ConstIterator(); | 673 | ConstIterator it = ConstIterator(); |
673 | it.d->mIt = d->mAddressees.begin(); | 674 | it.d->mIt = d->mAddressees.begin(); |
674 | return it; | 675 | return it; |
675 | } | 676 | } |
676 | 677 | ||
677 | AddressBook::Iterator AddressBook::end() | 678 | AddressBook::Iterator AddressBook::end() |
678 | { | 679 | { |
679 | Iterator it = Iterator(); | 680 | Iterator it = Iterator(); |
680 | it.d->mIt = d->mAddressees.end(); | 681 | it.d->mIt = d->mAddressees.end(); |
681 | return it; | 682 | return it; |
682 | } | 683 | } |
683 | 684 | ||
684 | AddressBook::ConstIterator AddressBook::end() const | 685 | AddressBook::ConstIterator AddressBook::end() const |
685 | { | 686 | { |