From 3b00b4221321db01df63661c1e1903a8d4f15ecd Mon Sep 17 00:00:00 2001
From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com>
Date: Thu, 3 Aug 2023 10:49:09 -0300
Subject: [PATCH] RTL: fix sparse side panel options

+ fix splitview width resize
+ fix tips row in the WelcomePage

GitLab: #1290
Change-Id: I458e6a96e496b35b7659c5a061949f135511a2e4
---
 src/app/commoncomponents/DualPaneView.qml  | 13 ++++++++-----
 src/app/constant/JamiTheme.qml             |  1 +
 src/app/mainview/components/TipsRow.qml    |  6 +++---
 src/app/settingsview/SettingsSidePanel.qml |  2 +-
 4 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/app/commoncomponents/DualPaneView.qml b/src/app/commoncomponents/DualPaneView.qml
index 98d0073bc..57b24d3f6 100644
--- a/src/app/commoncomponents/DualPaneView.qml
+++ b/src/app/commoncomponents/DualPaneView.qml
@@ -85,10 +85,12 @@ BaseView {
         clip: true
         required property bool isMinorPane
         onWidthChanged: {
-            if (!isSinglePane && ((isRTL && !isMinorPane) || (!isRTL && isMinorPane)))
+            if (!isSinglePane && isMinorPane)
                 previousMinorPaneWidth = width
-            if (!isSinglePane && ((isRTL && isMinorPane) || (!isRTL && !isMinorPane)))
+            if (!isSinglePane && !isMinorPane)
                 previousMajorPaneWidth = width
+            if (isMinorPane)
+                JamiTheme.currentLeftPaneWidth = width
         }
 
         Connections {
@@ -101,8 +103,9 @@ BaseView {
             }
         }
 
-        SplitView.minimumWidth: isSinglePane ? viewNode.width : (isMinorPane && !isRTL ? minorPaneMinWidth : majorPaneMinWidth)
-        SplitView.maximumWidth: isSinglePane ? viewNode.width : viewNode.width - (isMinorPane && !isRTL ? majorPaneMinWidth : minorPaneMinWidth)
-        SplitView.preferredWidth: isMinorPane && !isRTL ? minorPaneMinWidth : majorPaneMinWidth
+        SplitView.minimumWidth: isSinglePane ? undefined : (isMinorPane ? minorPaneMinWidth : majorPaneMinWidth)
+        SplitView.maximumWidth: isSinglePane || !isMinorPane ? undefined : Math.abs(viewNode.width - majorPaneMinWidth)
+        SplitView.preferredWidth: isSinglePane || !isMinorPane ? undefined : JamiTheme.currentLeftPaneWidth
+        SplitView.fillWidth: !isMinorPane || isSinglePane
     }
 }
diff --git a/src/app/constant/JamiTheme.qml b/src/app/constant/JamiTheme.qml
index 4b0f5c8d4..3d421faa0 100644
--- a/src/app/constant/JamiTheme.qml
+++ b/src/app/constant/JamiTheme.qml
@@ -307,6 +307,7 @@ Item {
 
     // Sizes
     property real mainViewLeftPaneMinWidth: 300
+    property real currentLeftPaneWidth: mainViewLeftPaneMinWidth
     property real mainViewPaneMinWidth: 490
     property real qrCodeImageSize: 256
     property real splitViewHandlePreferredWidth: 4
diff --git a/src/app/mainview/components/TipsRow.qml b/src/app/mainview/components/TipsRow.qml
index d230a256b..f5d3a7636 100644
--- a/src/app/mainview/components/TipsRow.qml
+++ b/src/app/mainview/components/TipsRow.qml
@@ -59,7 +59,7 @@ JamiFlickable {
                 type: Type
                 property bool hideTipBox: false
                 anchors.bottom: row.bottom
-                textColor:tipsTextColor
+                textColor: tipsTextColor
                 iconColor: tipsRow.iconColor
 
                 visible: {
@@ -74,14 +74,14 @@ JamiFlickable {
                 }
 
                 enabled: {
-                    if (x >= tipsRow.width)
+                    if (x > tipsRow.width || x < tipsRow.x )
                         return false;
                     else
                         return true;
                 }
 
                 opacity: {
-                    if (x >= tipsRow.width)
+                    if (x > tipsRow.width || x < tipsRow.x )
                         return 0;
                     else
                         return 1;
diff --git a/src/app/settingsview/SettingsSidePanel.qml b/src/app/settingsview/SettingsSidePanel.qml
index 92511de41..fb0909b14 100644
--- a/src/app/settingsview/SettingsSidePanel.qml
+++ b/src/app/settingsview/SettingsSidePanel.qml
@@ -226,7 +226,7 @@ SidePanelBase {
 
                 ListView {
                     id: childListView
-                    width: parent.width
+                    Layout.fillWidth: true
                     height: childrenRect.height
                     clip: true
                     visible: isChildSelected
-- 
GitLab