void AddressEditWidget::storeContact( KABC::Addressee &contact ) const { // delete all previous addresses const KABC::Address::List oldAddresses = contact.addresses(); for ( int i = 0; i < oldAddresses.count(); ++i ) { contact.removeAddress( oldAddresses.at( i ) ); } // insert the new ones for ( int i = 0; i < mAddressList.count(); ++i ) { const KABC::Address address( mAddressList.at( i ) ); if ( !address.isEmpty() ) { contact.insertAddress( address ); } } }
void AddressEditWidget::loadContact( const KABC::Addressee &contact ) { mName = contact.realName(); mAddressList = contact.addresses(); mAddressSelectionWidget->setAddresses( mAddressList ); // set the preferred address as the visible one for ( int i = 0; i < mAddressList.count(); ++i ) { if ( mAddressList.at( i ).type() & KABC::Address::Pref ) { mAddressSelectionWidget->setCurrentAddress( mAddressList.at( i ) ); break; } } updateAddressView(); updateButtons(); }