File indexing completed on 2024-09-08 12:13:24
0001 // -*- c-basic-offset:4; indent-tabs-mode:nil -*- 0002 /* 0003 This file is part of the KDE libraries 0004 SPDX-FileCopyrightText: 2000 David Faure <faure@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.0-only 0007 */ 0008 0009 #ifndef __kbookmarkimporter_ns_h 0010 #define __kbookmarkimporter_ns_h 0011 0012 #include "kbookmarkexporter.h" 0013 #include "kbookmarkimporter.h" 0014 0015 /** 0016 * A class for importing NS bookmarks 0017 * utf8 defaults to off 0018 */ 0019 class KBOOKMARKS_EXPORT KNSBookmarkImporterImpl : public KBookmarkImporterBase 0020 { 0021 Q_OBJECT // For QObject::tr 0022 public : KNSBookmarkImporterImpl() 0023 : m_utf8(false) 0024 { 0025 } 0026 void setUtf8(bool utf8) 0027 { 0028 m_utf8 = utf8; 0029 } 0030 void parse() override; 0031 QString findDefaultLocation(bool forSaving = false) const override; 0032 0033 private: 0034 KBOOKMARKS_NO_EXPORT QString toUnicode(const QByteArray &data) const; 0035 0036 private: 0037 bool m_utf8; 0038 class KNSBookmarkImporterImplPrivate *d; 0039 }; 0040 0041 /** 0042 * A class for importing Mozilla bookmarks 0043 * utf8 defaults to on 0044 */ 0045 class KBOOKMARKS_EXPORT KMozillaBookmarkImporterImpl : public KNSBookmarkImporterImpl 0046 { 0047 Q_OBJECT 0048 public: 0049 KMozillaBookmarkImporterImpl() 0050 { 0051 setUtf8(true); 0052 } 0053 0054 private: 0055 class KMozillaBookmarkImporterImplPrivate *d; 0056 }; 0057 0058 class KBOOKMARKS_EXPORT KNSBookmarkExporterImpl : public KBookmarkExporterBase 0059 { 0060 public: 0061 KNSBookmarkExporterImpl(KBookmarkManager *mgr, const QString &fileName) 0062 : KBookmarkExporterBase(mgr, fileName) 0063 { 0064 ; 0065 } 0066 ~KNSBookmarkExporterImpl() override 0067 { 0068 } 0069 void write(const KBookmarkGroup &parent) override; 0070 void setUtf8(bool); 0071 0072 protected: 0073 QString folderAsString(const KBookmarkGroup &parent) const; 0074 0075 private: 0076 bool m_utf8; 0077 class KNSBookmarkExporterImplPrivate *d; 0078 }; 0079 0080 #endif