From c2d18d73b0e1a74525ec0cda36a2e2e7e5b4ff4c Mon Sep 17 00:00:00 2001 From: aqua Date: Sun, 14 Aug 2022 18:47:37 +0300 Subject: Import BookmarkModel from poi --- src/bookmarks/bookmarkstreeformat_xbel.h | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/bookmarks/bookmarkstreeformat_xbel.h (limited to 'src/bookmarks/bookmarkstreeformat_xbel.h') diff --git a/src/bookmarks/bookmarkstreeformat_xbel.h b/src/bookmarks/bookmarkstreeformat_xbel.h new file mode 100644 index 00000000..c156eb24 --- /dev/null +++ b/src/bookmarks/bookmarkstreeformat_xbel.h @@ -0,0 +1,67 @@ +/* ============================================================ + * rekonq + * ============================================================ + * SPDX-License-Identifier: GPL-3.0-only + * Copyright (C) 2022 aqua + * ============================================================ + * Description: rekonq bookmarks model + * ============================================================ */ + +#pragma once + +#include + +class QIODevice; +class BookmarksTreeItem; + +namespace xbel { +/** + * Parse an XBEL-formatted BookmarkItem tree + * @param device QIODEvice pointer to read from + * @param root BookmarkItem tree root pointer + * @return true if parsing was successful, false if errors occurred + */ +[[nodiscard]] bool read(QIODevice *device, BookmarksTreeItem *root); + +/** + * Write items into device + * @param device + * @param items + * @return true on success + */ +[[nodiscard]] bool write(QIODevice *device, const QVector &items); + +// 3.2 Top-level Information +constexpr auto *elem_xbel{"xbel"}; +constexpr auto *attr_version{"version"}; +constexpr auto *attr_version_value{"1.0"}; + +// 3.3 Common Elements +static const QLatin1String elem_title{"title"}; +static const QLatin1String elem_desc{"desc"}; +static const QLatin1String elem_info{"info"}; +static const QLatin1String elem_metadata{"metadata"}; +static const QLatin1String elem_metadata_owner{"owner"}; +static const QLatin1String elem_metadata_owner_value{"rekonq"}; + +// 3.4 Data Organization +static const QLatin1String elem_bookmark{"bookmark"}; +static const QLatin1String elem_folder{"folder"}; +static const QLatin1String elem_separator{"separator"}; +static const QLatin1String elem_alias{"alias"}; + +// node attributes +constexpr auto *attr_id{"id"}; +constexpr auto *attr_added{"added"}; + +// url attributes +constexpr auto *attr_href{"href"}; +constexpr auto *attr_visited{"visited"}; +constexpr auto *attr_modified{"modified"}; + +constexpr auto *attr_ref{"ref"}; +constexpr auto *attr_folded{"folded"}; +constexpr auto *attr_folded_yes{"yes"}; +constexpr auto *attr_folded_no{"no"}; + +} // namespace xbel -- cgit v1.2.1