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 <qdom.h> 00025 #include <qcstring.h> 00026 #include <qstringlist.h> 00027 #include <ksimpleconfig.h> 00028 00029 #include "kbookmark.h" 00030 00037 class KIO_EXPORT KBookmarkImporterBase : public QObject 00038 { 00039 Q_OBJECT 00040 public: 00041 KBookmarkImporterBase() {} 00042 virtual ~KBookmarkImporterBase() {} 00043 00044 void setFilename(const QString &filename) { m_fileName = filename; } 00045 00046 virtual void parse() = 0; 00047 virtual QString findDefaultLocation(bool forSaving = false) const = 0; 00048 00049 // TODO - make this static? 00050 void setupSignalForwards(QObject *src, QObject *dst); 00051 static KBookmarkImporterBase *factory(const QString &type); 00052 00053 signals: 00058 void newBookmark(const QString & text, const QCString & url, const QString & additionalInfo); 00059 00064 void newFolder(const QString & text, bool open, const QString & additionalInfo); 00065 00069 void newSeparator(); 00070 00075 void endFolder(); 00076 00077 protected: 00078 QString m_fileName; 00079 00080 private: 00081 class KBookmarkImporterBasePrivate *d; 00082 }; 00083 00087 class KIO_EXPORT KXBELBookmarkImporterImpl : public KBookmarkImporterBase, protected KBookmarkGroupTraverser 00088 { 00089 Q_OBJECT 00090 public: 00091 KXBELBookmarkImporterImpl() {} 00092 virtual void parse(); 00093 virtual QString findDefaultLocation(bool = false) const { return QString::null; } 00094 protected: 00095 virtual void visit(const KBookmark &); 00096 virtual void visitEnter(const KBookmarkGroup &); 00097 virtual void visitLeave(const KBookmarkGroup &); 00098 private: 00099 class KXBELBookmarkImporterImplPrivate *d; 00100 }; 00101 00102 // for SC 00103 #include "kbookmarkimporter_ns.h" 00104 #include "kbookmarkimporter_kde1.h" 00105 00106 #endif