Commit ce89d530 authored by Nate Graham's avatar Nate Graham Committed by Aleix Pol Gonzalez
Browse files

Mention backend name in "Install" button to make the source super clear

This allows the backend to be really really clear to the user, even if
they're not familiar with the logos and don't think to hover the cursor
over it to see the tooltip. In fact with this commit, the tooltip is
removed because the name is now visible by default in the button name,
so it's no longer needed.

BUG: 433370
FIXED-IN: 5.22
parent 7ab342b0
......@@ -17,6 +17,8 @@ Kirigami.AbstractCard
property alias application: installButton.application
property bool compact: false
property bool showRating: true
readonly property bool appIsFromNonDefaultBackend: ResourcesModel.currentApplicationBackend !== application.backend && application.backend.hasApplications
showClickFeedback: true
function trigger() {
......@@ -85,6 +87,12 @@ Kirigami.AbstractCard
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
Layout.rowSpan: delegateArea.compact ? 3 : 1
compact: delegateArea.compact
backendName: delegateArea.appIsFromNonDefaultBackend ? application.backend.displayName : ""
// TODO: Show the backend icon inside the button for Flatpak
// and Snap backend items in widescreen mode. Currently blocked
// by https://bugs.kde.org/show_bug.cgi?id=433433
}
RowLayout {
......@@ -115,13 +123,15 @@ Kirigami.AbstractCard
maximumLineCount: 1
textFormat: Text.PlainText
// TODO: remove this once the backend icon is inside the install
// button (blocked by https://bugs.kde.org/show_bug.cgi?id=433433)
Kirigami.Icon {
id: soup
source: application.sourceIcon
height: Kirigami.Units.gridUnit
width: Kirigami.Units.gridUnit
smooth: true
visible: !delegateArea.compact && ResourcesModel.currentApplicationBackend !== application.backend && application.backend.hasApplications
visible: !delegateArea.compact && delegateArea.appIsFromNonDefaultBackend
HoverHandler {
id: sourceIconHover
......
......@@ -7,14 +7,25 @@ import org.kde.kirigami 2.14 as Kirigami
ConditionalLoader
{
id: root
property Component additionalItem: null
property bool compact: false
property string backendName: ""
property alias application: listener.resource
readonly property alias isActive: listener.isActive
readonly property alias progress: listener.progress
readonly property alias listener: listener
readonly property string text: !application.isInstalled ? i18n("Install") : i18n("Remove")
property Component additionalItem: null
property bool compact: false
readonly property string text: {
if (!application.isInstalled) {
// Must be from a non-default backend; tell the user where it's from
if (backendName.length !== 0) {
return i18nc("Install the version of an app that comes from Snap, Flatpak, etc", "Install from %1", backendName);
}
return i18n("Install");
}
return i18n("Remove");
}
TransactionListener {
id: listener
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment