┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-01-30 21:06:34 +0100
committerFrank Reininghaus <[email protected]>2013-01-30 21:06:34 +0100
commit5d4d73ff0829f206f9cd44023afc1a2f12cc6096 (patch)
treec19b2915f8bed41a145e695b43e603800737812a /src
parent8371fb6d75e4c6985b0fe7a2c5bdb55783dfd811 (diff)
parent89134d62c72961f81c231feeaaa727f055e4f61a (diff)
Merge remote-tracking branch 'origin/KDE/4.10'
Conflicts: dolphin/src/tests/kfileitemmodeltest.cpp
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp2
-rw-r--r--src/tests/kfileitemmodeltest.cpp51
2 files changed, 52 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 06328bd2e..59575fdaf 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -33,7 +33,7 @@ KDE_EXPORT int kdemain(int argc, char **argv)
{
KAboutData about("dolphin", 0,
ki18nc("@title", "Dolphin"),
- "2.1.98",
+ "2.2",
ki18nc("@title", "File Manager"),
KAboutData::License_GPL,
ki18nc("@info:credit", "(C) 2006-2012 Peter Penz and Frank Reininghaus"));
diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp
index d0f2e1eaa..2ad18428a 100644
--- a/src/tests/kfileitemmodeltest.cpp
+++ b/src/tests/kfileitemmodeltest.cpp
@@ -75,6 +75,7 @@ private slots:
void testIndexForKeyboardSearch();
void testNameFilter();
void testEmptyPath();
+ void testRemoveHiddenItems();
private:
QStringList itemsInModel() const;
@@ -797,6 +798,56 @@ void KFileItemModelTest::testEmptyPath()
m_model->slotCompleted();
}
+/**
+ * Verify that removing hidden files and folders from the model does not
+ * result in a crash, see https://bugs.kde.org/show_bug.cgi?id=314046
+ */
+void KFileItemModelTest::testRemoveHiddenItems()
+{
+ m_testDir->createDir(".a");
+ m_testDir->createDir(".b");
+ m_testDir->createDir("c");
+ m_testDir->createDir("d");
+ m_testDir->createFiles(QStringList() << ".f" << ".g" << "h" << "i");
+
+ QSignalSpy spyItemsInserted(m_model, SIGNAL(itemsInserted(KItemRangeList)));
+ QSignalSpy spyItemsRemoved(m_model, SIGNAL(itemsRemoved(KItemRangeList)));
+
+ m_model->setShowHiddenFiles(true);
+ m_model->loadDirectory(m_testDir->url());
+ QVERIFY(QTest::kWaitForSignal(m_model, SIGNAL(itemsInserted(KItemRangeList)), DefaultTimeout));
+ QCOMPARE(itemsInModel(), QStringList() << ".a" << ".b" << "c" << "d" <<".f" << ".g" << "h" << "i");
+ QCOMPARE(spyItemsInserted.count(), 1);
+ QCOMPARE(spyItemsRemoved.count(), 0);
+ KItemRangeList itemRangeList = spyItemsInserted.takeFirst().at(0).value<KItemRangeList>();
+ QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 8));
+
+ m_model->setShowHiddenFiles(false);
+ QCOMPARE(itemsInModel(), QStringList() << "c" << "d" << "h" << "i");
+ QCOMPARE(spyItemsInserted.count(), 0);
+ QCOMPARE(spyItemsRemoved.count(), 1);
+ itemRangeList = spyItemsRemoved.takeFirst().at(0).value<KItemRangeList>();
+ QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 2) << KItemRange(4, 2));
+
+ m_model->setShowHiddenFiles(true);
+ QCOMPARE(itemsInModel(), QStringList() << ".a" << ".b" << "c" << "d" <<".f" << ".g" << "h" << "i");
+ QCOMPARE(spyItemsInserted.count(), 1);
+ QCOMPARE(spyItemsRemoved.count(), 0);
+ itemRangeList = spyItemsInserted.takeFirst().at(0).value<KItemRangeList>();
+ QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 2) << KItemRange(2, 2));
+
+ m_model->clear();
+ QCOMPARE(itemsInModel(), QStringList());
+ QCOMPARE(spyItemsInserted.count(), 0);
+ QCOMPARE(spyItemsRemoved.count(), 1);
+ itemRangeList = spyItemsRemoved.takeFirst().at(0).value<KItemRangeList>();
+ QCOMPARE(itemRangeList, KItemRangeList() << KItemRange(0, 8));
+
+ // Hiding hidden files makes the dir lister emit its itemsDeleted signal.
+ // Verify that this does not make the model crash.
+ m_model->setShowHiddenFiles(false);
+}
+
QStringList KFileItemModelTest::itemsInModel() const
{
QStringList items;