]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge remote-tracking branch 'origin/KDE/4.11'
authorFrank Reininghaus <frank78ac@googlemail.com>
Mon, 29 Jul 2013 21:16:58 +0000 (23:16 +0200)
committerFrank Reininghaus <frank78ac@googlemail.com>
Mon, 29 Jul 2013 21:16:58 +0000 (23:16 +0200)
src/kitemviews/kfileitemlistview.cpp
src/kitemviews/kstandarditemlistview.cpp
src/kitemviews/kstandarditemlistview.h
src/views/dolphinitemlistview.cpp
src/views/dolphinitemlistview.h

index 2da238d7a1f7cca8de3ab05dec36007cf110f0c1..1f0fcbd6f7b88b78c3850d072ba7d4a0fdf3fd61 100644 (file)
@@ -213,12 +213,6 @@ void KFileItemListView::onPreviewsShownChanged(bool shown)
 
 void KFileItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
 {
-    if (previous == DetailsLayout || current == DetailsLayout) {
-        // The details-layout requires some invisible roles that
-        // must be added to the model if the new layout is "details".
-        // If the old layout was "details" the roles will get removed.
-        applyRolesToModel();
-    }
     KStandardItemListView::onItemLayoutChanged(current, previous);
     triggerVisibleIndexRangeUpdate();
 }
index bd4f6081fc1cb9dd8be49a0e31baab3e2177f45c..135cd0b7df0102e698cbde8155fb4a19d4206861 100644 (file)
@@ -48,23 +48,8 @@ void KStandardItemListView::setItemLayout(ItemLayout layout)
     const ItemLayout previous = m_itemLayout;
     m_itemLayout = layout;
 
-    switch (layout) {
-    case IconsLayout:
-        setScrollOrientation(Qt::Vertical);
-        setSupportsItemExpanding(false);
-        break;
-    case DetailsLayout:
-        setScrollOrientation(Qt::Vertical);
-        setSupportsItemExpanding(true);
-        break;
-    case CompactLayout:
-        setScrollOrientation(Qt::Horizontal);
-        setSupportsItemExpanding(false);
-        break;
-    default:
-        Q_ASSERT(false);
-        break;
-    }
+    setSupportsItemExpanding(itemLayoutSupportsItemExpanding(layout));
+    setScrollOrientation(layout == CompactLayout ? Qt::Horizontal : Qt::Vertical);
 
     onItemLayoutChanged(layout, previous);
 
@@ -117,6 +102,11 @@ bool KStandardItemListView::itemSizeHintUpdateRequired(const QSet<QByteArray>& c
     return false;
 }
 
+bool KStandardItemListView::itemLayoutSupportsItemExpanding(ItemLayout layout) const
+{
+    return layout == DetailsLayout;
+}
+
 void KStandardItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
 {
     Q_UNUSED(current);
index fd4fa861c63d5cb3130f2de01f3bbb5aee98c513..f5b0bfd8cf3f0884b42faa488cf1d926a35f66d3 100644 (file)
@@ -63,6 +63,7 @@ protected:
     virtual KItemListGroupHeaderCreatorBase* defaultGroupHeaderCreator() const;
     virtual void initializeItemListWidget(KItemListWidget* item);
     virtual bool itemSizeHintUpdateRequired(const QSet<QByteArray>& changedRoles) const;
+    virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout) const;
     virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous);
     virtual void onScrollOrientationChanged(Qt::Orientation current, Qt::Orientation previous);
     virtual void onSupportsItemExpandingChanged(bool supportsExpanding);
index 039b5f230ba7acc95d31f5d7072cefc6dc7a12ad..4799d76794106e9fb7e6d89aa11e22fae27cdd3d 100644 (file)
@@ -89,10 +89,7 @@ void DolphinItemListView::readSettings()
     beginTransaction();
 
     setEnabledSelectionToggles(GeneralSettings::showSelectionToggle());
-
-    const bool expandableFolders = (itemLayout() == KFileItemListView::DetailsLayout) &&
-                                   DetailsModeSettings::expandableFolders();
-    setSupportsItemExpanding(expandableFolders);
+    setSupportsItemExpanding(itemLayoutSupportsItemExpanding(itemLayout()));
 
     updateFont();
     updateGridSize();
@@ -119,19 +116,19 @@ KItemListWidgetCreatorBase* DolphinItemListView::defaultWidgetCreator() const
     return new KItemListWidgetCreator<DolphinFileItemListWidget>();
 }
 
-void DolphinItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
+bool DolphinItemListView::itemLayoutSupportsItemExpanding(ItemLayout layout) const
 {
-    Q_UNUSED(previous);
+    return layout == DetailsLayout && DetailsModeSettings::expandableFolders();
+}
 
-    if (current == DetailsLayout) {
-        setSupportsItemExpanding(DetailsModeSettings::expandableFolders());
-        setHeaderVisible(true);
-    } else {
-        setHeaderVisible(false);
-    }
+void DolphinItemListView::onItemLayoutChanged(ItemLayout current, ItemLayout previous)
+{
+    setHeaderVisible(current == DetailsLayout);
 
     updateFont();
     updateGridSize();
+
+    KFileItemListView::onItemLayoutChanged(current, previous);
 }
 
 void DolphinItemListView::onPreviewsShownChanged(bool shown)
index c2d86cc5e21efc0344b6662465e00e8fc65cda42..18bb284ace61ccf2efdecacd590fff0bfce567df 100644 (file)
@@ -50,6 +50,7 @@ public:
 
 protected:
     virtual KItemListWidgetCreatorBase* defaultWidgetCreator() const;
+    virtual bool itemLayoutSupportsItemExpanding(ItemLayout layout) const;
     virtual void onItemLayoutChanged(ItemLayout current, ItemLayout previous);
     virtual void onPreviewsShownChanged(bool shown);
     virtual void onVisibleRolesChanged(const QList<QByteArray>& current,