added option to delete post and stub to edit

This commit is contained in:
Morgan McMillian 2016-10-30 09:51:43 -07:00
parent f61584a526
commit 564177a233
9 changed files with 42 additions and 6 deletions

View file

@ -1,5 +1,5 @@
1 1
39 40
AppCover.qml AppCover.qml
icons/at.png icons/at.png
icons/bell-slash.png icons/bell-slash.png
@ -14,6 +14,7 @@ icons/ic_cancel.png
icons/ic_compose.png icons/ic_compose.png
icons/ic_contact.png icons/ic_contact.png
icons/ic_del_bookmarks.png icons/ic_del_bookmarks.png
icons/ic_edit.png
icons/ic_favorite.png icons/ic_favorite.png
icons/ic_reload.png icons/ic_reload.png
icons/ic_reply.png icons/ic_reply.png

View file

@ -221,6 +221,23 @@ Container {
postitem.ListItem.view.viewProfile(ListItemData.user) postitem.ListItem.view.viewProfile(ListItemData.user)
} }
} }
// ActionItem {
// id: edItem
// enabled: (ListItemData.user.username === postitem.ListItem.view.getUserName())
// title: qsTr("Edit")
// imageSource: "asset:///icons/ic_edit.png"
// onTriggered: {
// // do an edit
// }
// }
DeleteActionItem {
id: delItem
enabled: (ListItemData.user.username === postitem.ListItem.view.getUserName())
title: qsTr("Delete")
onTriggered: {
postitem.ListItem.view.delPost(ListItemData.id)
}
}
} }
] ]
attachedObjects: [ attachedObjects: [

View file

@ -99,6 +99,9 @@ NavigationPane {
function delRepost(pid) { function delRepost(pid) {
pnut.deleteRepost(pid); pnut.deleteRepost(pid);
} }
function delPost(pid) {
pnut.deletePost(pid);
}
attachedObjects: [ attachedObjects: [
ListScrollStateHandler { ListScrollStateHandler {
onAtEndChanged: { onAtEndChanged: {

BIN
assets/icons/ic_edit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2 KiB

View file

@ -1 +1 @@
209 212

View file

@ -88,6 +88,7 @@ config_pri_assets {
$$quote($$BASEDIR/assets/icons/ic_compose.png) \ $$quote($$BASEDIR/assets/icons/ic_compose.png) \
$$quote($$BASEDIR/assets/icons/ic_contact.png) \ $$quote($$BASEDIR/assets/icons/ic_contact.png) \
$$quote($$BASEDIR/assets/icons/ic_del_bookmarks.png) \ $$quote($$BASEDIR/assets/icons/ic_del_bookmarks.png) \
$$quote($$BASEDIR/assets/icons/ic_edit.png) \
$$quote($$BASEDIR/assets/icons/ic_favorite.png) \ $$quote($$BASEDIR/assets/icons/ic_favorite.png) \
$$quote($$BASEDIR/assets/icons/ic_reload.png) \ $$quote($$BASEDIR/assets/icons/ic_reload.png) \
$$quote($$BASEDIR/assets/icons/ic_reply.png) \ $$quote($$BASEDIR/assets/icons/ic_reply.png) \

View file

@ -450,3 +450,11 @@ void Pnut::unmuteUser(QString uid)
req_map[++req_id] = ":unmute"; req_map[++req_id] = ":unmute";
deleteRequest(url, parameters, req_id); deleteRequest(url, parameters, req_id);
} }
void Pnut::deletePost(QString pid)
{
QUrl url(PNUT_API_ROOT + "/posts/" + pid);
KQOAuthParameters parameters;
req_map[++req_id] = ":post";
deleteRequest(url, parameters, req_id);
}

View file

@ -83,6 +83,7 @@ public:
Q_INVOKABLE void repost(QString pid); Q_INVOKABLE void repost(QString pid);
Q_INVOKABLE void deleteRepost(QString pid); Q_INVOKABLE void deleteRepost(QString pid);
Q_INVOKABLE void logout(); Q_INVOKABLE void logout();
Q_INVOKABLE void deletePost(QString pid);
public slots: public slots:
void onRequestReady(QByteArray data); void onRequestReady(QByteArray data);

View file

@ -74,6 +74,11 @@
<source>View Profile</source> <source>View Profile</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../assets/PostItem.qml" line="236"/>
<source>Delete</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ProfilePage</name> <name>ProfilePage</name>
@ -157,22 +162,22 @@
<context> <context>
<name>StreamTab</name> <name>StreamTab</name>
<message> <message>
<location filename="../assets/StreamTab.qml" line="123"/> <location filename="../assets/StreamTab.qml" line="126"/>
<source>New Post</source> <source>New Post</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="137"/> <location filename="../assets/StreamTab.qml" line="140"/>
<source>To Top</source> <source>To Top</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="165"/> <location filename="../assets/StreamTab.qml" line="168"/>
<source>To Bottom</source> <source>To Bottom</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../assets/StreamTab.qml" line="152"/> <location filename="../assets/StreamTab.qml" line="155"/>
<source>Reload</source> <source>Reload</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>