From 564177a233e264d8df1da0b3866752b6d12f13ad Mon Sep 17 00:00:00 2001 From: Morgan McMillian Date: Sun, 30 Oct 2016 09:51:43 -0700 Subject: [PATCH] added option to delete post and stub to edit --- assets/.assets.index | 3 ++- assets/PostItem.qml | 17 +++++++++++++++++ assets/StreamTab.qml | 3 +++ assets/icons/ic_edit.png | Bin 0 -> 2057 bytes buildnum | 2 +- config.pri | 1 + src/Pnut.cpp | 8 ++++++++ src/Pnut.h | 1 + translations/Goober.ts | 13 +++++++++---- 9 files changed, 42 insertions(+), 6 deletions(-) create mode 100644 assets/icons/ic_edit.png 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 0000000000000000000000000000000000000000..085341ea647405bfb4c8d618fb4cd5078e19fdb4 GIT binary patch literal 2057 zcmbVLdsGu=7N78HPQ=1mpwvYfhprZD9+P(hk%UYl5rTkdSv@O+WP~gv6DNZS6fjG% z(cN{I%39j>0oGk~wHvlwwt}=^sR$v*iXLs1BWg5Cd+3@NYYh@{CkX80c>2fAnQy*( zzq!BPeSG)s&dXi1khYix0Kh_37E(a&C80%)BEPrZvk1xU6+%%&tjD$z77dO9G96Zm zf+~Zi3@t!4y6SCCG#voK%k_mtM3Fj2ti=orO~{5}HJC^=0HkMFO&V73rXi)nK|+OcEGSLIYY2l}5AJDuHHr z#iSfMWOkz*=C{YZ0!|MnO?&9J zkVacqJu}Y~0FaVGEV&}cHLn(R)bF~P{MY3fE7F4I_)SvNsN#CF+bVW#17a`b`mb-9 zHb#U2U86FG-zVBe1==oc_xG-@-4d61ky4rBeRN*}Q&mxUS@lYWZ?f(uR24>1c+Mt) z->ms+G4RdQm803z{%pT6`pl;%4qVI0txEf$F}*o>VNJCbUi5>5=lP|-5SJ%VlWRKx zz}HsgY4+4k*Wn4&zdxqBrC*k{dnxa}8Q$%3ez*}oJ~;lHA@9MbuhX~He_}7bkR9lj zW@R5da?XwUV|$aSdgp^qUU2PEuRm-Vz0SdZyKmrrM`i42w_*g4BV-im_6_$B^!{nn(14_!e&+Ix24BqHleCsed+ik>!0)ul zJ!`|=Eqf;#x@=uxL$?>7x+)F0oGoEJO^IP6?&M`}BvN<0GP$nI6895J62?_mK;ruFs9TP`sjlMnN|hK_|LN*#Aryrg>K@nOhaC)5B$?LCj@ZL}vV zNMB}8WdEJ%o4%hyk1Cfe1Kt`McRq-2?7+GNDWb03RNLpC1)i%U`LS#JFdD$FpiV;F zXQY7#PW3xWuiK-g_Kxx5t*^qtzfq#^q}ocu-4jzo^!V_dktITV#+WoVOmV*u)7G@+@a>(hC&TWO$KG>sZQ?_;rWcEEn7pYAbc;@B;XQbn@Xwb% z=iT_V?;kk~^(tO$@1YNSI#%sw#XjyZl~SpEq?@!4Yq=<`IO2R z)cwMezu0|M0`uB#*SXe}S#hU_R}DVgcwXuFXUo1GZqlNA4a(*l-*+AT^zI+Ge6i!L z=ud3%NxhD-n!2OYUzey?+V*@|PH`NcY~SR1k{)-fFyg;v@_$AY$=(r}2$YrB+lH&J QCXmAms1&(~BeSI8UlW)ee*gdg literal 0 HcmV?d00001 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