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

tdeio/bookmarks

  • tdeio
  • bookmarks
kbookmarkimporter.cpp
1 /* This file is part of the KDE libraries
2  Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License version 2 as published by the Free Software Foundation.
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 <tdefiledialog.h>
20 #include <kstringhandler.h>
21 #include <tdelocale.h>
22 #include <kdebug.h>
23 #include <kcharsets.h>
24 #include <tqtextcodec.h>
25 
26 #include <sys/types.h>
27 #include <stddef.h>
28 #include <dirent.h>
29 #include <sys/stat.h>
30 #include <assert.h>
31 
32 #include "kbookmarkmanager.h"
33 
34 #include "kbookmarkimporter_ns.h"
35 #include "kbookmarkimporter_opera.h"
36 #include "kbookmarkimporter_ie.h"
37 
38 #include "kbookmarkimporter.h"
39 
40 void KXBELBookmarkImporterImpl::parse()
41 {
42  //kdDebug() << "KXBELBookmarkImporterImpl::parse()" << endl;
43  KBookmarkManager *manager = KBookmarkManager::managerForFile(m_fileName);
44  KBookmarkGroup root = manager->root();
45  traverse(root);
46  // FIXME delete it!
47  // delete manager;
48 }
49 
50 void KXBELBookmarkImporterImpl::visit(const KBookmark &bk)
51 {
52  //kdDebug() << "KXBELBookmarkImporterImpl::visit" << endl;
53  if (bk.isSeparator())
54  emit newSeparator();
55  else
56  emit newBookmark(bk.fullText(), bk.url().url().utf8(), "");
57 }
58 
59 void KXBELBookmarkImporterImpl::visitEnter(const KBookmarkGroup &grp)
60 {
61  //kdDebug() << "KXBELBookmarkImporterImpl::visitEnter" << endl;
62  emit newFolder(grp.fullText(), false, "");
63 }
64 
65 void KXBELBookmarkImporterImpl::visitLeave(const KBookmarkGroup &)
66 {
67  //kdDebug() << "KXBELBookmarkImporterImpl::visitLeave" << endl;
68  emit endFolder();
69 }
70 
71 void KBookmarkImporterBase::setupSignalForwards(TQObject *src, TQObject *dst)
72 {
73  connect(src, TQT_SIGNAL( newBookmark( const TQString &, const TQCString &, const TQString & ) ),
74  dst, TQT_SIGNAL( newBookmark( const TQString &, const TQCString &, const TQString & ) ));
75  connect(src, TQT_SIGNAL( newFolder( const TQString &, bool, const TQString & ) ),
76  dst, TQT_SIGNAL( newFolder( const TQString &, bool, const TQString & ) ));
77  connect(src, TQT_SIGNAL( newSeparator() ),
78  dst, TQT_SIGNAL( newSeparator() ) );
79  connect(src, TQT_SIGNAL( endFolder() ),
80  dst, TQT_SIGNAL( endFolder() ) );
81 }
82 
83 KBookmarkImporterBase* KBookmarkImporterBase::factory( const TQString &type )
84 {
85  if (type == "netscape")
86  return new KNSBookmarkImporterImpl;
87  else if (type == "mozilla")
88  return new KMozillaBookmarkImporterImpl;
89  else if (type == "xbel")
90  return new KXBELBookmarkImporterImpl;
91  else if (type == "ie")
92  return new KIEBookmarkImporterImpl;
93  else if (type == "opera")
94  return new KOperaBookmarkImporterImpl;
95  else
96  return 0;
97 }
98 
99 #include <kbookmarkimporter.moc>
KNSBookmarkImporterImpl
A class for importing NS bookmarks utf8 defaults to off.
Definition: kbookmarkimporter_ns.h:65
KMozillaBookmarkImporterImpl
A class for importing Mozilla bookmarks utf8 defaults to on.
Definition: kbookmarkimporter_ns.h:82
KBookmarkImporterBase::endFolder
void endFolder()
Tell the outside world that we're going down one menu.
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:51
KIEBookmarkImporterImpl
A class for importing IE bookmarks.
Definition: kbookmarkimporter_ie.h:63
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.cpp:98
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:197
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.cpp:383
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:35
KOperaBookmarkImporterImpl
A class for importing Opera bookmarks.
Definition: kbookmarkimporter_opera.h:59
KXBELBookmarkImporterImpl
A class for importing XBEL files.
Definition: kbookmarkimporter.h:85

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
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/bookmarks by doxygen 1.8.8
This website is maintained by Timothy Pearson.