22 #include <kbookmarkimporter.h>
23 #include <kbookmarkdombuilder.h>
24 #include <tdepopupmenu.h>
25 #include <kstandarddirs.h>
27 #include "tdefiledialog.h"
28 #include "tdefilebookmarkhandler.h"
30 KFileBookmarkHandler::KFileBookmarkHandler(
KFileDialog *dialog )
31 : TQObject( dialog,
"KFileBookmarkHandler" ),
35 m_menu =
new TDEPopupMenu( dialog,
"bookmark menu" );
37 TQString file = locate(
"data",
"tdefile/bookmarks.xml" );
39 file = locateLocal(
"data",
"tdefile/bookmarks.xml" );
41 KBookmarkManager *manager = KBookmarkManager::managerForFile( file,
false);
44 if ( !TDEStandardDirs::exists( file ) ) {
45 TQString oldFile = locate(
"data",
"tdefile/bookmarks.html" );
46 if ( !oldFile.isEmpty() )
47 importOldBookmarks( oldFile, manager );
50 manager->setUpdate(
true );
51 manager->setShowNSBookmarks(
false );
53 m_bookmarkMenu =
new KBookmarkMenu( manager,
this, m_menu,
57 KFileBookmarkHandler::~KFileBookmarkHandler()
59 delete m_bookmarkMenu;
62 TQString KFileBookmarkHandler::currentURL()
const
64 return m_dialog->baseURL().url();
67 void KFileBookmarkHandler::importOldBookmarks(
const TQString& path,
68 KBookmarkManager *manager )
70 KBookmarkDomBuilder *builder =
new KBookmarkDomBuilder( manager->root(), manager );
71 KNSBookmarkImporter importer( path );
72 builder->connectImporter( &importer );
73 importer.parseNSBookmarks();
78 void KFileBookmarkHandler::virtual_hook(
int id,
void* data )
79 { KBookmarkOwner::virtual_hook(
id, data ); }
81 #include "tdefilebookmarkhandler.moc"
Provides a user (and developer) friendly way to select files and directories.
TDEActionCollection * actionCollection() const