KIO
kbookmarkimporter.h
Go to the documentation of this file.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) 2000 David Faure <faure@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., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef __kbookmarkimporter_h 00022 #define __kbookmarkimporter_h 00023 00024 #include <QtCore/QStringList> 00025 #include <kconfig.h> 00026 00027 #include "kbookmark.h" 00028 00034 class KIO_EXPORT KBookmarkImporterBase : public QObject 00035 { 00036 Q_OBJECT 00037 public: 00038 KBookmarkImporterBase() {} 00039 virtual ~KBookmarkImporterBase() {} 00040 00041 void setFilename(const QString &filename) { m_fileName = filename; } 00042 00043 virtual void parse() = 0; 00044 virtual QString findDefaultLocation(bool forSaving = false) const = 0; 00045 00046 // TODO - make this static? 00047 void setupSignalForwards(QObject *src, QObject *dst); 00048 static KBookmarkImporterBase *factory(const QString &type); 00049 00050 Q_SIGNALS: 00055 void newBookmark(const QString & text, const QString & url, const QString & additionalInfo); 00056 00061 void newFolder(const QString & text, bool open, const QString & additionalInfo); 00062 00066 void newSeparator(); 00067 00072 void endFolder(); 00073 00074 protected: 00075 QString m_fileName; 00076 00077 private: 00078 class KBookmarkImporterBasePrivate *d; 00079 }; 00080 00084 class KIO_EXPORT KXBELBookmarkImporterImpl : public KBookmarkImporterBase, protected KBookmarkGroupTraverser 00085 { 00086 Q_OBJECT 00087 public: 00088 KXBELBookmarkImporterImpl() {} 00089 virtual void parse(); 00090 virtual QString findDefaultLocation(bool = false) const { return QString(); } 00091 protected: 00092 virtual void visit(const KBookmark &); 00093 virtual void visitEnter(const KBookmarkGroup &); 00094 virtual void visitLeave(const KBookmarkGroup &); 00095 private: 00096 class KXBELBookmarkImporterImplPrivate *d; 00097 }; 00098 00099 00100 #endif