Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix write empty copyright author tags and sync with android #745

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/GpxDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ void OsmAnd::GpxDocument::writeMetadata(const Ref<Metadata>& metadata, const QSt
writeNotNullText(xmlWriter, QStringLiteral("name"), trackName);
writeNotNullText(xmlWriter, QStringLiteral("desc"), metadata->description);

if (metadata->author)
if (metadata->author && !metadata->author->name.isEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not corresponds to java code

{
xmlWriter.writeStartElement(QStringLiteral("author"));
writeAuthor(xmlWriter, metadata->author);
xmlWriter.writeEndElement();
}

if (metadata->copyright)
if (metadata->copyright && !metadata->copyright->author.isEmpty())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not corresponds to java code

{
xmlWriter.writeStartElement(QStringLiteral("copyright"));
writeCopyright(xmlWriter, metadata->copyright);
Expand Down Expand Up @@ -412,7 +412,9 @@ void OsmAnd::GpxDocument::writeAuthor(QXmlStreamWriter& xmlWriter, const Ref<Aut

void OsmAnd::GpxDocument::writeCopyright(QXmlStreamWriter& xmlWriter, const Ref<Copyright>& copyright)
{
xmlWriter.writeTextElement(QStringLiteral("author"), copyright->author);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not corresponds to java code. writeAttribute?

if (!copyright->author.isEmpty())
xmlWriter.writeAttribute(QStringLiteral("author"), copyright->author);

writeNotNullText(xmlWriter, QStringLiteral("year"), copyright->year);
writeNotNullText(xmlWriter, QStringLiteral("license"), copyright->license);
}
Expand Down