add long post data to postitem in stream and thread views.

This commit is contained in:
Morgan McMillian 2018-04-14 13:01:58 -07:00
parent 97ce9579ec
commit f12a602e4d
3 changed files with 29 additions and 11 deletions

View file

@ -155,6 +155,19 @@ Container {
navigation.focusPolicy: NavigationFocusPolicy.NotFocusable
}
}
Container { // long post body
topMargin: ui.sdu(2.0)
bottomMargin: ui.sdu(2.0)
visible: (typeof ListItemData.longpost_body !== "undefined")
Divider {
}
Label {
text: (typeof ListItemData.longpost_body !== "undefined") ? ListItemData.longpost_body : ""
multiline: true
textFormat: TextFormat.Html
navigation.focusPolicy: NavigationFocusPolicy.NotFocusable
}
}
Container { // post embeds
// TODO: add tab to open full image in a page
horizontalAlignment: HorizontalAlignment.Center

View file

@ -226,7 +226,8 @@ void Pnut::onAuthorizedRequestReady(QByteArray data, int id)
}
else if (endpoint == ":thread")
{
emit threadReceived(variant.toMap()["data"].toList());
QVariantList streamlist = variant.toMap()["data"].toList();
emit threadReceived(parseStream(streamlist));
req_map.remove(id);
}
else if (endpoint == ":userstream")
@ -576,6 +577,10 @@ QVariantList Pnut::parseStream(QVariantList stream)
}
}
}
if (raw["type"] == "nl.chimpnut.blog.post") {
QVariantMap value = raw["value"].toMap();
item.insert("longpost_body", value["body"]);
}
}
}
pstream.append(item);

View file

@ -43,52 +43,52 @@
<context>
<name>PostItem</name>
<message>
<location filename="../assets/PostItem.qml" line="258"/>
<location filename="../assets/PostItem.qml" line="271"/>
<source>Reply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="267"/>
<location filename="../assets/PostItem.qml" line="280"/>
<source>Reply All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="277"/>
<location filename="../assets/PostItem.qml" line="290"/>
<source>Delete Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="277"/>
<location filename="../assets/PostItem.qml" line="290"/>
<source>Add Bookmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="288"/>
<location filename="../assets/PostItem.qml" line="301"/>
<source>Delete Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="288"/>
<location filename="../assets/PostItem.qml" line="301"/>
<source>Repost</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="299"/>
<location filename="../assets/PostItem.qml" line="312"/>
<source>Quote</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="308"/>
<location filename="../assets/PostItem.qml" line="321"/>
<source>View Profile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="315"/>
<location filename="../assets/PostItem.qml" line="328"/>
<source>Copy text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../assets/PostItem.qml" line="345"/>
<location filename="../assets/PostItem.qml" line="358"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>