From 9478f1473006147c643c228793822b2eeb4b0606 Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Wed, 19 Oct 2022 18:03:12 +0200 Subject: Make details view mode's full row activation optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In d3839617193e92463806580699caa595c892b8a6 the details view mode was changed in a way that made the full row of an item the click target instead of only having the item's icon and text be the representative clickable area of an item. This commit makes this new behaviour optional through a setting which can be changed in Dolphin's settings dialog. The explanation for introducing yet another setting in this case is as follows: While the introduced change is an improvement for many typical workflows, there are some workflows for which this new behaviour is problematic. Quite prominently a usage of Dolphin that tries to maximise information density is made worse by the change because now side padding is necessary to click the view's background. While the side padding is and was optional, disabling it made switching the active view in split view mode more difficult among other things. For a more complete discussion about the issues, please check out the bug report(s) and the discussion in Dolphin's gitlab issue with number 34. Co-authored-by: Ivan Čukić BUG: 453700 FIXED-IN: 22.12 --- src/settings/viewmodes/viewsettingstab.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/settings/viewmodes/viewsettingstab.cpp') diff --git a/src/settings/viewmodes/viewsettingstab.cpp b/src/settings/viewmodes/viewsettingstab.cpp index cc6818a30..850004c6f 100644 --- a/src/settings/viewmodes/viewsettingstab.cpp +++ b/src/settings/viewmodes/viewsettingstab.cpp @@ -101,6 +101,10 @@ ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) : m_expandableFolders = new QCheckBox(i18nc("@option:check", "Expandable")); topLayout->addRow(i18nc("@label:checkbox", "Folders:"), m_expandableFolders); + m_highlightEntireRow = new QCheckBox(i18nc("@option:check", "Highlight entire row")); + topLayout->addRow(i18nc("@label:checkbox", "Selection effect:"), m_highlightEntireRow); + + #ifndef Q_OS_WIN // Sorting properties m_numberOfItems = new QRadioButton(i18nc("option:radio", "Number of items")); @@ -161,6 +165,7 @@ ViewSettingsTab::ViewSettingsTab(Mode mode, QWidget* parent) : connect(m_widthBox, &QComboBox::currentIndexChanged, this, &ViewSettingsTab::changed); break; case DetailsMode: + connect(m_highlightEntireRow, &QCheckBox::toggled, this, &ViewSettingsTab::changed); connect(m_expandableFolders, &QCheckBox::toggled, this, &ViewSettingsTab::changed); #ifndef Q_OS_WIN connect(m_recursiveDirectorySizeLimit, &QSpinBox::valueChanged, this, &ViewSettingsTab::changed); @@ -195,6 +200,22 @@ void ViewSettingsTab::applySettings() CompactModeSettings::setMaximumTextWidthIndex(m_widthBox->currentIndex()); break; case DetailsMode: + // We need side-padding when the full row is a click target to still be able to not click items. + // So here the default padding is enabled when the full row highlight is enabled. + if (m_highlightEntireRow->isChecked() && !DetailsModeSettings::highlightEntireRow()) { + auto detailsModeSettings = DetailsModeSettings::self(); + const bool usedDefaults = detailsModeSettings->useDefaults(true); + const int defaultSidePadding = detailsModeSettings->sidePadding(); + detailsModeSettings->useDefaults(usedDefaults); + if (DetailsModeSettings::sidePadding() < defaultSidePadding) { + DetailsModeSettings::setSidePadding(defaultSidePadding); + } + } else if (!m_highlightEntireRow->isChecked() && DetailsModeSettings::highlightEntireRow()) { + // The full row click target is disabled so now most of the view area can be used to interact + // with the view background. Having an extra side padding has no usability benefit in this case. + DetailsModeSettings::setSidePadding(0); + } + DetailsModeSettings::setHighlightEntireRow(m_highlightEntireRow->isChecked()); DetailsModeSettings::setExpandableFolders(m_expandableFolders->isChecked()); #ifndef Q_OS_WIN DetailsModeSettings::setDirectorySizeCount(m_numberOfItems->isChecked()); @@ -238,6 +259,7 @@ void ViewSettingsTab::loadSettings() m_widthBox->setCurrentIndex(CompactModeSettings::maximumTextWidthIndex()); break; case DetailsMode: + m_highlightEntireRow->setChecked(DetailsModeSettings::highlightEntireRow()); m_expandableFolders->setChecked(DetailsModeSettings::expandableFolders()); #ifndef Q_OS_WIN if (DetailsModeSettings::directorySizeCount()) { -- cgit v1.3