• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • kio/kfile
 

kio/kfile

  • kio
  • kfile
kfilebookmarkhandler.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 <kpopupmenu.h>
25 #include <kstandarddirs.h>
26 
27 #include "kfiledialog.h"
28 #include "kfilebookmarkhandler.h"
29 
30 KFileBookmarkHandler::KFileBookmarkHandler( KFileDialog *dialog )
31  : TQObject( dialog, "KFileBookmarkHandler" ),
32  KBookmarkOwner(),
33  m_dialog( dialog )
34 {
35  m_menu = new KPopupMenu( dialog, "bookmark menu" );
36 
37  TQString file = locate( "data", "kfile/bookmarks.xml" );
38  if ( file.isEmpty() )
39  file = locateLocal( "data", "kfile/bookmarks.xml" );
40 
41  KBookmarkManager *manager = KBookmarkManager::managerForFile( file, false);
42 
43  // import old bookmarks
44  if ( !KStandardDirs::exists( file ) ) {
45  TQString oldFile = locate( "data", "kfile/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 
57 KFileBookmarkHandler::~KFileBookmarkHandler()
58 {
59  delete m_bookmarkMenu;
60 }
61 
62 TQString KFileBookmarkHandler::currentURL() const
63 {
64  return m_dialog->baseURL().url();
65 }
66 
67 void 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 
78 void KFileBookmarkHandler::virtual_hook( int id, void* data )
79 { KBookmarkOwner::virtual_hook( id, data ); }
80 
81 #include "kfilebookmarkhandler.moc"
KFileDialog
Provides a user (and developer) friendly way to select files and directories.
Definition: kfiledialog.h:77
KFileDialog::actionCollection
KActionCollection * actionCollection() const
Definition: kfiledialog.cpp:2203

kio/kfile

Skip menu "kio/kfile"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

kio/kfile

Skip menu "kio/kfile"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kio/kfile by doxygen 1.8.8
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |