diff --git a/autotests/kfilewidgettest.cpp b/autotests/kfilewidgettest.cpp --- a/autotests/kfilewidgettest.cpp +++ b/autotests/kfilewidgettest.cpp @@ -22,6 +22,7 @@ #include "kfilewidget.h" #include +#include #include #include #include @@ -508,6 +509,28 @@ QCOMPARE(urls.size(), 1); QCOMPARE(urls[0], fileUrl); } + + void testCreateNestedNewFolders() + { + // when creating multiple nested new folders in the "save as" dialog, where folders are + //created and entered, kdirlister would hit an assert (in reinsert()), bug 408801 + QTemporaryDir tempDir; + QVERIFY(tempDir.isValid()); + const QString dir = tempDir.path(); + const QUrl url = QUrl::fromLocalFile(dir); + KFileWidget fw(url); + fw.setOperationMode(KFileWidget::Saving); + fw.setMode(KFile::File); + + // create the nested folders + for (int i = 1; i < 6; ++i) { + fw.dirOperator()->mkdir(QStringLiteral("folder%1").arg(i), true); + // simulate the time the user will take to type the new folder name + QTest::qWait(1000); + } + + QVERIFY(QFile::exists(dir + QStringLiteral("/folder1/folder2/folder3/folder4/folder5"))); + } }; QTEST_MAIN(KFileWidgetTest) diff --git a/src/core/kcoredirlister.cpp b/src/core/kcoredirlister.cpp --- a/src/core/kcoredirlister.cpp +++ b/src/core/kcoredirlister.cpp @@ -644,12 +644,6 @@ const QUrl dir = _dir.adjusted(QUrl::StripTrailingSlash); if (!checkUpdate(dir)) { - if (dir.isLocalFile() && !(findByUrl(nullptr, dir).isNull())) { - pendingUpdates.insert(dir.toLocalFile()); - if (!pendingUpdateTimer.isActive()) { - pendingUpdateTimer.start(500); - } - } return; }