diff --git a/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.cpp b/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.cpp index 2dd31d2896..b794121325 100644 --- a/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.cpp +++ b/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.cpp @@ -7,6 +7,7 @@ #include "views/folderviewdelegate.h" #include +#include #include #include @@ -132,21 +133,24 @@ FolderListWidget::FolderListWidget(QWidget *parent) FolderListWidget::~FolderListWidget() = default; -void FolderListWidget::setFolderList(const QList &datas) +void FolderListWidget::setFolderList(const QList &datas, bool stacked) { d->folderModel->clear(); d->crumbDatas = datas; int dataNum = 0; + bool isShowedHiddenFiles = true; + if (!stacked) + isShowedHiddenFiles = Application::instance()->genericAttribute(Application::kShowedHiddenFiles).toBool(); for (auto data : datas) { auto info = InfoFactory::create(data.url); - if (!info.isNull()) { + if (!info.isNull() && (isShowedHiddenFiles || !info->isAttributes(FileInfo::FileIsType::kIsHidden))) { QStandardItem *item = new QStandardItem(info->fileIcon(), data.displayText); d->folderModel->insertRow(dataNum, item); dataNum++; } } - int folderCount = datas.size() > kMaxFolderCount ? kMaxFolderCount : datas.size(); - if (datas.size() > 1) { + int folderCount = dataNum > kMaxFolderCount ? kMaxFolderCount : dataNum; + if (dataNum > 1) { d->folderView->setViewportMargins(kItemMargin, kItemMargin, kItemMargin, kItemMargin); setFixedHeight(kItemMargin * 2 + kFolderItemHeight * folderCount); } else { diff --git a/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.h b/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.h index a226af532f..b1007781be 100644 --- a/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.h +++ b/src/plugins/filemanager/core/dfmplugin-titlebar/views/folderlistwidget.h @@ -21,7 +21,7 @@ class FolderListWidget : public Dtk::Widget::DBlurEffectWidget explicit FolderListWidget(QWidget *parent = nullptr); ~FolderListWidget() override; - void setFolderList(const QList &datas); + void setFolderList(const QList &datas, bool stacked); Q_SIGNALS: void urlButtonActivated(const QUrl &url); diff --git a/src/plugins/filemanager/core/dfmplugin-titlebar/views/urlpushbutton.cpp b/src/plugins/filemanager/core/dfmplugin-titlebar/views/urlpushbutton.cpp index bf49c4a49f..082610a8fd 100644 --- a/src/plugins/filemanager/core/dfmplugin-titlebar/views/urlpushbutton.cpp +++ b/src/plugins/filemanager/core/dfmplugin-titlebar/views/urlpushbutton.cpp @@ -250,7 +250,7 @@ void UrlPushButtonPrivate::onSelectSubDirs() // 堆叠时显示堆叠目录 requestCompleteByUrl(crumbDatas.last().url); } else { - folderListWidget->setFolderList(crumbDatas); + folderListWidget->setFolderList(crumbDatas, stacked); folderListWidget->move(popupPos); folderListWidget->show(); } @@ -285,7 +285,7 @@ void UrlPushButtonPrivate::onCompletionCompleted() const bool leftToRight = (q->layoutDirection() == Qt::LeftToRight); const int popupX = (leftToRight && !stacked) ? (q->width() - arrowWidth() - kBorderWidth) : 0; const QPoint popupPos = q->parentWidget()->mapToGlobal(q->geometry().bottomLeft() + QPoint(popupX, 0)); - folderListWidget->setFolderList(datas); + folderListWidget->setFolderList(datas, stacked); folderListWidget->move(popupPos); folderListWidget->show(); }