void LLPanelFriends::onContactFilterEdit(const std::string& search_string) { filterContacts(search_string); }
bool VCardXXPort::exportContacts( const KABC::AddresseeList &addrList, const QString &data ) { KABC::VCardConverter converter; KURL url; KABC::AddresseeList list; list = filterContacts( addrList ); bool ok = true; if ( list.isEmpty() ) { return ok; } else if ( list.count() == 1 ) { url = KFileDialog::getSaveURL( list[ 0 ].givenName() + "_" + list[ 0 ].familyName() + ".vcf" ); if ( url.isEmpty() ) return true; if ( data == "v21" ) ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v2_1 ) ); else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) ); } else { QString msg = i18n( "You have selected a list of contacts, shall they be " "exported to several files?" ); switch ( KMessageBox::questionYesNo( parentWidget(), msg, QString::null, i18n("Export to Several Files"), i18n("Export to One File") ) ) { case KMessageBox::Yes: { KURL baseUrl = KFileDialog::getExistingURL(); if ( baseUrl.isEmpty() ) return true; KABC::AddresseeList::ConstIterator it; uint counter = 0; for ( it = list.begin(); it != list.end(); ++it ) { QString testUrl; if ( (*it).givenName().isEmpty() && (*it).familyName().isEmpty() ) testUrl = baseUrl.url() + "/" + (*it).organization(); else testUrl = baseUrl.url() + "/" + (*it).givenName() + "_" + (*it).familyName(); if ( KIO::NetAccess::exists( testUrl + (counter == 0 ? "" : QString::number( counter )) + ".vcf", false, parentWidget() ) ) { counter++; url = testUrl + QString::number( counter ) + ".vcf"; } else url = testUrl + ".vcf"; bool tmpOk; KABC::AddresseeList tmpList; tmpList.append( *it ); if ( data == "v21" ) tmpOk = doExport( url, converter.createVCards( tmpList, KABC::VCardConverter::v2_1 ) ); else tmpOk = doExport( url, converter.createVCards( tmpList, KABC::VCardConverter::v3_0 ) ); ok = ok && tmpOk; } break; } case KMessageBox::No: default: { url = KFileDialog::getSaveURL( "addressbook.vcf" ); if ( url.isEmpty() ) return true; if ( data == "v21" ) ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v2_1 ) ); else ok = doExport( url, converter.createVCards( list, KABC::VCardConverter::v3_0 ) ); } } } return ok; }