1 | // Copyright (C) 2016 The Qt Company Ltd. |
---|---|
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef XBELSUPPORT_H |
5 | #define XBELSUPPORT_H |
6 | |
7 | #include <QtCore/QXmlStreamReader> |
8 | #include <QtCore/QPersistentModelIndex> |
9 | |
10 | QT_FORWARD_DECLARE_CLASS(QIODevice) |
11 | QT_FORWARD_DECLARE_CLASS(QModelIndex) |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class BookmarkModel; |
16 | |
17 | class XbelWriter : public QXmlStreamWriter |
18 | { |
19 | public: |
20 | XbelWriter(BookmarkModel *model); |
21 | void writeToFile(QIODevice *device); |
22 | |
23 | private: |
24 | void writeData(const QModelIndex &index); |
25 | |
26 | private: |
27 | BookmarkModel *bookmarkModel; |
28 | }; |
29 | |
30 | class XbelReader : public QXmlStreamReader |
31 | { |
32 | public: |
33 | XbelReader(BookmarkModel *model); |
34 | bool readFromFile(QIODevice *device); |
35 | |
36 | private: |
37 | void readXBEL(); |
38 | void readFolder(); |
39 | void readBookmark(); |
40 | void readUnknownElement(); |
41 | |
42 | private: |
43 | BookmarkModel *bookmarkModel; |
44 | QList<QPersistentModelIndex> parents; |
45 | }; |
46 | |
47 | QT_END_NAMESPACE |
48 | |
49 | #endif // XBELSUPPORT_H |
50 |