diff --git a/assets/.assets.index b/assets/.assets.index index d19b730..5a7c16b 100644 --- a/assets/.assets.index +++ b/assets/.assets.index @@ -1,5 +1,5 @@ 1 -39 +40 AppCover.qml icons/at.png icons/bell-slash.png @@ -14,6 +14,7 @@ icons/ic_cancel.png icons/ic_compose.png icons/ic_contact.png icons/ic_del_bookmarks.png +icons/ic_edit.png icons/ic_favorite.png icons/ic_reload.png icons/ic_reply.png diff --git a/assets/PostItem.qml b/assets/PostItem.qml index cd74de1..f590926 100644 --- a/assets/PostItem.qml +++ b/assets/PostItem.qml @@ -221,6 +221,23 @@ Container { 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: [ diff --git a/assets/StreamTab.qml b/assets/StreamTab.qml index c91587a..31a8514 100644 --- a/assets/StreamTab.qml +++ b/assets/StreamTab.qml @@ -99,6 +99,9 @@ NavigationPane { function delRepost(pid) { pnut.deleteRepost(pid); } + function delPost(pid) { + pnut.deletePost(pid); + } attachedObjects: [ ListScrollStateHandler { onAtEndChanged: { diff --git a/assets/icons/ic_edit.png b/assets/icons/ic_edit.png new file mode 100644 index 0000000..085341e Binary files /dev/null and b/assets/icons/ic_edit.png differ diff --git a/buildnum b/buildnum index 274ccca..b7c52fb 100644 --- a/buildnum +++ b/buildnum @@ -1 +1 @@ -209 \ No newline at end of file +212 \ No newline at end of file diff --git a/config.pri b/config.pri index c0bd7a0..3a4934e 100644 --- a/config.pri +++ b/config.pri @@ -88,6 +88,7 @@ config_pri_assets { $$quote($$BASEDIR/assets/icons/ic_compose.png) \ $$quote($$BASEDIR/assets/icons/ic_contact.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_reload.png) \ $$quote($$BASEDIR/assets/icons/ic_reply.png) \ diff --git a/src/Pnut.cpp b/src/Pnut.cpp index b9ec009..15da49e 100644 --- a/src/Pnut.cpp +++ b/src/Pnut.cpp @@ -450,3 +450,11 @@ void Pnut::unmuteUser(QString uid) req_map[++req_id] = ":unmute"; 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); +} diff --git a/src/Pnut.h b/src/Pnut.h index 17c2ed4..adade16 100644 --- a/src/Pnut.h +++ b/src/Pnut.h @@ -83,6 +83,7 @@ public: Q_INVOKABLE void repost(QString pid); Q_INVOKABLE void deleteRepost(QString pid); Q_INVOKABLE void logout(); + Q_INVOKABLE void deletePost(QString pid); public slots: void onRequestReady(QByteArray data); diff --git a/translations/Goober.ts b/translations/Goober.ts index 68cfbf9..f6f5b43 100644 --- a/translations/Goober.ts +++ b/translations/Goober.ts @@ -74,6 +74,11 @@ View Profile + + + Delete + + ProfilePage @@ -157,22 +162,22 @@ StreamTab - + New Post - + To Top - + To Bottom - + Reload