From 39f8800aa94278f7965ca43881b7bcd40ab3e33e Mon Sep 17 00:00:00 2001 From: Zhang Sheng Date: Fri, 13 Dec 2024 10:18:25 +0800 Subject: [PATCH] fix: correct directory filter flag in address bar completion Fix directory filtering in address bar path completion: - Change QDir::Dirs to QDir::AllDirs to include symbolic links to directories - Remove Qt::DirectConnection from completion signal to avoid thread safety issues - Fix code formatting in path comparison condition This change ensures that: 1. Symbolic links to directories are properly shown in completion list 2. Thread safety is maintained for completion updates Log: Bug: https://pms.uniontech.com/bug-view-277429.html --- .../filemanager/dfmplugin-titlebar/utils/crumbinterface.cpp | 4 ++-- .../filemanager/dfmplugin-titlebar/views/addressbar.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/filemanager/dfmplugin-titlebar/utils/crumbinterface.cpp b/src/plugins/filemanager/dfmplugin-titlebar/utils/crumbinterface.cpp index 89dcd66ad2..6b28bf4e50 100644 --- a/src/plugins/filemanager/dfmplugin-titlebar/utils/crumbinterface.cpp +++ b/src/plugins/filemanager/dfmplugin-titlebar/utils/crumbinterface.cpp @@ -102,14 +102,14 @@ void CrumbInterface::requestCompletionList(const QUrl &url) folderCompleterJobPointer->setParent(nullptr); } folderCompleterJobPointer = new TraversalDirThread(url, QStringList(), - QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::NoIteratorFlags); + QDir::AllDirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::NoIteratorFlags); folderCompleterJobPointer->setQueryAttributes("standard::standard::name"); folderCompleterJobPointer->setParent(this); if (folderCompleterJobPointer.isNull()) return; connect(folderCompleterJobPointer.data(), &TraversalDirThread::updateChildren, this, - &CrumbInterface::onUpdateChildren, Qt::DirectConnection); + &CrumbInterface::onUpdateChildren); connect( folderCompleterJobPointer.data(), &TraversalDirThread::finished, this, diff --git a/src/plugins/filemanager/dfmplugin-titlebar/views/addressbar.cpp b/src/plugins/filemanager/dfmplugin-titlebar/views/addressbar.cpp index 427f30506e..d5c3a65d7c 100644 --- a/src/plugins/filemanager/dfmplugin-titlebar/views/addressbar.cpp +++ b/src/plugins/filemanager/dfmplugin-titlebar/views/addressbar.cpp @@ -311,7 +311,7 @@ void AddressBarPrivate::completeLocalPath(const QString &text, const QUrl &url, // Check if we should start a new completion transmission. if (this->completerBaseString == text.left(slashIndex + 1) - || UrlRoute::fromUserInput(completerBaseString) == UrlRoute::fromUserInput(text.left(slashIndex + 1))) { + || UrlRoute::fromUserInput(completerBaseString) == UrlRoute::fromUserInput(text.left(slashIndex + 1))) { urlCompleter->setCompletionPrefix(text.mid(slashIndex + 1)); // set completion prefix first onCompletionModelCountChanged(); // will call complete() return;