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

KIO

  • sources
  • kde-4.12
  • kdelibs
  • 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 
42 void 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 
52 void 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 
61 void KXBELBookmarkImporterImpl::visitEnter(const KBookmarkGroup &grp)
62 {
63  //kDebug() << "KXBELBookmarkImporterImpl::visitEnter";
64  emit newFolder(grp.fullText(), false, "");
65 }
66 
67 void KXBELBookmarkImporterImpl::visitLeave(const KBookmarkGroup &)
68 {
69  //kDebug() << "KXBELBookmarkImporterImpl::visitLeave";
70  emit endFolder();
71 }
72 
73 void 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 
85 KBookmarkImporterBase* 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>
KBookmarkImporterBase::factory
static KBookmarkImporterBase * factory(const QString &type)
Definition: kbookmarkimporter.cc:85
KBookmarkGroupTraverser::traverse
void traverse(const KBookmarkGroup &)
Definition: kbookmark.cc:621
kcharsets.h
kbookmarkmanager.h
kdebug.h
KNSBookmarkImporterImpl
A class for importing NS bookmarks utf8 defaults to off.
Definition: kbookmarkimporter_ns.h:35
kbookmarkimporter_ie.h
KMozillaBookmarkImporterImpl
A class for importing Mozilla bookmarks utf8 defaults to on.
Definition: kbookmarkimporter_ns.h:51
kfiledialog.h
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:65
KXBELBookmarkImporterImpl::visitEnter
virtual void visitEnter(const KBookmarkGroup &)
Definition: kbookmarkimporter.cc:61
KIEBookmarkImporterImpl
A class for importing IE bookmarks.
Definition: kbookmarkimporter_ie.h:34
QString
QObject
klocale.h
KBookmark
Definition: kbookmark.h:34
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
kbookmarkimporter.h
KBookmarkImporterBase::newBookmark
void newBookmark(const QString &text, const QString &url, const QString &additionalInfo)
Notify about a new bookmark Use "html" for the icon.
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:347
KXBELBookmarkImporterImpl::parse
virtual void parse()
Definition: kbookmarkimporter.cc:42
KBookmarkImporterBase::m_fileName
QString m_fileName
Definition: kbookmarkimporter.h:75
kbookmarkimporter_opera.h
kstringhandler.h
KBookmarkManager::root
KBookmarkGroup root() const
This will return the root bookmark.
Definition: kbookmarkmanager.cc:464
KXBELBookmarkImporterImpl::visit
virtual void visit(const KBookmark &)
Definition: kbookmarkimporter.cc:52
KBookmarkImporterBase::setupSignalForwards
void setupSignalForwards(QObject *src, QObject *dst)
Definition: kbookmarkimporter.cc:73
kbookmarkimporter_ns.h
KBookmark::isSeparator
bool isSeparator() const
Whether the bookmark is a separator.
Definition: kbookmark.cc:290
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:34
KUrl::url
QString url(AdjustPathOption trailing=LeaveTrailingSlash) const
KXBELBookmarkImporterImpl::visitLeave
virtual void visitLeave(const KBookmarkGroup &)
Definition: kbookmarkimporter.cc:67
KOperaBookmarkImporterImpl
A class for importing Opera bookmarks.
Definition: kbookmarkimporter_opera.h:30
KXBELBookmarkImporterImpl
A class for importing XBEL files.
Definition: kbookmarkimporter.h:84
KBookmark::fullText
QString fullText() const
Text shown for the bookmark, not truncated.
Definition: kbookmark.cc:311
KBookmark::url
KUrl url() const
URL contained by the bookmark.
Definition: kbookmark.cc:338
KBookmarkImporterBase::newFolder
void newFolder(const QString &text, bool open, const QString &additionalInfo)
Notify about a new folder Use "bookmark_folder" for the icon.
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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