diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/kfileitemmodel.cpp | 2 | ||||
| -rw-r--r-- | src/tests/kfileitemmodeltest.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index ddc56209b..c54a982f6 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -831,7 +831,7 @@ int KFileItemModel::expansionLevelsCompare(const KFileItem& a, const KFileItem& if (index > maxIndex) { index = maxIndex; } - while (pathA.at(index) != QLatin1Char('/') && index > 0) { + while ((pathA.at(index) != QLatin1Char('/') || pathB.at(index) != QLatin1Char('/')) && index > 0) { --index; } diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index 74706d49a..0e40b3bc4 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -228,6 +228,7 @@ void KFileItemModelTest::testExpansionLevelsCompare_data() QTest::newRow("Equal") << "/a/b" << "/a/b" << 0; QTest::newRow("Sub path: A < B") << "/a/b" << "/a/b/c" << -1; QTest::newRow("Sub path: A > B") << "/a/b/c" << "/a/b" << +1; + QTest::newRow("Same level: /a/1 < /a-1/1") << "/a/1" << "/a-1/1" << -1; } void KFileItemModelTest::testExpansionLevelsCompare() |
