diff --git a/autotests/kfileplacesmodeltest.cpp b/autotests/kfileplacesmodeltest.cpp --- a/autotests/kfileplacesmodeltest.cpp +++ b/autotests/kfileplacesmodeltest.cpp @@ -74,6 +74,7 @@ void testRefresh(); void testConvertedUrl_data(); void testConvertedUrl(); + void testBookmarkObject(); private: QStringList placesUrls() const; @@ -889,6 +890,16 @@ QCOMPARE(expectedUrl, convertedUrl); } +void KFilePlacesModelTest::testBookmarkObject() +{ + //make sure that all items return a valid bookmark + for (int row = 0; row < m_places->rowCount(); row++) { + const QModelIndex index = m_places->index(row, 0); + const KBookmark bookmark = m_places->bookmarkForIndex(index); + QVERIFY(!bookmark.isNull()); + } +} + QTEST_MAIN(KFilePlacesModelTest) #include "kfileplacesmodeltest.moc" diff --git a/src/filewidgets/kfileplacesmodel.cpp b/src/filewidgets/kfileplacesmodel.cpp --- a/src/filewidgets/kfileplacesmodel.cpp +++ b/src/filewidgets/kfileplacesmodel.cpp @@ -357,12 +357,7 @@ } KFilePlacesItem *item = static_cast(index.internalPointer()); - - if (!item->isDevice()) { - return item->bookmark(); - } else { - return KBookmark(); - } + return item->bookmark(); } QVariant KFilePlacesModel::data(const QModelIndex &index, int role) const