┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/views/dolphinview.cpp
diff options
context:
space:
mode:
authorFelix Ernst <[email protected]>2024-12-29 11:42:22 +0000
committerFelix Ernst <[email protected]>2024-12-29 11:42:22 +0000
commit95542a389112491abf3a31c338e7d78f7785f48e (patch)
tree1a4ece8deef6626c4649538fbf22acdee43114cb /src/views/dolphinview.cpp
parent3696213ccbbe27e9ef3fc85eb97dd32fd669066f (diff)
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.
Diffstat (limited to 'src/views/dolphinview.cpp')
-rw-r--r--src/views/dolphinview.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp
index 8302620e4..a18f53769 100644
--- a/src/views/dolphinview.cpp
+++ b/src/views/dolphinview.cpp
@@ -1239,7 +1239,7 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF &pos)
QAction *toggleSidePaddingAction = menu->addAction(i18nc("@action:inmenu", "Side Padding"));
toggleSidePaddingAction->setCheckable(true);
- toggleSidePaddingAction->setChecked(view->header()->sidePadding() > 0);
+ toggleSidePaddingAction->setChecked(layoutDirection() == Qt::LeftToRight ? view->header()->leftPadding() > 0 : view->header()->rightPadding() > 0);
QAction *autoAdjustWidthsAction = menu->addAction(i18nc("@action:inmenu", "Automatic Column Widths"));
autoAdjustWidthsAction->setCheckable(true);
@@ -1272,7 +1272,11 @@ void DolphinView::slotHeaderContextMenuRequested(const QPointF &pos)
props.setHeaderColumnWidths(columnWidths);
header->setAutomaticColumnResizing(false);
} else if (action == toggleSidePaddingAction) {
- header->setSidePadding(toggleSidePaddingAction->isChecked() ? 20 : 0);
+ if (toggleSidePaddingAction->isChecked()) {
+ header->setSidePadding(20, 20);
+ } else {
+ header->setSidePadding(0, 0);
+ }
} else {
// Show or hide the selected role
const QByteArray selectedRole = action->data().toByteArray();
@@ -1325,10 +1329,11 @@ void DolphinView::slotHeaderColumnWidthChangeFinished(const QByteArray &role, qr
props.setHeaderColumnWidths(columnWidths);
}
-void DolphinView::slotSidePaddingWidthChanged(qreal width)
+void DolphinView::slotSidePaddingWidthChanged(qreal leftPaddingWidth, qreal rightPaddingWidth)
{
ViewProperties props(viewPropertiesUrl());
- DetailsModeSettings::setSidePadding(int(width));
+ DetailsModeSettings::setLeftPadding(int(leftPaddingWidth));
+ DetailsModeSettings::setRightPadding(int(rightPaddingWidth));
m_view->writeSettings();
}
@@ -2184,7 +2189,7 @@ void DolphinView::applyViewProperties(const ViewProperties &props)
} else {
header->setAutomaticColumnResizing(true);
}
- header->setSidePadding(DetailsModeSettings::sidePadding());
+ header->setSidePadding(DetailsModeSettings::leftPadding(), DetailsModeSettings::rightPadding());
}
m_view->endTransaction();