• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdepim
  • Sitemap
  • Contact Us
 

kaddressbook

bookmark_xxport.cpp

Go to the documentation of this file.
00001 /*
00002     This file is part of KAddressbook.
00003     Copyright (c) 2003  Alexander Kellett <lypanov@kde.org>
00004                         Tobias Koenig <tokoe@kde.org>
00005 
00006     This program is free software; you can redistribute it and/or modify
00007     it under the terms of the GNU General Public License as published by
00008     the Free Software Foundation; either version 2 of the License, or
00009     (at your option) any later version.
00010 
00011     This program is distributed in the hope that it will be useful,
00012     but WITHOUT ANY WARRANTY; without even the implied warranty of
00013     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00014     GNU General Public License for more details.
00015 
00016     You should have received a copy of the GNU General Public License
00017     along with this program; if not, write to the Free Software
00018     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00019 
00020     As a special exception, permission is given to link this program
00021     with any edition of Qt, and distribute the resulting executable,
00022     without including the source code for Qt in the source distribution.
00023 */
00024 
00025 #include <kbookmark.h>
00026 #include <kbookmarkmanager.h>
00027 #include <kbookmarkmenu.h>
00028 #include <konqbookmarkmenu.h>
00029 #include <kbookmarkdombuilder.h>
00030 #include <klocale.h>
00031 #include <kstandarddirs.h>
00032 
00033 #include "bookmark_xxport.h"
00034 
00035 K_EXPORT_KADDRESSBOOK_XXFILTER( kaddrbk_bookmark_xxport, BookmarkXXPort )
00036 
00037 BookmarkXXPort::BookmarkXXPort( KABC::AddressBook *ab, QWidget *parent, const char *name )
00038   : KAB::XXPort( ab, parent, name )
00039 {
00040   createExportAction( i18n( "Export Bookmarks Menu..." ) );
00041 }
00042 
00043 bool BookmarkXXPort::exportContacts( const KABC::AddresseeList &list, const QString& )
00044 {
00045   QString fileName = KStandardDirs::locateLocal( "data", "kabc/bookmarks.xml" );
00046 
00047   KBookmarkManager *mgr = KBookmarkManager::managerForFile( fileName, "KAddressbook" );
00048   KBookmarkDomBuilder *builder = new KBookmarkDomBuilder( mgr->root(), mgr );
00049   builder->connectImporter( this );
00050 
00051   KABC::AddresseeList::ConstIterator it;
00052   emit newFolder( i18n( "AddressBook" ), false, "" );
00053   for ( it = list.begin(); it != list.end(); ++it ) {
00054     if ( !(*it).url().isEmpty() ) {
00055       QString name = (*it).givenName() + ' ' + (*it).familyName();
00056       emit newBookmark( name, (*it).url().url().toLatin1(), QString( "" ) );
00057     }
00058   }
00059   emit endFolder();
00060   delete builder;
00061   mgr->save();
00062 
00063 #ifdef __GNUC__
00064 #warning FIXME KonqBookmarkMenu is now protected.
00065 #endif
00066   // I think we have to subclass KonqBookmarkMenu to get access to 
00067   // the struct and the method.
00068   /*KonqBookmarkMenu::DynMenuInfo menu;
00069   menu.name = i18n( "Addressbook Bookmarks" );
00070   menu.location = fileName;
00071   menu.type = "xbel";
00072   menu.show = true;
00073   KonqBookmarkMenu::setDynamicBookmarks( "kabc", menu );*/
00074 
00075   return true;
00076 }
00077 
00078 #include "bookmark_xxport.moc"

kaddressbook

Skip menu "kaddressbook"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kdepim

Skip menu "kdepim"
  • akonadi
  •   clients
  •   kabc
  •   kcal
  •   kcm
  • akregator
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt
  • kdgantt1
  • kjots
  • kleopatra
  • kmail
  • kmobiletools
  • knode
  • knotes
  • kontact
  • kontactinterfaces
  • korganizer
  •   korgac
  • kpilot
  • ktimetracker
  •   doc
  • libkdepim
  • libkholidays
  • libkleo
  • libkpgp
  • maildir
Generated for kdepim by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal