Commit 821f3ea6 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Improve how we display public domain licenses

Name them as "Public Domain".
Identify them as "with freedom" even though they are not free licenses
due to some technicality.

BUG: 452162
parent c96fd86d
Pipeline #159244 passed with stage
in 1 minute and 37 seconds
......@@ -356,7 +356,7 @@ DiscoverPage {
wrapMode: Text.Wrap
maximumLineCount: 3
elide: Text.ElideRight
color: !modelData.free ? Kirigami.Theme.neutralTextColor: enabled ? Kirigami.Theme.linkColor : Kirigami.Theme.textColor
color: !modelData.hasFreedom ? Kirigami.Theme.neutralTextColor: enabled ? Kirigami.Theme.linkColor : Kirigami.Theme.textColor
}
}
......@@ -364,7 +364,7 @@ DiscoverPage {
ToolButton {
readonly property bool hasProprietaryLicense: {
const match = appInfo.application.licenses.find(element => {
return !element.free;
return !element.hasFreedom;
});
return match;
}
......
......@@ -69,9 +69,13 @@ QJsonArray AppStreamUtils::licenses(const AppStream::Component &appdata)
QString license = token;
license.remove(0, 1); // tokenize prefixes with an @ for some reason
bool publicLicense = false;
QString name = license;
if (license == QLatin1String("LicenseRef-proprietary")) {
name = i18n("Proprietary");
} else if (license == QLatin1String("LicenseRef-public-domain")) {
name = i18n("Public Domain");
publicLicense = true;
}
if (!AppStream::SPDX::isLicenseId(license))
......@@ -79,7 +83,7 @@ QJsonArray AppStreamUtils::licenses(const AppStream::Component &appdata)
ret.append(QJsonObject{
{QStringLiteral("name"), name},
{QStringLiteral("url"), {AppStream::SPDX::licenseUrl(license)}},
{QStringLiteral("free"), AppStream::SPDX::isFreeLicense(license)},
{QStringLiteral("hasFreedom"), AppStream::SPDX::isFreeLicense(license) || publicLicense},
});
}
return ret;
......
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