diff --git a/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.cpp b/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.cpp index b570002e5b..6bad260eeb 100644 --- a/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.cpp +++ b/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.cpp @@ -44,6 +44,7 @@ FileViewModel::FileViewModel(QAbstractItemView *parent) itemRootData = new FileItemData(dirRootUrl); connect(ThumbnailFactory::instance(), &ThumbnailFactory::produceFinished, this, &FileViewModel::onFileThumbUpdated); connect(Application::instance(), &Application::genericAttributeChanged, this, &FileViewModel::onGenericAttributeChanged); + connect(Application::instance(), &Application::showedHiddenFilesChanged, this, &FileViewModel::onHiddenSettingChanged); connect(DConfigManager::instance(), &DConfigManager::valueChanged, this, &FileViewModel::onDConfigChanged); connect(&waitTimer, &QTimer::timeout, this, &FileViewModel::onSetCursorWait); waitTimer.setInterval(50); @@ -749,6 +750,16 @@ void FileViewModel::onSetCursorWait() QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); } +void FileViewModel::onHiddenSettingChanged(bool value) +{ + if (value) { + currentFilters |= QDir::Hidden; + } else { + currentFilters &= ~QDir::Hidden; + } + Q_EMIT requestShowHiddenChanged(value); +} + void FileViewModel::initFilterSortWork() { discardFilterSortObjects(); @@ -800,8 +811,8 @@ void FileViewModel::initFilterSortWork() connect(this, &FileViewModel::requestGetSourceData, filterSortWorker.data(), &FileSortWorker::handleModelGetSourceData, Qt::QueuedConnection); connect(this, &FileViewModel::requestRefreshAllChildren, filterSortWorker.data(), &FileSortWorker::handleRefresh, Qt::QueuedConnection); connect(this, &FileViewModel::requestClearThumbnail, filterSortWorker.data(), &FileSortWorker::handleClearThumbnail, Qt::QueuedConnection); + connect(this, &FileViewModel::requestShowHiddenChanged, filterSortWorker.data(), &FileSortWorker::onShowHiddenFileChanged, Qt::QueuedConnection); connect(filterSortWorker.data(), &FileSortWorker::requestUpdateView, this, &FileViewModel::onUpdateView, Qt::QueuedConnection); - connect(Application::instance(), &Application::showedHiddenFilesChanged, filterSortWorker.data(), &FileSortWorker::onShowHiddenFileChanged, Qt::QueuedConnection); connect(Application::instance(), &Application::appAttributeChanged, filterSortWorker.data(), &FileSortWorker::onAppAttributeChanged, Qt::QueuedConnection); filterSortThread->start(); diff --git a/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.h b/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.h index 39e5019348..37ed69021b 100644 --- a/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.h +++ b/src/plugins/filemanager/core/dfmplugin-workspace/models/fileviewmodel.h @@ -109,6 +109,7 @@ class FileViewModel : public QAbstractItemModel void requestSortChildren(Qt::SortOrder order, DFMGLOBAL_NAMESPACE::ItemRoles role, const bool isMixAndFile); void requestSetFilterData(const QVariant &data); void requestSetFilterCallback(FileViewFilterCallback callback); + void requestShowHiddenChanged(bool value); public Q_SLOTS: void onFileThumbUpdated(const QUrl &url, const QString &thumb); @@ -121,6 +122,7 @@ public Q_SLOTS: void onGenericAttributeChanged(DFMBASE_NAMESPACE::Application::GenericAttribute ga, const QVariant &value); void onDConfigChanged(const QString &config, const QString &key); void onSetCursorWait(); + void onHiddenSettingChanged(bool value); private: void initFilterSortWork();