Commit 272aa65b authored by Heiko Becker's avatar Heiko Becker
Browse files

Revert "Disable Hidden Files Last sort by default"

This reverts commit fd2203bb.
parent fd2203bb
......@@ -34,7 +34,7 @@ KFileItemModel::KFileItemModel(QObject* parent) :
KItemModelBase("text", parent),
m_dirLister(nullptr),
m_sortDirsFirst(true),
m_sortHiddenLast(false),
m_sortHiddenLast(true),
m_sortRole(NameRole),
m_sortingProgressPercent(-1),
m_roles(),
......
......@@ -59,7 +59,7 @@
<entry name="SortHiddenLast" type="Bool" >
<label context="@label">Show hidden files and folders last</label>
<default>false</default>
<default>true</default>
</entry>
<entry name="VisibleRoles" type="StringList">
......
......@@ -814,16 +814,16 @@ void KFileItemModelTest::testSorting()
{
// testDir structure is as follows
// ./
// ├─ .g/
// ├─ a
// ├─ b
// ├─ c/
// │ ├─ c-2/
// │ │ ├─ c-3
// │ ├─ c-1
// ├─ .f
// ├─ d
// ├─ e
// ├─ .f
// ├─ .g/
QSignalSpy itemsInsertedSpy(m_model, &KFileItemModel::itemsInserted);
QSignalSpy itemsMovedSpy(m_model, &KFileItemModel::itemsMoved);
......@@ -968,20 +968,10 @@ void KFileItemModelTest::testSorting()
// 'Show Hidden Files' enabled
m_model->setShowHiddenFiles(true);
QVERIFY(m_model->showHiddenFiles());
QVERIFY(!m_model->sortHiddenLast());
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << ".g" << "d" << "e" << "b" << "a" << ".f");
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "d" << "e" << "b" << "a" << ".g" << ".f");
QCOMPARE(itemsMovedSpy.count(), 0);
QCOMPARE(itemsInsertedSpy.count(), 1);
QCOMPARE(itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>(), KItemRangeList() << KItemRange(4, 1) << KItemRange(8, 1));
// 'Sort Hidden Files Last' enabled
m_model->setSortHiddenLast(true);
QVERIFY(m_model->sortHiddenLast());
QCOMPARE(itemsInModel(), QStringList() << "c" << "c-2" << "c-3" << "c-1" << "d" << "e" << "b" << "a" << ".g" << ".f");
QCOMPARE(itemsMovedSpy.count(), 1);
QCOMPARE(itemsInsertedSpy.count(), 0);
QCOMPARE(itemsMovedSpy.first().at(0).value<KItemRange>(), KItemRange(4, 5));
QCOMPARE(itemsMovedSpy.takeFirst().at(1).value<QList<int> >(), QList<int>() << 8 << 4 << 5 << 6 << 7);
QCOMPARE(itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>(), KItemRangeList() << KItemRange(8, 2));
// Sort by Name
m_model->setSortRole("text");
......@@ -1161,7 +1151,7 @@ void KFileItemModelTest::testRemoveHiddenItems()
m_model->setShowHiddenFiles(true);
m_model->loadDirectory(m_testDir->url());
QVERIFY(itemsInsertedSpy.wait());
QCOMPARE(itemsInModel(), QStringList() << ".a" << ".b" << "c" << "d" <<".f" << ".g" << "h" << "i");
QCOMPARE(itemsInModel(), QStringList() << "c" << "d" << "h" << "i" << ".a" << ".b" <<".f" << ".g");
QCOMPARE(itemsInsertedSpy.count(), 1);
QCOMPARE(itemsRemovedSpy.count(), 0);
KItemRangeList itemRangeList = itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>();
......@@ -1172,14 +1162,14 @@ void KFileItemModelTest::testRemoveHiddenItems()
QCOMPARE(itemsInsertedSpy.count(), 0);
QCOMPARE(itemsRemovedSpy.count(), 1);
itemRangeList = itemsRemovedSpy.takeFirst().at(0).value<KItemRangeList>();
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 2) << KItemRange(4, 2));
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(4, 4));
m_model->setShowHiddenFiles(true);
QCOMPARE(itemsInModel(), QStringList() << ".a" << ".b" << "c" << "d" <<".f" << ".g" << "h" << "i");
QCOMPARE(itemsInModel(), QStringList() << "c" << "d" << "h" << "i" << ".a" << ".b" <<".f" << ".g");
QCOMPARE(itemsInsertedSpy.count(), 1);
QCOMPARE(itemsRemovedSpy.count(), 0);
itemRangeList = itemsInsertedSpy.takeFirst().at(0).value<KItemRangeList>();
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 2) << KItemRange(2, 2));
QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(4, 4));
m_model->clear();
QCOMPARE(itemsInModel(), QStringList());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment