bool BookmarkXXPort::exportContacts( const KABC::AddresseeList &list, const QString& ) { QString fileName = locateLocal( "data", "kabc/bookmarks.xml" ); KBookmarkManager *mgr = KBookmarkManager::managerForFile( fileName ); KBookmarkDomBuilder *builder = new KBookmarkDomBuilder( mgr->root(), mgr ); builder->connectImporter( this ); KABC::AddresseeList::ConstIterator it; emit newFolder( i18n( "AddressBook" ), false, "" ); for ( it = list.begin(); it != list.end(); ++it ) { if ( !(*it).url().isEmpty() ) { QString name = (*it).givenName() + " " + (*it).familyName(); emit newBookmark( name, (*it).url().url().latin1(), QString( "" ) ); } } emit endFolder(); delete builder; mgr->save(); KBookmarkMenu::DynMenuInfo menu; menu.name = i18n( "Addressbook Bookmarks" ); menu.location = fileName; menu.type = "xbel"; menu.show = true; KBookmarkMenu::setDynamicBookmarks( "kabc", menu ); return true; }
void KFileBookmarkHandler::importOldBookmarks( const QString& path, KBookmarkManager *manager ) { KBookmarkDomBuilder *builder = new KBookmarkDomBuilder( manager->root(), manager ); KNSBookmarkImporter importer( path ); builder->connectImporter( &importer ); importer.parseNSBookmarks(); delete builder; manager->save(); }