From 8689559186feee6f1a345e00a7edf99ab4eca3b6 Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Thu, 5 Aug 2021 10:52:51 -0600 Subject: [PATCH] Limit very long backend names in InstallApplicationButton Otherwise the button may be so long that it elides the app text or even overflows outside of the layout! BUG: 439087 BUG: 437227 FIXED-IN: 5.23 --- discover/qml/InstallApplicationButton.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/discover/qml/InstallApplicationButton.qml b/discover/qml/InstallApplicationButton.qml index dcaaad5b7..3edfbfe1c 100644 --- a/discover/qml/InstallApplicationButton.qml +++ b/discover/qml/InstallApplicationButton.qml @@ -18,13 +18,17 @@ ConditionalLoader readonly property alias progress: listener.progress readonly property bool isStateAvailable: application.state !== AbstractResource.Broken readonly property alias listener: listener + // Arbitrary "very long" limit of 15 characters; any longer than this and + // it's not a good idea to show the whole thing in the button or else it + // will elide the app name and may even overflow the layout! + readonly property bool backendNameIsVeryLong: backendName.length !== 0 && backendName.length > 15 readonly property string text: { if (!root.isStateAvailable) { return i18nc("State being fetched", "Loading…") } if (!application.isInstalled) { // Must be from a non-default backend; tell the user where it's from - if (backendName.length !== 0) { + if (backendName.length !== 0 && !backendNameIsVeryLong) { return i18nc("Install the version of an app that comes from Snap, Flatpak, etc", "Install from %1", backendName); } return i18n("Install"); @@ -116,5 +120,8 @@ ConditionalLoader } activeFocusOnTab: false onClicked: root.click() + + ToolTip.visible: hovered && !application.isInstalled && root.backendNameIsVeryLong + ToolTip.text: i18nc("Install the version of an app that comes from Snap, Flatpak, etc", "Install from %1", backendName) } } -- GitLab