Skip to content
GitLab
Menu
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
997762e3
Commit
997762e3
authored
Oct 07, 2019
by
Aleix Pol Gonzalez
🐧
Browse files
Use the right API for retrieving SPDX licences
BUG: 408112
parent
c550098a
Changes
2
Hide whitespace changes
Inline
Side-by-side
libdiscover/CMakeLists.txt
View file @
997762e3
...
...
@@ -55,6 +55,11 @@ if(AppStreamQt_FOUND)
else
()
target_compile_definitions
(
DiscoverCommon PRIVATE -DAPPSTREAM_HAS_SPDX=0
)
endif
()
if
(
AppStreamQt_VERSION VERSION_GREATER 0.12.7
)
target_compile_definitions
(
DiscoverCommon PRIVATE -DAPPSTREAM_HAS_SPDX_LICENSEURL=1
)
else
()
target_compile_definitions
(
DiscoverCommon PRIVATE -DAPPSTREAM_HAS_SPDX_LICENSEURL=0
)
endif
()
endif
()
target_link_libraries
(
DiscoverCommon
...
...
libdiscover/appstream/AppStreamUtils.cpp
View file @
997762e3
...
...
@@ -87,11 +87,14 @@ QJsonArray AppStreamUtils::licenses(const AppStream::Component& appdata)
license
.
remove
(
0
,
1
);
//tokenize prefixes with an @ for some reason
if
(
!
AppStream
::
SPDX
::
isLicenseId
(
license
))
continue
;
#if APPSTREAM_HAS_SPDX_LICENSEURL
ret
.
append
(
QJsonObject
{
{
QStringLiteral
(
"name"
),
license
},
{
QStringLiteral
(
"url"
),
{
AppStream
::
SPDX
::
licenseUrl
(
license
)
}
}});
#else
if
(
license
.
startsWith
(
prop
))
ret
.
append
(
QJsonObject
{
{
QStringLiteral
(
"name"
),
i18n
(
"Proprietary"
)},
{
QStringLiteral
(
"url"
),
license
.
mid
(
prop
.
size
())}
});
else
ret
.
append
(
QJsonObject
{
{
QStringLiteral
(
"name"
),
license
},
{
QStringLiteral
(
"url"
),
{
QLatin1String
(
"https://spdx.org/licenses/"
)
+
AppStream
::
SPDX
::
asSpdxId
(
license
)
+
QLatin1String
(
".html#licenseText"
)
}
}});
#endif
}
return
ret
;
#else
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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