From 95542a389112491abf3a31c338e7d78f7785f48e Mon Sep 17 00:00:00 2001 From: Felix Ernst Date: Sun, 29 Dec 2024 11:42:22 +0000 Subject: Mirror details view mode for right-to-left languages This commit implements mirroring of the details view mode for right-to- left languages. This is the last of the Dolphin view modes which did not adapt to right-to-left languages correctly. Implementation-wise this is mostly about adapting the math so all the information is placed correctly no matter the view mode or layout direction. While most of the view actually changes the painting code for right-to-left languages, for the column header I decided to keep the logic left-to-right and instead reverse the order of the role columns. To implement this mirroring I needed to rework quite a bit of logic, so I used the opportunity to fix some bugs/behaviur quirks: - Left and right padding is now saved and restored separately instead of only saving the left padding - Changing the right padding no longer disables "automatic column resizing". - The grip handles for column resizing can now be grabbed when near the grip handle instead of only allowing grabbing when slightly to the left of the grip. - Role column headers now only show a hover highlight effect when the mouse cursor is actually above that role and not above the grip handle or the padding. - There is now a soft-boarder when shrinking the right padding so shrinking the padding "below zero width" will no longer immediately clear automatic resize behaviour. So now it is possible to simply remove the right padding by resizing it to zero width. BUG: 449211 BUG: 495942 # Acknowledgement This work is part of a my project funded through the NGI0 Entrust Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology. --- src/settings/dolphin_detailsmodesettings.kcfg | 8 ++++++-- src/settings/dolphin_detailsmodesettings.upd | 8 +++++++- src/settings/viewmodes/viewsettingstab.cpp | 13 +++++++++---- 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src/settings') diff --git a/src/settings/dolphin_detailsmodesettings.kcfg b/src/settings/dolphin_detailsmodesettings.kcfg index 98fe0efff..52d85fa12 100644 --- a/src/settings/dolphin_detailsmodesettings.kcfg +++ b/src/settings/dolphin_detailsmodesettings.kcfg @@ -27,8 +27,12 @@ 0,1,2,3,4,5,6,7,8 - - + + + 20 + + + 20 diff --git a/src/settings/dolphin_detailsmodesettings.upd b/src/settings/dolphin_detailsmodesettings.upd index da8f4b9cd..f9def96b6 100644 --- a/src/settings/dolphin_detailsmodesettings.upd +++ b/src/settings/dolphin_detailsmodesettings.upd @@ -1,5 +1,5 @@ #Configuration update for Dolphin -Version=5 +Version=6 #Rename LeadingPadding to SidePadding Id=rename-leading-padding @@ -7,6 +7,12 @@ File=dolphinrc Group=DetailsMode Key=LeadingPadding,SidePadding +#Rename SidePadding to LeftPadding +Id=rename-side-padding +File=dolphinrc +Group=DetailsMode +Key=SidePadding,LeftPadding + #Rename Move content-display from detailsMode Id=move-content-display File=dolphinrc diff --git a/src/settings/viewmodes/viewsettingstab.cpp b/src/settings/viewmodes/viewsettingstab.cpp index 5aca58ba1..fc9e94131 100644 --- a/src/settings/viewmodes/viewsettingstab.cpp +++ b/src/settings/viewmodes/viewsettingstab.cpp @@ -154,15 +154,20 @@ void ViewSettingsTab::applySettings() // So here the default padding is enabled when the full row highlight is enabled. if (m_entireRow->isChecked() && !detailsModeSettings->highlightEntireRow()) { const bool usedDefaults = detailsModeSettings->useDefaults(true); - const uint defaultSidePadding = detailsModeSettings->sidePadding(); + const uint defaultLeftPadding = detailsModeSettings->leftPadding(); + const uint defaultRightPadding = detailsModeSettings->rightPadding(); detailsModeSettings->useDefaults(usedDefaults); - if (detailsModeSettings->sidePadding() < defaultSidePadding) { - detailsModeSettings->setSidePadding(defaultSidePadding); + if (detailsModeSettings->leftPadding() < defaultLeftPadding) { + detailsModeSettings->setLeftPadding(defaultLeftPadding); + } + if (detailsModeSettings->rightPadding() < defaultRightPadding) { + detailsModeSettings->setRightPadding(defaultRightPadding); } } else if (!m_entireRow->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->setLeftPadding(0); + detailsModeSettings->setRightPadding(0); } detailsModeSettings->setHighlightEntireRow(m_entireRow->isChecked()); detailsModeSettings->setExpandableFolders(m_expandableFolders->isChecked()); -- cgit v1.3