Commit 40c745cb authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Improve how we tell the frontend an licence is not free

parent 6c98b37a
Pipeline #149989 passed with stage
in 1 minute and 1 second
......@@ -352,7 +352,7 @@ DiscoverPage {
wrapMode: Text.Wrap
maximumLineCount: 3
elide: Text.ElideRight
color: text.toLowerCase().includes(i18n("proprietary")) ? Kirigami.Theme.neutralTextColor: enabled ? Kirigami.Theme.linkColor : Kirigami.Theme.textColor
color: !modelData.free ? Kirigami.Theme.neutralTextColor: enabled ? Kirigami.Theme.linkColor : Kirigami.Theme.textColor
}
}
......@@ -371,7 +371,7 @@ DiscoverPage {
Kirigami.LinkButton {
readonly property bool hasProprietaryLicense: {
const match = appInfo.application.licenses.find(element => {
return element.name.toLowerCase().includes(i18n("proprietary"));
return !element.free;
});
return match;
}
......
......@@ -68,9 +68,19 @@ QJsonArray AppStreamUtils::licenses(const AppStream::Component &appdata)
for (const auto &token : licenses) {
QString license = token;
license.remove(0, 1); // tokenize prefixes with an @ for some reason
QString name = license;
if (license == QLatin1String("LicenseRef-proprietary")) {
name = i18n("Proprietary");
}
if (!AppStream::SPDX::isLicenseId(license))
continue;
ret.append(QJsonObject{{QStringLiteral("name"), license}, {QStringLiteral("url"), {AppStream::SPDX::licenseUrl(license)}}});
ret.append(QJsonObject{
{QStringLiteral("name"), name},
{QStringLiteral("url"), {AppStream::SPDX::licenseUrl(license)}},
{QStringLiteral("free"), AppStream::SPDX::isFreeLicense(license)},
});
}
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