Skip to content

Commit

Permalink
fix: correct directory filter flag in address bar completion
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Johnson-zs committed Dec 13, 2024
1 parent efcb16c commit 39f8800
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 39f8800

Please sign in to comment.