kbookmarkimporter_ns.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __kbookmarkimporter_ns_h
00022 #define __kbookmarkimporter_ns_h
00023
00024 #include <qdom.h>
00025 #include <qcstring.h>
00026 #include <qstringlist.h>
00027 #include <ksimpleconfig.h>
00028 #include <kdemacros.h>
00029
00030 #include "kbookmarkimporter.h"
00031 #include "kbookmarkexporter.h"
00032
00037 class KIO_EXPORT_DEPRECATED KNSBookmarkImporter : public QObject
00038 {
00039 Q_OBJECT
00040 public:
00041 KNSBookmarkImporter( const QString & fileName ) : m_fileName(fileName) {}
00042 ~KNSBookmarkImporter() {}
00043
00044
00045 void parseNSBookmarks() { parseNSBookmarks(false); }
00046
00047 void parseNSBookmarks( bool utf8 );
00048
00049 static QString netscapeBookmarksFile( bool forSaving=false );
00050 static QString mozillaBookmarksFile( bool forSaving=false );
00051
00052 signals:
00053 void newBookmark( const QString & text, const QCString & url, const QString & additionalInfo );
00054 void newFolder( const QString & text, bool open, const QString & additionalInfo );
00055 void newSeparator();
00056 void endFolder();
00057
00058 protected:
00059 QString m_fileName;
00060 };
00061
00067 class KIO_EXPORT KNSBookmarkImporterImpl : public KBookmarkImporterBase
00068 {
00069 public:
00070 KNSBookmarkImporterImpl() : m_utf8(false) { }
00071 void setUtf8(bool utf8) { m_utf8 = utf8; }
00072 virtual void parse();
00073 virtual QString findDefaultLocation(bool forSaving = false) const;
00074 private:
00075 bool m_utf8;
00076 class KNSBookmarkImporterImplPrivate *d;
00077 };
00078
00084 class KIO_EXPORT KMozillaBookmarkImporterImpl : public KNSBookmarkImporterImpl
00085 {
00086 public:
00087 KMozillaBookmarkImporterImpl() { setUtf8(true); }
00088 private:
00089 class KMozillaBookmarkImporterImplPrivate *d;
00090 };
00091
00097 class KIO_EXPORT_DEPRECATED KNSBookmarkExporter
00098 {
00099 public:
00100 KNSBookmarkExporter(KBookmarkManager* mgr, const QString & fileName)
00101 : m_fileName(fileName), m_pManager(mgr) { }
00102 ~KNSBookmarkExporter() {}
00103
00104 void write() { write(false); }
00105 void write( bool utf8 );
00106
00107 protected:
00108 void writeFolder(QTextStream &stream, KBookmarkGroup parent);
00109 QString m_fileName;
00110 KBookmarkManager* m_pManager;
00111 };
00112
00116 class KIO_EXPORT KNSBookmarkExporterImpl : public KBookmarkExporterBase
00117 {
00118 public:
00119 KNSBookmarkExporterImpl(KBookmarkManager* mgr, const QString & fileName)
00120 : KBookmarkExporterBase(mgr, fileName)
00121 { ; }
00122 virtual ~KNSBookmarkExporterImpl() {}
00123 virtual void write(KBookmarkGroup);
00124 void setUtf8(bool);
00125 protected:
00126 QString folderAsString(KBookmarkGroup) const;
00127 private:
00128 bool m_utf8;
00129 class KNSBookmarkExporterImplPrivate *d;
00130 };
00131
00132 #endif
|