┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels
diff options
context:
space:
mode:
Diffstat (limited to 'src/panels')
-rw-r--r--src/panels/places/placesitem.cpp9
-rw-r--r--src/panels/places/placesitemmodel.cpp8
2 files changed, 12 insertions, 5 deletions
diff --git a/src/panels/places/placesitem.cpp b/src/panels/places/placesitem.cpp
index d7e87cf7a..3c6023ba8 100644
--- a/src/panels/places/placesitem.cpp
+++ b/src/panels/places/placesitem.cpp
@@ -129,12 +129,15 @@ Solid::Device PlacesItem::device() const
void PlacesItem::setBookmark(const KBookmark& bookmark)
{
- if (bookmark == m_bookmark) {
- return;
- }
+ const bool bookmarkDataChanged = !(bookmark == m_bookmark);
+ // bookmark object must be updated to keep in sync with source model
m_bookmark = bookmark;
+ if (!bookmarkDataChanged) {
+ return;
+ }
+
delete m_access;
delete m_volume;
delete m_disc;
diff --git a/src/panels/places/placesitemmodel.cpp b/src/panels/places/placesitemmodel.cpp
index bee3b7cbe..077c9044c 100644
--- a/src/panels/places/placesitemmodel.cpp
+++ b/src/panels/places/placesitemmodel.cpp
@@ -410,7 +410,10 @@ void PlacesItemModel::addItemFromSourceModel(const QModelIndex &index)
const KBookmark bookmark = m_sourceModel->bookmarkForIndex(index);
Q_ASSERT(!bookmark.isNull());
- PlacesItem *item = new PlacesItem(bookmark);
+ PlacesItem *item = itemFromBookmark(bookmark);
+ if (!item) {
+ item = new PlacesItem(bookmark);
+ }
updateItem(item, index);
insertSortedItem(item);
@@ -602,6 +605,8 @@ void PlacesItemModel::onSourceModelDataChanged(const QModelIndex &topLeft, const
placeItem->setUrl(m_sourceModel->url(sourceIndex));
placeItem->bookmark().setMetaDataItem(QStringLiteral("OnlyInApp"),
bookmark.metaDataItem(QStringLiteral("OnlyInApp")));
+ // must update the bookmark object
+ placeItem->setBookmark(bookmark);
}
}
}
@@ -641,7 +646,6 @@ void PlacesItemModel::loadBookmarks()
{
for(int r = 0, rMax = m_sourceModel->rowCount(); r < rMax; r++) {
const QModelIndex sourceIndex = m_sourceModel->index(r, 0);
- KBookmark bookmark = m_sourceModel->bookmarkForIndex(sourceIndex);
if (m_hiddenItemsShown || !m_sourceModel->isHidden(sourceIndex)) {
addItemFromSourceModel(sourceIndex);
}