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

tdeio/bookmarks

  • tdeio
  • bookmarks
kbookmarkimporter.cc
1 // -*- c-basic-offset:4; indent-tabs-mode:nil -*-
2 // vim: set ts=4 sts=4 sw=4 et:
3 /* This file is part of the KDE libraries
4  Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include <tdefiledialog.h>
22 #include <kstringhandler.h>
23 #include <tdelocale.h>
24 #include <kdebug.h>
25 #include <kcharsets.h>
26 #include <tqtextcodec.h>
27 
28 #include <sys/types.h>
29 #include <stddef.h>
30 #include <dirent.h>
31 #include <sys/stat.h>
32 #include <assert.h>
33 
34 #include "kbookmarkmanager.h"
35 
36 #include "kbookmarkimporter_ns.h"
37 #include "kbookmarkimporter_opera.h"
38 #include "kbookmarkimporter_ie.h"
39 
40 #include "kbookmarkimporter.h"
41 
42 void KXBELBookmarkImporterImpl::parse()
43 {
44  //kdDebug() << "KXBELBookmarkImporterImpl::parse()" << endl;
45  KBookmarkManager *manager = KBookmarkManager::managerForFile(m_fileName);
46  KBookmarkGroup root = manager->root();
47  traverse(root);
48  // FIXME delete it!
49  // delete manager;
50 }
51 
52 void KXBELBookmarkImporterImpl::visit(const KBookmark &bk)
53 {
54  //kdDebug() << "KXBELBookmarkImporterImpl::visit" << endl;
55  if (bk.isSeparator())
56  emit newSeparator();
57  else
58  emit newBookmark(bk.fullText(), bk.url().url().utf8(), "");
59 }
60 
61 void KXBELBookmarkImporterImpl::visitEnter(const KBookmarkGroup &grp)
62 {
63  //kdDebug() << "KXBELBookmarkImporterImpl::visitEnter" << endl;
64  emit newFolder(grp.fullText(), false, "");
65 }
66 
67 void KXBELBookmarkImporterImpl::visitLeave(const KBookmarkGroup &)
68 {
69  //kdDebug() << "KXBELBookmarkImporterImpl::visitLeave" << endl;
70  emit endFolder();
71 }
72 
73 void KBookmarkImporterBase::setupSignalForwards(TQObject *src, TQObject *dst)
74 {
75  connect(src, TQT_SIGNAL( newBookmark( const TQString &, const TQCString &, const TQString & ) ),
76  dst, TQT_SIGNAL( newBookmark( const TQString &, const TQCString &, const TQString & ) ));
77  connect(src, TQT_SIGNAL( newFolder( const TQString &, bool, const TQString & ) ),
78  dst, TQT_SIGNAL( newFolder( const TQString &, bool, const TQString & ) ));
79  connect(src, TQT_SIGNAL( newSeparator() ),
80  dst, TQT_SIGNAL( newSeparator() ) );
81  connect(src, TQT_SIGNAL( endFolder() ),
82  dst, TQT_SIGNAL( endFolder() ) );
83 }
84 
85 KBookmarkImporterBase* KBookmarkImporterBase::factory( const TQString &type )
86 {
87  if (type == "netscape")
88  return new KNSBookmarkImporterImpl;
89  else if (type == "mozilla")
90  return new KMozillaBookmarkImporterImpl;
91  else if (type == "xbel")
92  return new KXBELBookmarkImporterImpl;
93  else if (type == "ie")
94  return new KIEBookmarkImporterImpl;
95  else if (type == "opera")
96  return new KOperaBookmarkImporterImpl;
97  else
98  return 0;
99 }
100 
101 #include <kbookmarkimporter.moc>
KNSBookmarkImporterImpl
A class for importing NS bookmarks utf8 defaults to off.
Definition: kbookmarkimporter_ns.h:67
KMozillaBookmarkImporterImpl
A class for importing Mozilla bookmarks utf8 defaults to on.
Definition: kbookmarkimporter_ns.h:84
KBookmarkImporterBase::endFolder
void endFolder()
Tell the outside world that we&#39;re going down one menu.
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:53
KIEBookmarkImporterImpl
A class for importing IE bookmarks.
Definition: kbookmarkimporter_ie.h:65
KBookmarkManager::managerForFile
static KBookmarkManager * managerForFile(const TQString &bookmarksFile, bool bImportDesktopFiles=true)
This static function will return an instance of the KBookmarkManager, responsible for the given bookm...
Definition: kbookmarkmanager.cc:100
KBookmarkImporterBase::newFolder
void newFolder(const TQString &text, bool open, const TQString &additionalInfo)
Notify about a new folder Use "bookmark_folder" for the icon.
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:199
KBookmarkImporterBase::newBookmark
void newBookmark(const TQString &text, const TQCString &url, const TQString &additionalInfo)
Notify about a new bookmark Use "html" for the icon.
KBookmarkManager::root
KBookmarkGroup root() const
This will return the root bookmark.
Definition: kbookmarkmanager.cc:385
KBookmarkImporterBase::newSeparator
void newSeparator()
Notify about a new separator.
KBookmarkImporterBase
A class for importing NS bookmarks KEditBookmarks uses it to insert bookmarks into its DOM tree...
Definition: kbookmarkimporter.h:37
KOperaBookmarkImporterImpl
A class for importing Opera bookmarks.
Definition: kbookmarkimporter_opera.h:61
KXBELBookmarkImporterImpl
A class for importing XBEL files.
Definition: kbookmarkimporter.h:87

tdeio/bookmarks

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

tdeio/bookmarks

Skip menu "tdeio/bookmarks"
  • 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/bookmarks by doxygen 1.8.11
This website is maintained by Timothy Pearson.