• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • bookmarks
kbookmarkimporter.cc
Go to the documentation of this file.
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 "kbookmarkimporter.h"
22
23#include <kfiledialog.h>
24#include <kstringhandler.h>
25#include <klocale.h>
26#include <kdebug.h>
27#include <kcharsets.h>
28#include <qtextcodec.h>
29
30#include <sys/types.h>
31#include <stddef.h>
32#include <dirent.h>
33#include <sys/stat.h>
34#include <assert.h>
35
36#include "kbookmarkmanager.h"
37
38#include "kbookmarkimporter_ns.h"
39#include "kbookmarkimporter_opera.h"
40#include "kbookmarkimporter_ie.h"
41
42void KXBELBookmarkImporterImpl::parse()
43{
44 //kDebug() << "KXBELBookmarkImporterImpl::parse()";
45 KBookmarkManager *manager = KBookmarkManager::managerForFile(m_fileName, QString());
46 KBookmarkGroup root = manager->root();
47 traverse(root);
48 // FIXME delete it!
49 // delete manager;
50}
51
52void KXBELBookmarkImporterImpl::visit(const KBookmark &bk)
53{
54 //kDebug() << "KXBELBookmarkImporterImpl::visit";
55 if (bk.isSeparator())
56 emit newSeparator();
57 else
58 emit newBookmark(bk.fullText(), bk.url().url(), "");
59}
60
61void KXBELBookmarkImporterImpl::visitEnter(const KBookmarkGroup &grp)
62{
63 //kDebug() << "KXBELBookmarkImporterImpl::visitEnter";
64 emit newFolder(grp.fullText(), false, "");
65}
66
67void KXBELBookmarkImporterImpl::visitLeave(const KBookmarkGroup &)
68{
69 //kDebug() << "KXBELBookmarkImporterImpl::visitLeave";
70 emit endFolder();
71}
72
73void KBookmarkImporterBase::setupSignalForwards(QObject *src, QObject *dst)
74{
75 connect(src, SIGNAL( newBookmark( const QString &, const QString &, const QString & ) ),
76 dst, SIGNAL( newBookmark( const QString &, const QString &, const QString & ) ));
77 connect(src, SIGNAL( newFolder( const QString &, bool, const QString & ) ),
78 dst, SIGNAL( newFolder( const QString &, bool, const QString & ) ));
79 connect(src, SIGNAL( newSeparator() ),
80 dst, SIGNAL( newSeparator() ) );
81 connect(src, SIGNAL( endFolder() ),
82 dst, SIGNAL( endFolder() ) );
83}
84
85KBookmarkImporterBase* KBookmarkImporterBase::factory( const QString &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>
KBookmarkGroupTraverser::traverse
void traverse(const KBookmarkGroup &)
Definition: kbookmark.cc:621
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:348
KBookmarkImporterBase
A class for importing NS bookmarks KEditBookmarks uses it to insert bookmarks into its DOM tree,...
Definition: kbookmarkimporter.h:35
KBookmarkImporterBase::newSeparator
void newSeparator()
Notify about a new separator.
KBookmarkImporterBase::endFolder
void endFolder()
Tell the outside world that we're going down one menu.
KBookmarkImporterBase::newFolder
void newFolder(const QString &text, bool open, const QString &additionalInfo)
Notify about a new folder Use "bookmark_folder" for the icon.
KBookmarkImporterBase::m_fileName
QString m_fileName
Definition: kbookmarkimporter.h:75
KBookmarkImporterBase::setupSignalForwards
void setupSignalForwards(QObject *src, QObject *dst)
Definition: kbookmarkimporter.cc:73
KBookmarkImporterBase::newBookmark
void newBookmark(const QString &text, const QString &url, const QString &additionalInfo)
Notify about a new bookmark Use "html" for the icon.
KBookmarkImporterBase::factory
static KBookmarkImporterBase * factory(const QString &type)
Definition: kbookmarkimporter.cc:85
KBookmarkManager
This class implements the reading/writing of bookmarks in XML.
Definition: kbookmarkmanager.h:66
KBookmarkManager::managerForFile
static KBookmarkManager * managerForFile(const QString &bookmarksFile, const QString &dbusObjectName)
This static function will return an instance of the KBookmarkManager, responsible for the given bookm...
Definition: kbookmarkmanager.cc:150
KBookmarkManager::root
KBookmarkGroup root() const
This will return the root bookmark.
Definition: kbookmarkmanager.cc:468
KBookmark
Definition: kbookmark.h:35
KBookmark::fullText
QString fullText() const
Text shown for the bookmark, not truncated.
Definition: kbookmark.cc:311
KBookmark::isSeparator
bool isSeparator() const
Whether the bookmark is a separator.
Definition: kbookmark.cc:290
KBookmark::url
KUrl url() const
URL contained by the bookmark.
Definition: kbookmark.cc:338
KIEBookmarkImporterImpl
A class for importing IE bookmarks.
Definition: kbookmarkimporter_ie.h:35
KMozillaBookmarkImporterImpl
A class for importing Mozilla bookmarks utf8 defaults to on.
Definition: kbookmarkimporter_ns.h:52
KNSBookmarkImporterImpl
A class for importing NS bookmarks utf8 defaults to off.
Definition: kbookmarkimporter_ns.h:36
KOperaBookmarkImporterImpl
A class for importing Opera bookmarks.
Definition: kbookmarkimporter_opera.h:31
KUrl::url
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
KXBELBookmarkImporterImpl
A class for importing XBEL files.
Definition: kbookmarkimporter.h:85
KXBELBookmarkImporterImpl::parse
virtual void parse()
Definition: kbookmarkimporter.cc:42
KXBELBookmarkImporterImpl::visit
virtual void visit(const KBookmark &)
Definition: kbookmarkimporter.cc:52
KXBELBookmarkImporterImpl::visitEnter
virtual void visitEnter(const KBookmarkGroup &)
Definition: kbookmarkimporter.cc:61
KXBELBookmarkImporterImpl::visitLeave
virtual void visitLeave(const KBookmarkGroup &)
Definition: kbookmarkimporter.cc:67
QObject
kbookmarkimporter.h
kbookmarkimporter_ie.h
kbookmarkimporter_ns.h
kbookmarkimporter_opera.h
kbookmarkmanager.h
kcharsets.h
kdebug.h
kfiledialog.h
klocale.h
kstringhandler.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal