kbookmarkimporter.cc
// -*- c-basic-offset:4; indent-tabs-mode:nil -*-
// vim: set ts=4 sts=4 sw=4 et:
/* This file is part of the KDE libraries
Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include <kfiledialog.h>
#include <kstringhandler.h>
#include <klocale.h>
#include <kdebug.h>
#include <kcharsets.h>
#include <qtextcodec.h>
#include <sys/types.h>
#include <stddef.h>
#include <dirent.h>
#include <sys/stat.h>
#include <assert.h>
#include "kbookmarkmanager.h"
#include "kbookmarkimporter_ns.h"
#include "kbookmarkimporter_opera.h"
#include "kbookmarkimporter_ie.h"
#include "kbookmarkimporter.h"
void KXBELBookmarkImporterImpl::parse()
{
//kdDebug() << "KXBELBookmarkImporterImpl::parse()" << endl;
KBookmarkManager *manager = KBookmarkManager::managerForFile(m_fileName);
KBookmarkGroup root = manager->root();
traverse(root);
// FIXME delete it!
// delete manager;
}
void KXBELBookmarkImporterImpl::visit(const KBookmark &bk)
{
//kdDebug() << "KXBELBookmarkImporterImpl::visit" << endl;
if (bk.isSeparator())
emit newSeparator();
else
emit newBookmark(bk.fullText(), bk.url().url().utf8(), "");
}
void KXBELBookmarkImporterImpl::visitEnter(const KBookmarkGroup &grp)
{
//kdDebug() << "KXBELBookmarkImporterImpl::visitEnter" << endl;
emit newFolder(grp.fullText(), false, "");
}
void KXBELBookmarkImporterImpl::visitLeave(const KBookmarkGroup &)
{
//kdDebug() << "KXBELBookmarkImporterImpl::visitLeave" << endl;
emit endFolder();
}
void KBookmarkImporterBase::setupSignalForwards(QObject *src, QObject *dst)
{
connect(src, SIGNAL( newBookmark( const QString &, const QCString &, const QString & ) ),
dst, SIGNAL( newBookmark( const QString &, const QCString &, const QString & ) ));
connect(src, SIGNAL( newFolder( const QString &, bool, const QString & ) ),
dst, SIGNAL( newFolder( const QString &, bool, const QString & ) ));
connect(src, SIGNAL( newSeparator() ),
dst, SIGNAL( newSeparator() ) );
connect(src, SIGNAL( endFolder() ),
dst, SIGNAL( endFolder() ) );
}
KBookmarkImporterBase* KBookmarkImporterBase::factory( const QString &type )
{
if (type == "netscape")
return new KNSBookmarkImporterImpl;
else if (type == "mozilla")
return new KMozillaBookmarkImporterImpl;
else if (type == "xbel")
return new KXBELBookmarkImporterImpl;
else if (type == "ie")
return new KIEBookmarkImporterImpl;
else if (type == "opera")
return new KOperaBookmarkImporterImpl;
else
return 0;
}
#include <kbookmarkimporter.moc>
KNSBookmarkImporterImpl
A class for importing NS bookmarks utf8 defaults to off.
Definition: kbookmarkimporter_ns.h:67
KBookmarkImporterBase::newBookmark
void newBookmark(const QString &text, const QCString &url, const QString &additionalInfo)
Notify about a new bookmark Use "html" for the icon.
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're going down one menu.
KBookmarkManager::managerForFile
static KBookmarkManager * managerForFile(const QString &bookmarksFile, bool bImportDesktopFiles=true)
This static function will return an instance of the KBookmarkManager, responsible for the given bookm...
Definition: kbookmarkmanager.cc:100
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
KBookmarkGroup
A group of bookmarks.
Definition: kbookmark.h:199
KBookmarkManager::root
KBookmarkGroup root() const
This will return the root bookmark.
Definition: kbookmarkmanager.cc:379
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
KBookmarkImporterBase::newFolder
void newFolder(const QString &text, bool open, const QString &additionalInfo)
Notify about a new folder Use "bookmark_folder" for the icon.

KDE Home | KDE Accessibility Home | Description of Access Keys