Skip to content

Commit

Permalink
fix: breadcrumbs exist in hidden folders after hiding
Browse files Browse the repository at this point in the history
Breadcrumb adaptation hidden function

Log: breadcrumbs exist in hidden folders after hiding
  • Loading branch information
wyu71 committed Oct 28, 2024
1 parent a97a94e commit 5e11a78
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "views/folderviewdelegate.h"

#include <dfm-base/base/schemefactory.h>
#include <dfm-base/base/application/application.h>

#include <QVBoxLayout>
#include <QStandardItemModel>
Expand Down Expand Up @@ -132,21 +133,24 @@ FolderListWidget::FolderListWidget(QWidget *parent)

FolderListWidget::~FolderListWidget() = default;

void FolderListWidget::setFolderList(const QList<CrumbData> &datas)
void FolderListWidget::setFolderList(const QList<CrumbData> &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<FileInfo>(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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FolderListWidget : public Dtk::Widget::DBlurEffectWidget
explicit FolderListWidget(QWidget *parent = nullptr);
~FolderListWidget() override;

void setFolderList(const QList<CrumbData> &datas);
void setFolderList(const QList<CrumbData> &datas, bool stacked);

Q_SIGNALS:
void urlButtonActivated(const QUrl &url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void UrlPushButtonPrivate::onSelectSubDirs()
// 堆叠时显示堆叠目录
requestCompleteByUrl(crumbDatas.last().url);
} else {
folderListWidget->setFolderList(crumbDatas);
folderListWidget->setFolderList(crumbDatas, stacked);
folderListWidget->move(popupPos);
folderListWidget->show();
}
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 5e11a78

Please sign in to comment.