diff options
Diffstat (limited to 'lib/bookmarks/model/bookmarkmodel.cpp')
-rw-r--r-- | lib/bookmarks/model/bookmarkmodel.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/lib/bookmarks/model/bookmarkmodel.cpp b/lib/bookmarks/model/bookmarkmodel.cpp index 977248c..9214c24 100644 --- a/lib/bookmarks/model/bookmarkmodel.cpp +++ b/lib/bookmarks/model/bookmarkmodel.cpp @@ -72,8 +72,10 @@ bool BookmarkModel::setData(const QModelIndex &index, const QVariant &value, int success = static_cast<BookmarkItem *>(index.internalPointer())->setData(static_cast<BookmarkItem::Fields>(index.column()), value); } - if(success) + if(success) { emit dataChanged(index, index, { role }); + m_isModified = true; + } return success; } @@ -83,8 +85,10 @@ bool BookmarkModel::setData(const QModelIndex &index, const QVariant &value, Boo return false; bool success = static_cast<BookmarkItem *>(index.internalPointer())->setData(column, value); - if(success) + if(success) { emit dataChanged(index, index, { role }); + m_isModified = true; + } return success; } @@ -104,11 +108,13 @@ bool BookmarkModel::isItemExpanded(const QModelIndex &index) const return static_cast<BookmarkItem *>(index.internalPointer())->isExpanded(); } -void BookmarkModel::setItemExpanded(const QModelIndex& index, bool expanded) +void BookmarkModel::setItemExpanded(const QModelIndex &index, bool expanded) { BookmarkItem *item = getItem(index); - if(item->type() == BookmarkItem::Folder) + if(item->type() == BookmarkItem::Folder) { item->setExpanded(expanded); + m_isModified = true; + } } int BookmarkModel::rowCount(const QModelIndex &index) const @@ -129,6 +135,7 @@ QModelIndex BookmarkModel::appendBookmark(const QString &title, const QString &u parentItem->appendChild(childItem); endInsertRows(); + m_isModified = true; return createIndex(row, 0, childItem); } @@ -142,6 +149,7 @@ QModelIndex BookmarkModel::appendFolder(const QString &title, const QModelIndex parentItem->appendChild(childItem); endInsertRows(); + m_isModified = true; return createIndex(row, 0, childItem); } @@ -152,6 +160,9 @@ bool BookmarkModel::removeRows(int position, int rows, const QModelIndex &parent beginRemoveRows(parent, position, position + rows - 1); bool success = parentItem->removeChildAt(position, rows); endRemoveRows(); + + if(success) + m_isModified = true; return success; } @@ -339,5 +350,7 @@ bool BookmarkModel::dropMimeData(const QMimeData *mimeData, Qt::DropAction actio delete fakeRoot; } + + m_isModified = true; return true; } |