• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdefile
 

tdeio/tdefile

  • tdeio
  • tdefile
tdefilebookmarkhandler.cpp
1/* This file is part of the KDE libraries
2 Copyright (C) 2002 Carsten Pfeiffer <pfeiffer@kde.org>
3
4 library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation, version 2.
7
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
12
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
17*/
18
19#include <stdio.h>
20#include <stdlib.h>
21
22#include <kbookmarkimporter.h>
23#include <kbookmarkdombuilder.h>
24#include <tdepopupmenu.h>
25#include <tdestandarddirs.h>
26
27#include "tdefiledialog.h"
28#include "tdefilebookmarkhandler.h"
29
30KFileBookmarkHandler::KFileBookmarkHandler( KFileDialog *dialog )
31 : TQObject( dialog, "KFileBookmarkHandler" ),
32 KBookmarkOwner(),
33 m_dialog( dialog )
34{
35 m_menu = new TDEPopupMenu( dialog, "bookmark menu" );
36
37 TQString file = locate( "data", "tdefile/bookmarks.xml" );
38 if ( file.isEmpty() )
39 file = locateLocal( "data", "tdefile/bookmarks.xml" );
40
41 KBookmarkManager *manager = KBookmarkManager::managerForFile( file, false);
42
43 // import old bookmarks
44 if ( !TDEStandardDirs::exists( file ) ) {
45 TQString oldFile = locate( "data", "tdefile/bookmarks.html" );
46 if ( !oldFile.isEmpty() )
47 importOldBookmarks( oldFile, manager );
48 }
49
50 manager->setUpdate( true );
51 manager->setShowNSBookmarks( false );
52
53 m_bookmarkMenu = new KBookmarkMenu( manager, this, m_menu,
54 dialog->actionCollection(), true );
55}
56
57KFileBookmarkHandler::~KFileBookmarkHandler()
58{
59 delete m_bookmarkMenu;
60}
61
62TQString KFileBookmarkHandler::currentURL() const
63{
64 return m_dialog->baseURL().url();
65}
66
67void KFileBookmarkHandler::importOldBookmarks( const TQString& path,
68 KBookmarkManager *manager )
69{
70 KBookmarkDomBuilder *builder = new KBookmarkDomBuilder( manager->root(), manager );
71 KNSBookmarkImporter importer( path );
72 builder->connectImporter( &importer );
73 importer.parseNSBookmarks();
74 delete builder;
75 manager->save();
76}
77
78void KFileBookmarkHandler::virtual_hook( int id, void* data )
79{ KBookmarkOwner::virtual_hook( id, data ); }
80
81#include "tdefilebookmarkhandler.moc"
KFileDialog
Provides a user (and developer) friendly way to select files and directories.
Definition: tdefiledialog.h:77
KFileDialog::actionCollection
TDEActionCollection * actionCollection() const
Definition: tdefiledialog.cpp:2204

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeio/tdefile

Skip menu "tdeio/tdefile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdefile by doxygen 1.9.4
This website is maintained by Timothy Pearson.