┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/panels/places/placesitemmodel.cpp
diff options
context:
space:
mode:
authorRenato Araujo Oliveira Filho <[email protected]>2018-01-19 13:37:09 -0300
committerRenato Araujo Oliveira Filho <[email protected]>2018-01-26 11:14:30 -0300
commita8a3fa51a0649ffc43b0d740c268e39a6dd6672b (patch)
treef89bb52f464dd19733cc546e18a4551c9eb9fa1d /src/panels/places/placesitemmodel.cpp
parent3bf68fd71492f02bffb6cf040e9471c5e997180e (diff)
Fix place item edit after creation
Summary: Make sure that the place can be edited after the creation. Depends on D9333 BUG: 389147 Test Plan: Create an item in dolphin places panel, make sure that you can rename it Reviewers: #dolphin, ngraham Reviewed By: ngraham Subscribers: michaelh, elvisangelaccio, lbeltrame, ngraham, #dolphin Differential Revision: https://phabricator.kde.org/D9985
Diffstat (limited to 'src/panels/places/placesitemmodel.cpp')
-rw-r--r--src/panels/places/placesitemmodel.cpp8
1 files changed, 6 insertions, 2 deletions
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);
}