25 #include <kbookmark.h>
26 #include <kbookmarkmanager.h>
27 #include <kbookmarkmenu.h>
28 #include <kbookmarkdombuilder.h>
29 #include <tdelocale.h>
30 #include <kstandarddirs.h>
32 #include "bookmark_xxport.h"
34 K_EXPORT_KADDRESSBOOK_XXFILTER( libkaddrbk_bookmark_xxport, BookmarkXXPort )
36 BookmarkXXPort::BookmarkXXPort( TDEABC::AddressBook *ab, TQWidget *parent, const char *name )
37 : KAB::XXPort( ab, parent, name )
39 createExportAction( i18n( "Export Bookmarks Menu..." ) );
42 bool BookmarkXXPort::exportContacts( const TDEABC::AddresseeList &list, const TQString& )
44 TQString fileName = locateLocal( "data", "tdeabc/bookmarks.xml" );
46 KBookmarkManager *mgr = KBookmarkManager::managerForFile( fileName );
47 KBookmarkDomBuilder *builder = new KBookmarkDomBuilder( mgr->root(), mgr );
48 builder->connectImporter( this );
50 TDEABC::AddresseeList::ConstIterator it;
51 emit newFolder( i18n( "AddressBook" ), false, "" );
52 for ( it = list.begin(); it != list.end(); ++it ) {
53 if ( !(*it).url().isEmpty() ) {
54 TQString name = (*it).givenName() + " " + (*it).familyName();
55 emit newBookmark( name, (*it).url().url().latin1(), TQString( "" ) );
62 KBookmarkMenu::DynMenuInfo menu;
63 menu.name = i18n( "Addressbook Bookmarks" );
64 menu.location = fileName;
67 KBookmarkMenu::setDynamicBookmarks( "tdeabc", menu );
72 #include "bookmark_xxport.moc"
|