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
azubieta
plasma-appimage-integration
Commits
e174e158
Verified
Commit
e174e158
authored
Jul 17, 2019
by
azubieta
Browse files
Only set metadata fields when the data is available
parent
67a14d3c
Pipeline
#609
passed with stage
in 1 minute and 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/metadata-extractor/AppImageExtractor.cpp
View file @
e174e158
...
...
@@ -4,6 +4,7 @@
#include
<QJsonObject>
#include
<QJsonDocument>
#include
<QDebug>
#include
<KFileMetaData/Properties>
// local
#include
"AppImageExtractor.h"
...
...
@@ -42,14 +43,19 @@ void KFileMetaData::AppImageExtractor::extract(ExtractionResult* result) {
QJsonDocument
document
=
QJsonDocument
::
fromJson
(
response
.
toLocal8Bit
());
QJsonObject
root
=
document
.
object
();
QJsonValue
nameValue
=
root
.
value
(
"name"
);
result
->
add
(
Property
::
Title
,
nameValue
.
toVariant
());
QString
nameValue
=
root
.
value
(
"name"
).
toString
();
if
(
!
nameValue
.
isEmpty
())
result
->
add
(
Property
::
Title
,
nameValue
);
QJsonValue
summary
=
root
.
value
(
"summary"
);
result
->
add
(
Property
::
Description
,
summary
.
toString
());
// Property::Description is not supported until KF5 5.53.0
QString
summary
=
root
.
value
(
"summary"
).
toString
();
if
(
!
summary
.
isEmpty
())
result
->
add
(
Property
::
Description
,
summary
);
QJsonValue
license
=
root
.
value
(
"license"
);
result
->
add
(
Property
::
License
,
license
.
toString
());
QString
license
=
root
.
value
(
"license"
).
toString
();
if
(
!
license
.
isEmpty
())
result
->
add
(
Property
::
License
,
license
);
QJsonValue
links
=
root
.
value
(
"links"
);
QJsonObject
linksOjbect
=
links
.
toObject
();;
...
...
Write
Preview
Supports
Markdown
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