]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/panels/places/placesitemmodel.cpp
Merge branch 'Applications/18.08'
[dolphin.git] / src / panels / places / placesitemmodel.cpp
index 3641b3e42a0e4c8cb9ced8d78f4526ef9b6a64f6..f7fe5587c7fa3cd2c5ce855982aad8e93fe83925 100644 (file)
@@ -120,11 +120,6 @@ void PlacesItemModel::setHiddenItemsShown(bool show)
             }
         }
     }
-
-#ifdef PLACESITEMMODEL_DEBUG
-        qCDebug(DolphinDebug) << "Changed visibility of hidden items";
-        showModelState();
-#endif
 }
 
 bool PlacesItemModel::hiddenItemsShown() const
@@ -169,10 +164,6 @@ void PlacesItemModel::insertSortedItem(PlacesItem* item)
 void PlacesItemModel::onItemInserted(int index)
 {
     KStandardItemModel::onItemInserted(index);
-#ifdef PLACESITEMMODEL_DEBUG
-    qCDebug(DolphinDebug) << "Inserted item" << index;
-    showModelState();
-#endif
 }
 
 void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem)
@@ -180,10 +171,6 @@ void PlacesItemModel::onItemRemoved(int index, KStandardItem* removedItem)
     m_indexMap.removeAt(index);
 
     KStandardItemModel::onItemRemoved(index, removedItem);
-#ifdef PLACESITEMMODEL_DEBUG
-    qCDebug(DolphinDebug) << "Removed item" << index;
-    showModelState();
-#endif
 }
 
 void PlacesItemModel::onItemChanged(int index, const QSet<QByteArray>& changedRoles)
@@ -453,7 +440,7 @@ void PlacesItemModel::initializeDefaultViewProperties() const
                 } else if (path == QLatin1String("/images")) {
                     props.setViewMode(DolphinView::IconsView);
                     props.setPreviewsShown(true);
-                    props.setVisibleRoles({"text", "imageSize"});
+                    props.setVisibleRoles({"text", "height", "width"});
                 } else if (path == QLatin1String("/audio")) {
                     props.setViewMode(DolphinView::DetailsView);
                     props.setPreviewsShown(false);
@@ -597,7 +584,8 @@ void PlacesItemModel::onSourceModelDataChanged(const QModelIndex &topLeft, const
 
 void PlacesItemModel::onSourceModelGroupHiddenChanged(KFilePlacesModel::GroupType group, bool hidden)
 {
-    for(const QModelIndex &sourceIndex : m_sourceModel->groupIndexes(group)) {
+    const auto groupIndexes = m_sourceModel->groupIndexes(group);
+    for (const QModelIndex &sourceIndex : groupIndexes) {
         PlacesItem *item = placesItem(mapFromSource(sourceIndex));
         if (item) {
             item->setGroupHidden(hidden);
@@ -634,11 +622,6 @@ void PlacesItemModel::loadBookmarks()
             addItemFromSourceModel(sourceIndex);
         }
     }
-
-#ifdef PLACESITEMMODEL_DEBUG
-    qCDebug(DolphinDebug) << "Loaded bookmarks";
-    showModelState();
-#endif
 }
 
 void PlacesItemModel::clear() {
@@ -785,44 +768,3 @@ PlacesItem *PlacesItemModel::itemFromBookmark(const KBookmark &bookmark) const
     return nullptr;
 }
 
-#ifdef PLACESITEMMODEL_DEBUG
-void PlacesItemModel::showModelState()
-{
-    qCDebug(DolphinDebug) << "=================================";
-    qCDebug(DolphinDebug) << "Model:";
-    qCDebug(DolphinDebug) << "hidden-index model-index   text";
-    int modelIndex = 0;
-    for (int i = 0; i < m_bookmarkedItems.count(); ++i) {
-        if (m_bookmarkedItems[i]) {
-            qCDebug(DolphinDebug) <<  i << "(Hidden)    " << "             " << m_bookmarkedItems[i]->dataValue("text").toString();
-        } else {
-            if (item(modelIndex)) {
-                qCDebug(DolphinDebug) <<  i << "          " << modelIndex << "           " << item(modelIndex)->dataValue("text").toString();
-            } else {
-                qCDebug(DolphinDebug) <<  i << "          " << modelIndex << "           " << "(not available yet)";
-            }
-            ++modelIndex;
-        }
-    }
-
-    qCDebug(DolphinDebug);
-    qCDebug(DolphinDebug) << "Bookmarks:";
-
-    int bookmarkIndex = 0;
-    KBookmarkGroup root = m_bookmarkManager->root();
-    KBookmark bookmark = root.first();
-    while (!bookmark.isNull()) {
-        const QString udi = bookmark.metaDataItem("UDI");
-        const QString text = udi.isEmpty() ? bookmark.text() : udi;
-        if (bookmark.metaDataItem("IsHidden") == QLatin1String("true")) {
-            qCDebug(DolphinDebug) << bookmarkIndex << "(Hidden)" << text;
-        } else {
-            qCDebug(DolphinDebug) << bookmarkIndex << "        " << text;
-        }
-
-        bookmark = root.next(bookmark);
-        ++bookmarkIndex;
-    }
-}
-#endif
-