┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dolphindockwidget.cpp14
-rw-r--r--src/dolphinpart.desktop2
-rw-r--r--src/kitemviews/kfileitemlistview.cpp6
-rw-r--r--src/kitemviews/kfileitemmodel.cpp50
-rw-r--r--src/kitemviews/kitemlistview.cpp11
-rw-r--r--src/kitemviews/kitemlistview.h1
-rw-r--r--src/kitemviews/kitemmodelbase.h9
-rw-r--r--src/kitemviews/kstandarditemlistview.cpp24
-rw-r--r--src/kitemviews/kstandarditemlistview.h1
-rw-r--r--src/kitemviews/private/kitemlistsizehintresolver.cpp2
-rw-r--r--src/tests/kfileitemmodeltest.cpp35
-rw-r--r--src/views/dolphinitemlistview.cpp21
-rw-r--r--src/views/dolphinitemlistview.h1
-rw-r--r--src/views/dolphinview.cpp2
14 files changed, 110 insertions, 69 deletions
diff --git a/src/dolphindockwidget.cpp b/src/dolphindockwidget.cpp
index 0d8aea7bd..6495c8da9 100644
--- a/src/dolphindockwidget.cpp
+++ b/src/dolphindockwidget.cpp
@@ -21,6 +21,14 @@
#include <QStyle>
+namespace {
+ // Disable the 'Floatable' feature, i.e., the possibility to drag the
+ // dock widget out of the main window. This works around problems like
+ // https://bugs.kde.org/show_bug.cgi?id=288629
+ // https://bugs.kde.org/show_bug.cgi?id=322299
+ const QDockWidget::DockWidgetFeatures DefaultDockWidgetFeatures = QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetClosable;
+}
+
// Empty titlebar for the dock widgets when "Lock Layout" has been activated.
class DolphinDockTitleBar : public QWidget
{
@@ -45,6 +53,7 @@ DolphinDockWidget::DolphinDockWidget(const QString& title, QWidget* parent, Qt::
m_locked(false),
m_dockTitleBar(0)
{
+ setFeatures(DefaultDockWidgetFeatures);
}
DolphinDockWidget::DolphinDockWidget(QWidget* parent, Qt::WindowFlags flags) :
@@ -52,6 +61,7 @@ DolphinDockWidget::DolphinDockWidget(QWidget* parent, Qt::WindowFlags flags) :
m_locked(false),
m_dockTitleBar(0)
{
+ setFeatures(DefaultDockWidgetFeatures);
}
DolphinDockWidget::~DolphinDockWidget()
@@ -71,9 +81,7 @@ void DolphinDockWidget::setLocked(bool lock)
setFeatures(QDockWidget::NoDockWidgetFeatures);
} else {
setTitleBarWidget(0);
- setFeatures(QDockWidget::DockWidgetMovable |
- QDockWidget::DockWidgetFloatable |
- QDockWidget::DockWidgetClosable);
+ setFeatures(DefaultDockWidgetFeatures);
}
}
}
diff --git a/src/dolphinpart.desktop b/src/dolphinpart.desktop
index a553034a2..09019ded1 100644
--- a/src/dolphinpart.desktop
+++ b/src/dolphinpart.desktop
@@ -323,7 +323,7 @@ Name[te]=వివరాలు
Name[tg]=Тафсилотҳо
Name[th]=รายละเอียด
Name[tr]=Ayrıntılar
-Name[ug]=تەپسىلاتى
+Name[ug]=تەپسىلاتلار
Name[uk]=Подробиці
Name[uz]=Tafsilotlar
Name[uz@cyrillic]=Тафсилотлар
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp
index 2da238d7a..1f0fcbd6f 100644
--- a/src/kitemviews/kfileitemlistview.cpp
+++ b/src/kitemviews/kfileitemlistview.cpp
@@ -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();
}
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp
index 70e8834a6..eb7b16461 100644
--- a/src/kitemviews/kfileitemmodel.cpp
+++ b/src/kitemviews/kfileitemmodel.cpp
@@ -711,7 +711,6 @@ void KFileItemModel::resortAllItems()
oldUrls.append(itemData->item.url());
}
- m_groups.clear();
m_items.clear();
// Resort the items
@@ -720,20 +719,45 @@ void KFileItemModel::resortAllItems()
m_items.insert(m_itemData.at(i)->item.url(), i);
}
- // Determine the indexes that have been moved
- QList<int> movedToIndexes;
- movedToIndexes.reserve(itemCount);
- for (int i = 0; i < itemCount; i++) {
- const int newIndex = m_items.value(oldUrls.at(i));
- movedToIndexes.append(newIndex);
+ // Determine the first index that has been moved.
+ int firstMovedIndex = 0;
+ while (firstMovedIndex < itemCount
+ && firstMovedIndex == m_items.value(oldUrls.at(firstMovedIndex))) {
+ ++firstMovedIndex;
}
- // Don't check whether items have really been moved and always emit a
- // itemsMoved() signal after resorting: In case of grouped items
- // the groups might change even if the items themselves don't change their
- // position. Let the receiver of the signal decide whether a check for moved
- // items makes sense.
- emit itemsMoved(KItemRange(0, itemCount), movedToIndexes);
+ const bool itemsHaveMoved = firstMovedIndex < itemCount;
+ if (itemsHaveMoved) {
+ m_groups.clear();
+
+ int lastMovedIndex = itemCount - 1;
+ while (lastMovedIndex > firstMovedIndex
+ && lastMovedIndex == m_items.value(oldUrls.at(lastMovedIndex))) {
+ --lastMovedIndex;
+ }
+
+ Q_ASSERT(firstMovedIndex <= lastMovedIndex);
+
+ // Create a list movedToIndexes, which has the property that
+ // movedToIndexes[i] is the new index of the item with the old index
+ // firstMovedIndex + i.
+ const int movedItemsCount = lastMovedIndex - firstMovedIndex + 1;
+ QList<int> movedToIndexes;
+ movedToIndexes.reserve(movedItemsCount);
+ for (int i = firstMovedIndex; i <= lastMovedIndex; ++i) {
+ const int newIndex = m_items.value(oldUrls.at(i));
+ movedToIndexes.append(newIndex);
+ }
+
+ emit itemsMoved(KItemRange(firstMovedIndex, movedItemsCount), movedToIndexes);
+ } else if (groupedSorting()) {
+ // The groups might have changed even if the order of the items has not.
+ const QList<QPair<int, QVariant> > oldGroups = m_groups;
+ m_groups.clear();
+ if (groups() != oldGroups) {
+ emit groupsChanged();
+ }
+ }
#ifdef KFILEITEMMODEL_DEBUG
kDebug() << "[TIME] Resorting of" << itemCount << "items:" << timer.elapsed();
diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp
index 7f1526151..d8edcfc50 100644
--- a/src/kitemviews/kitemlistview.cpp
+++ b/src/kitemviews/kitemlistview.cpp
@@ -1229,6 +1229,13 @@ void KItemListView::slotItemsChanged(const KItemRangeList& itemRanges,
QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
}
+void KItemListView::slotGroupsChanged()
+{
+ updateVisibleGroupHeaders();
+ doLayout(NoAnimation);
+ updateSiblingsInformation();
+}
+
void KItemListView::slotGroupedSortingChanged(bool current)
{
m_grouped = current;
@@ -1523,6 +1530,8 @@ void KItemListView::setModel(KItemModelBase* model)
this, SLOT(slotItemsRemoved(KItemRangeList)));
disconnect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
+ disconnect(m_model, SIGNAL(groupsChanged()),
+ this, SLOT(slotGroupsChanged()));
disconnect(m_model, SIGNAL(groupedSortingChanged(bool)),
this, SLOT(slotGroupedSortingChanged(bool)));
disconnect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
@@ -1546,6 +1555,8 @@ void KItemListView::setModel(KItemModelBase* model)
this, SLOT(slotItemsRemoved(KItemRangeList)));
connect(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)),
this, SLOT(slotItemsMoved(KItemRange,QList<int>)));
+ connect(m_model, SIGNAL(groupsChanged()),
+ this, SLOT(slotGroupsChanged()));
connect(m_model, SIGNAL(groupedSortingChanged(bool)),
this, SLOT(slotGroupedSortingChanged(bool)));
connect(m_model, SIGNAL(sortOrderChanged(Qt::SortOrder,Qt::SortOrder)),
diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h
index 6467b8c91..14360b02b 100644
--- a/src/kitemviews/kitemlistview.h
+++ b/src/kitemviews/kitemlistview.h
@@ -394,6 +394,7 @@ protected slots:
virtual void slotItemsMoved(const KItemRange& itemRange, const QList<int>& movedToIndexes);
virtual void slotItemsChanged(const KItemRangeList& itemRanges,
const QSet<QByteArray>& roles);
+ virtual void slotGroupsChanged();
virtual void slotGroupedSortingChanged(bool current);
virtual void slotSortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous);
diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h
index 70f688390..7545192da 100644
--- a/src/kitemviews/kitemmodelbase.h
+++ b/src/kitemviews/kitemmodelbase.h
@@ -218,11 +218,20 @@ signals:
* with the items 5 and 6 then the parameters look like this:
* - itemRange: has the index 0 and a count of 7.
* - movedToIndexes: Contains the seven values 5, 6, 2, 3, 4, 0, 1
+ *
+ * This signal implies that the groups might have changed. Therefore,
+ * gropusChanged() is not emitted if this signal is emitted.
*/
void itemsMoved(const KItemRange& itemRange, const QList<int>& movedToIndexes);
void itemsChanged(const KItemRangeList& itemRanges, const QSet<QByteArray>& roles);
+ /**
+ * Is emitted if the groups have changed, even though the order of the
+ * items has not been modified.
+ */
+ void groupsChanged();
+
void groupedSortingChanged(bool current);
void sortRoleChanged(const QByteArray& current, const QByteArray& previous);
void sortOrderChanged(Qt::SortOrder current, Qt::SortOrder previous);
diff --git a/src/kitemviews/kstandarditemlistview.cpp b/src/kitemviews/kstandarditemlistview.cpp
index bd4f6081f..135cd0b7d 100644
--- a/src/kitemviews/kstandarditemlistview.cpp
+++ b/src/kitemviews/kstandarditemlistview.cpp
@@ -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);
diff --git a/src/kitemviews/kstandarditemlistview.h b/src/kitemviews/kstandarditemlistview.h
index fd4fa861c..f5b0bfd8c 100644
--- a/src/kitemviews/kstandarditemlistview.h
+++ b/src/kitemviews/kstandarditemlistview.h
@@ -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);
diff --git a/src/kitemviews/private/kitemlistsizehintresolver.cpp b/src/kitemviews/private/kitemlistsizehintresolver.cpp
index e44630243..c86ce2bf8 100644
--- a/src/kitemviews/private/kitemlistsizehintresolver.cpp
+++ b/src/kitemviews/private/kitemlistsizehintresolver.cpp
@@ -120,7 +120,7 @@ void KItemListSizeHintResolver::itemsMoved(const KItemRange& range, const QList<
const int movedRangeEnd = range.index + range.count;
for (int i = range.index; i < movedRangeEnd; ++i) {
- const int newIndex = movedToIndexes.at(i);
+ const int newIndex = movedToIndexes.at(i - range.index);
newSizeHintCache[newIndex] = m_sizeHintCache.at(i);
}
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp
index f8439789b..e55e3eb33 100644
--- a/src/tests/kfileitemmodeltest.cpp
+++ b/src/tests/kfileitemmodeltest.cpp
@@ -49,6 +49,7 @@ namespace {
const int DefaultTimeout = 5000;
};
+Q_DECLARE_METATYPE(KItemRange)
Q_DECLARE_METATYPE(KItemRangeList)
Q_DECLARE_METATYPE(QList<int>)
@@ -744,7 +745,8 @@ void KFileItemModelTest::testSorting()
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
QCOMPARE(itemsInModel(), QStringList() << "a" << "b" << "c" << "c-1" << "c-2" << "c-3" << "d" << "e");
QCOMPARE(spyItemsMoved.count(), 1);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1 << 6 << 7);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(0, 6));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1);
// Sort by Name, descending
m_model->setSortDirectoriesFirst(true);
@@ -753,8 +755,10 @@ void KFileItemModelTest::testSorting()
QCOMPARE(m_model->sortOrder(), Qt::DescendingOrder);
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "e" << "d" << "b" << "a");
QCOMPARE(spyItemsMoved.count(), 2);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 4 << 5 << 0 << 3 << 1 << 2 << 6 << 7);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 1 << 2 << 3 << 7 << 6 << 5 << 4);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(0, 6));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 4 << 5 << 0 << 3 << 1 << 2);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(4, 4));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 6 << 5 << 4);
// Sort by Date, descending
m_model->setSortDirectoriesFirst(true);
@@ -763,7 +767,8 @@ void KFileItemModelTest::testSorting()
QCOMPARE(m_model->sortOrder(), Qt::DescendingOrder);
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "b" << "d" << "a" << "e");
QCOMPARE(spyItemsMoved.count(), 1);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 1 << 2 << 3 << 7 << 5 << 4 << 6);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(4, 4));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 5 << 4 << 6);
// Sort by Date, ascending
m_model->setSortOrder(Qt::AscendingOrder);
@@ -771,7 +776,8 @@ void KFileItemModelTest::testSorting()
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "e" << "a" << "d" << "b");
QCOMPARE(spyItemsMoved.count(), 1);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 1 << 2 << 3 << 7 << 6 << 5 << 4);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(4, 4));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 6 << 5 << 4);
// Sort by Date, ascending, 'Sort Folders First' disabled
m_model->setSortDirectoriesFirst(false);
@@ -780,7 +786,8 @@ void KFileItemModelTest::testSorting()
QVERIFY(!m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "e" << "a" << "c" << "c-1" << "c-2" << "c-3" << "d" << "b");
QCOMPARE(spyItemsMoved.count(), 1);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1 << 6 << 7);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(0, 6));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 2 << 4 << 5 << 3 << 0 << 1);
// Sort by Name, ascending, 'Sort Folders First' disabled
m_model->setSortRole("text");
@@ -788,6 +795,7 @@ void KFileItemModelTest::testSorting()
QVERIFY(!m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "a" << "b" << "c" << "c-1" << "c-2" << "c-3" << "d" << "e");
QCOMPARE(spyItemsMoved.count(), 1);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(0, 8));
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 0 << 2 << 3 << 4 << 5 << 6 << 1);
// Sort by Size, ascending, 'Sort Folders First' disabled
@@ -797,19 +805,15 @@ void KFileItemModelTest::testSorting()
QVERIFY(!m_model->sortDirectoriesFirst());
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "a" << "b" << "e" << "d");
QCOMPARE(spyItemsMoved.count(), 1);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(0, 8));
QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 4 << 5 << 0 << 3 << 1 << 2 << 7 << 6);
- QSKIP("2 tests of testSorting() are temporary deactivated as in KFileItemModel resortAllItems() "
- "always emits a itemsMoved() signal. Before adjusting the tests think about probably introducing "
- "another signal", SkipSingle);
- // Internal note: Check comment in KFileItemModel::resortAllItems() for details.
-
// In 'Sort by Size' mode, folders are always first -> changing 'Sort Folders First' does not resort the model
m_model->setSortDirectoriesFirst(true);
QCOMPARE(m_model->sortRole(), QByteArray("size"));
QCOMPARE(m_model->sortOrder(), Qt::AscendingOrder);
QVERIFY(m_model->sortDirectoriesFirst());
- QCOMPARE(itemsInModel(), QStringList() << "c" << "a" << "b" << "e" << "d");
+ QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "a" << "b" << "e" << "d");
QCOMPARE(spyItemsMoved.count(), 0);
// Sort by Size, descending, 'Sort Folders First' enabled
@@ -817,9 +821,10 @@ void KFileItemModelTest::testSorting()
QCOMPARE(m_model->sortRole(), QByteArray("size"));
QCOMPARE(m_model->sortOrder(), Qt::DescendingOrder);
QVERIFY(m_model->sortDirectoriesFirst());
- QCOMPARE(itemsInModel(), QStringList() << "c" << "d" << "e" << "b" << "a");
+ QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "d" << "e" << "b" << "a");
QCOMPARE(spyItemsMoved.count(), 1);
- QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 0 << 4 << 3 << 2 << 1);
+ QCOMPARE(spyItemsMoved.first().at(0).value<KItemRange>(), KItemRange(4, 4));
+ QCOMPARE(spyItemsMoved.takeFirst().at(1).value<QList<int> >(), QList<int>() << 7 << 6 << 5 << 4);
// TODO: Sort by other roles; show/hide hidden files
}
@@ -1237,7 +1242,7 @@ void KFileItemModelTest::testNameRoleGroups()
// Rename c.txt to d.txt.
data.insert("text", "d.txt");
m_model->setData(2, data);
- QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsMoved(KItemRange,QList<int>)), DefaultTimeout));
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(groupsChanged()), DefaultTimeout));
QCOMPARE(itemsInModel(), QStringList() << "a.txt" << "b.txt" << "d.txt" << "e.txt");
expectedGroups.clear();
diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp
index 039b5f230..4799d7679 100644
--- a/src/views/dolphinitemlistview.cpp
+++ b/src/views/dolphinitemlistview.cpp
@@ -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)
diff --git a/src/views/dolphinitemlistview.h b/src/views/dolphinitemlistview.h
index c2d86cc5e..18bb284ac 100644
--- a/src/views/dolphinitemlistview.h
+++ b/src/views/dolphinitemlistview.h
@@ -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,
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 20bc9f522..375bd3ea2 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1666,7 +1666,7 @@ QMimeData* DolphinView::selectionMimeData() const
void DolphinView::updateWritableState()
{
const bool wasFolderWritable = m_isFolderWritable;
- m_isFolderWritable = true;
+ m_isFolderWritable = false;
const KFileItem item = m_model->rootItem();
if (!item.isNull()) {