From 70f34211cb4ad1f3f6170ded062bafff85d66643 Mon Sep 17 00:00:00 2001 From: Méven Car Date: Sun, 3 May 2026 14:53:01 +0200 Subject: Add A restore view properties to defaults button The button allows to restore to defaults, in case you are using the per-folder view properties settings. The button disables or enables itself whether or not it matches the defaults view settings. --- src/dolphinmainwindow.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/dolphinmainwindow.cpp') diff --git a/src/dolphinmainwindow.cpp b/src/dolphinmainwindow.cpp index c1bbcc5f5..d35575624 100644 --- a/src/dolphinmainwindow.cpp +++ b/src/dolphinmainwindow.cpp @@ -1677,6 +1677,8 @@ void DolphinMainWindow::activeViewChanged(DolphinViewContainer *viewContainer) &DolphinViewContainer::selectionModeChanged, actionCollection()->action(QStringLiteral("toggle_selection_mode")), &QAction::setChecked); + + disconnect(oldViewContainer->view(), &DolphinView::viewSettingsChanged, this, nullptr); } connectViewSignals(viewContainer); @@ -2732,6 +2734,9 @@ void DolphinMainWindow::updateViewActions() QAction *toggleFilterBarAction = actionCollection()->action(QStringLiteral("toggle_filter")); toggleFilterBarAction->setChecked(m_activeViewContainer->isFilterBarVisible()); + QAction *restoreViewSettingsToDefault = actionCollection()->action(QStringLiteral("restore_view_settings_default")); + restoreViewSettingsToDefault->setEnabled(!m_activeViewContainer->view()->isViewSettingsDefaults()); + updateSplitActions(); } @@ -2813,6 +2818,11 @@ void DolphinMainWindow::connectViewSignals(DolphinViewContainer *container) connect(navigator, &KUrlNavigator::tabRequested, this, &DolphinMainWindow::openNewTab); connect(navigator, &KUrlNavigator::activeTabRequested, this, &DolphinMainWindow::openNewTabAndActivate); connect(navigator, &KUrlNavigator::newWindowRequested, this, &DolphinMainWindow::openNewWindow); + + connect(view, &DolphinView::viewSettingsChanged, this, [this](bool isDefault) { + QAction *restoreViewSettingsToDefault = actionCollection()->action(QStringLiteral("restore_view_settings_default")); + restoreViewSettingsToDefault->setEnabled(!isDefault); + }); } void DolphinMainWindow::updateSplitActions() -- cgit v1.3.1