Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Discover
Commits
40c745cb
Commit
40c745cb
authored
Mar 14, 2022
by
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
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
discover/qml/ApplicationPage.qml
View file @
40c745cb
...
...
@@ -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
;
}
...
...
libdiscover/appstream/AppStreamUtils.cpp
View file @
40c745cb
...
...
@@ -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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment