diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-09-13 09:20:44 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-09-14 08:51:10 +0300 |
commit | c8980d95e8dcec0f4014adb7e81a29aa0ee9ed62 (patch) | |
tree | d8dbef0a2f9935505f9c93cc97cc4d5f1756636f /src/bookmarks | |
parent | BookmarksMenu: show top-level bookmarks (diff) | |
download | rekonq-c8980d95e8dcec0f4014adb7e81a29aa0ee9ed62.tar.xz |
bugfix: don't wipe bookmarks if they're not modified
Diffstat (limited to 'src/bookmarks')
-rw-r--r-- | src/bookmarks/bookmarkstreemodel.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/bookmarks/bookmarkstreemodel.cpp b/src/bookmarks/bookmarkstreemodel.cpp index 8086ff64..a4f322b8 100644 --- a/src/bookmarks/bookmarkstreemodel.cpp +++ b/src/bookmarks/bookmarkstreemodel.cpp @@ -193,7 +193,8 @@ QMimeData *BookmarkModel::mimeData(const QModelIndexList &indexes) const for (const QModelIndex &index : indexes) { if (index.isValid() && index.column() == 0) items.append(item(index)); } - xbel::write(&buffer, items); + const auto write_result = xbel::write(&buffer, items); + Q_ASSERT(write_result == false); auto *mimeData = new QMimeData; mimeData->setData(mimeType, data); @@ -212,7 +213,8 @@ bool BookmarkModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction actio buffer.open(QIODevice::ReadOnly | QIODevice::Text); auto *fake_root = new BookmarksTreeItem(BookmarksTreeItem::Root, {}, nullptr); - xbel::read(&buffer, fake_root); + const auto read_result = xbel::read(&buffer, fake_root); + Q_ASSERT(read_result.isEmpty()); const auto childCount = static_cast<int>(fake_root->childCount()); auto *parentItem = item(parent); @@ -232,5 +234,5 @@ QList<QString> BookmarkModel::load(QIODevice *buffer) { return readFns[Formats:: void BookmarkModel::save(QIODevice *buffer) { if (!buffer->isOpen() || !buffer->isWritable()) return; - if (m_isModified) m_isModified = !writeFns[Formats::FormatXbel](buffer, {rootItem}); + m_isModified = !writeFns[Formats::FormatXbel](buffer, {rootItem}); } |