diff --git a/src/plugins/render/notes/NotesItem.h b/src/plugins/render/notes/NotesItem.h --- a/src/plugins/render/notes/NotesItem.h +++ b/src/plugins/render/notes/NotesItem.h @@ -32,8 +32,23 @@ bool operator<(const AbstractDataPluginItem *other) const override; + void setAuthor(const QString &author); + + void setDateCreated(const QString& dateCreated); + + void setNoteStatus(const QString& noteStatus); + + void setDateClosed(const QString& dataClosed); + + void setCommentsCount(const QString& commentsCount); private: QPixmap m_pixmap; + QString m_author; + QString m_dateCreated; + QString m_noteStatus; + QString m_dateClosed; + QString m_commentsCount; + }; } diff --git a/src/plugins/render/notes/NotesItem.cpp b/src/plugins/render/notes/NotesItem.cpp --- a/src/plugins/render/notes/NotesItem.cpp +++ b/src/plugins/render/notes/NotesItem.cpp @@ -39,3 +39,28 @@ { painter->drawPixmap(0, 0, m_pixmap); } + +void NotesItem::setAuthor(const QString& author) +{ + m_author = author; +} + +void NotesItem::setDateCreated(const QString& dateCreated) +{ + m_dateCreated = dateCreated; +} + +void NotesItem::setDateClosed(const QString& dateClosed) +{ + m_dateClosed = dateClosed; +} + +void NotesItem::setNoteStatus(const QString& noteStatus) +{ + m_noteStatus = noteStatus; +} + +void NotesItem::setCommentsCount(const QString& commentsCount) +{ + m_commentsCount = commentsCount; +} diff --git a/src/plugins/render/notes/NotesModel.cpp b/src/plugins/render/notes/NotesModel.cpp --- a/src/plugins/render/notes/NotesModel.cpp +++ b/src/plugins/render/notes/NotesModel.cpp @@ -67,13 +67,29 @@ QJsonArray coordinates = geometry.value(QStringLiteral("coordinates")).toArray(); double longitude = coordinates.at(0).toDouble(); double latitude = coordinates.at(1).toDouble(); - GeoDataCoordinates coordinateset(longitude, latitude, 0.0, GeoDataCoordinates::Degree); - QString id = QString::number(jsonObj.value(QStringLiteral("properties")).toObject().value(QStringLiteral("id")).toInt()); + + QJsonObject noteProperties = jsonObj.value(QStringLiteral("properties")).toObject(); + QJsonArray noteComments = noteProperties.value(QStringLiteral("comments")).toArray(); + + QString id = QString::number(noteProperties.value(QStringLiteral("id")).toInt()); + QString author = noteComments.at(0).toObject().value(QStringLiteral("user")).toString(); + author.append(":"); + author.append(noteComments.at(0).toObject().value(QStringLiteral("uid")).toString()); + + QString dateCreated = noteProperties.value(QStringLiteral("date_created")).toString(); + QString dateClosed = noteProperties.value(QStringLiteral("closed_at")).toString(); + QString noteStatus = noteProperties.value(QStringLiteral("status")).toString(); + QString commentsCount = QString::number(noteComments.size()); NotesItem *item = new NotesItem(this); item->setId(id); item->setCoordinate(coordinateset); + item->setAuthor(author); + item->setDateCreated(dateCreated); + item->setNoteStatus(noteStatus); + item->setDateClosed(dateClosed); + item->setCommentsCount(commentsCount); items << item; }