# kio Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kbookmarkimporter.cc

    00001 //  -*- c-basic-offset:4; indent-tabs-mode:nil -*-
    00002 // vim: set ts=4 sts=4 sw=4 et:
    00003 /* This file is part of the KDE libraries
    00004    Copyright (C) 2003 Alexander Kellett <lypanov@kde.org>
    00005
    00006    This library is free software; you can redistribute it and/or
    00007    modify it under the terms of the GNU Library General Public
    00008    License version 2 as published by the Free Software Foundation.
    00009
    00010    This library is distributed in the hope that it will be useful,
    00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013    Library General Public License for more details.
    00014
    00015    You should have received a copy of the GNU Library General Public License
    00016    along with this library; see the file COPYING.LIB.  If not, write to
    00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018    Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #include <kfiledialog.h>
    00022 #include <kstringhandler.h>
    00023 #include <klocale.h>
    00024 #include <kdebug.h>
    00025 #include <kcharsets.h>
    00026 #include <qtextcodec.h>
    00027
    00028 #include <sys/types.h>
    00029 #include <stddef.h>
    00030 #include <dirent.h>
    00031 #include <sys/stat.h>
    00032 #include <assert.h>
    00033
    00034 #include "kbookmarkmanager.h"
    00035
    00036 #include "kbookmarkimporter_ns.h"
    00037 #include "kbookmarkimporter_opera.h"
    00038 #include "kbookmarkimporter_ie.h"
    00039
    00040 #include "kbookmarkimporter.h"
    00041
    00042 void KXBELBookmarkImporterImpl::parse()
    00043 {
    00044   //kdDebug() << "KXBELBookmarkImporterImpl::parse()" << endl;
    00045   KBookmarkManager *manager = KBookmarkManager::managerForFile(m_fileName);
    00046   KBookmarkGroup root = manager->root();
    00047   traverse(root);
    00048   // FIXME delete it!
    00049   // delete manager;
    00050 }
    00051
    00052 void KXBELBookmarkImporterImpl::visit(const KBookmark &bk)
    00053 {
    00054   //kdDebug() << "KXBELBookmarkImporterImpl::visit" << endl;
    00055   if (bk.isSeparator())
    00056     emit newSeparator();
    00057   else
    00058     emit newBookmark(bk.fullText(), bk.url().url().utf8(), "");
    00059 }
    00060
    00061 void KXBELBookmarkImporterImpl::visitEnter(const KBookmarkGroup &grp)
    00062 {
    00063   //kdDebug() << "KXBELBookmarkImporterImpl::visitEnter" << endl;
    00064   emit newFolder(grp.fullText(), false, "");
    00065 }
    00066
    00067 void KXBELBookmarkImporterImpl::visitLeave(const KBookmarkGroup &)
    00068 {
    00069   //kdDebug() << "KXBELBookmarkImporterImpl::visitLeave" << endl;
    00070   emit endFolder();
    00071 }
    00072
    00073 void KBookmarkImporterBase::setupSignalForwards(QObject *src, QObject *dst)
    00074 {
    00075   connect(src, SIGNAL( newBookmark( const QString &, const QCString &, const QString & ) ),
    00076           dst, SIGNAL( newBookmark( const QString &, const QCString &, const QString & ) ));
    00077   connect(src, SIGNAL( newFolder( const QString &, bool, const QString & ) ),
    00078           dst, SIGNAL( newFolder( const QString &, bool, const QString & ) ));
    00079   connect(src, SIGNAL( newSeparator() ),
    00080           dst, SIGNAL( newSeparator() ) );
    00081   connect(src, SIGNAL( endFolder() ),
    00082           dst, SIGNAL( endFolder() ) );
    00083 }
    00084
    00085 KBookmarkImporterBase* KBookmarkImporterBase::factory( const QString &type )
    00086 {
    00087   if (type == "netscape")
    00088     return new KNSBookmarkImporterImpl;
    00089   else if (type == "mozilla")
    00090     return new KMozillaBookmarkImporterImpl;
    00091   else if (type == "xbel")
    00092     return new KXBELBookmarkImporterImpl;
    00093   else if (type == "ie")
    00094     return new KIEBookmarkImporterImpl;
    00095   else if (type == "opera")
    00096     return new KOperaBookmarkImporterImpl;
    00097   else
    00098     return 0;
    00099 }
    00100
    00101 #include <kbookmarkimporter.moc>

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:23:55 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003