From 9385f0c8c16072e6a4b33e55083691fecc03d24c Mon Sep 17 00:00:00 2001 From: hunbernd Date: Wed, 2 Oct 2019 13:45:17 +0200 Subject: [PATCH 1/6] Display the full URL There was no way to see the full URL, only the site --- retroshare-gui/src/gui/Posted/PostedItem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index 5e42a1ef6..6b26a1b0f 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -306,7 +306,7 @@ void PostedItem::fill() urlstr += messageName(); urlstr += QString(" "); - QString siteurl = url.scheme() + "://" + url.host(); + QString siteurl = url.toEncoded(); sitestr = QString(" %2 ").arg(siteurl).arg(siteurl); ui->titleLabel->setText(urlstr); From d78811ab5e058e69d0ac7eabcd122f27a232938a Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 5 Oct 2019 16:02:44 +0200 Subject: [PATCH 2/6] Fixed the toolbar frames before used wrong names for the default stylesheet --- plugins/FeedReader/gui/FeedReaderDialog.ui | 34 ++++++++++++++----- retroshare-gui/src/gui/chat/ChatWidget.ui | 2 +- .../src/gui/qss/stylesheet/Standard.qss | 2 +- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/plugins/FeedReader/gui/FeedReaderDialog.ui b/plugins/FeedReader/gui/FeedReaderDialog.ui index 124f3a032..7c77717bb 100644 --- a/plugins/FeedReader/gui/FeedReaderDialog.ui +++ b/plugins/FeedReader/gui/FeedReaderDialog.ui @@ -39,14 +39,23 @@ - + + 0 + + + 0 + + + 0 + + 0 0 - + QFrame::Box @@ -54,7 +63,16 @@ QFrame::Sunken - + + 2 + + + 2 + + + 2 + + 2 @@ -160,6 +178,11 @@ + + StyledLabel + QLabel +
gui/common/StyledLabel.h
+
RSTreeWidget QTreeWidget @@ -171,11 +194,6 @@
gui/common/RSTabWidget.h
1
- - StyledLabel - QLabel -
gui/common/StyledLabel.h
-
diff --git a/retroshare-gui/src/gui/chat/ChatWidget.ui b/retroshare-gui/src/gui/chat/ChatWidget.ui index a937bf247..34ee50e53 100644 --- a/retroshare-gui/src/gui/chat/ChatWidget.ui +++ b/retroshare-gui/src/gui/chat/ChatWidget.ui @@ -303,7 +303,7 @@ border-image: url(:/images/closepressed.png) - + QFrame::Box diff --git a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss index 99d4aa59e..05670f863 100644 --- a/retroshare-gui/src/gui/qss/stylesheet/Standard.qss +++ b/retroshare-gui/src/gui/qss/stylesheet/Standard.qss @@ -2,7 +2,7 @@ /* Standard rules */ -QFrame#toolBarFrame { +QFrame#toolBarFrame, QFrame#toolBarFrameTop { background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #FEFEFE, stop:1 #E8E8E8); border: 1px solid #CCCCCC; } From d836694ce2da76b270c6e6c63c0bb291bd7e82c4 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sat, 5 Oct 2019 17:50:00 +0200 Subject: [PATCH 3/6] Reset to the first page when changing topics --- retroshare-gui/src/gui/Posted/PostedListWidget.cpp | 7 +++++++ retroshare-gui/src/gui/Posted/PostedListWidget.h | 1 + 2 files changed, 8 insertions(+) diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp index 2d8d2cfd9..7450680bc 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp @@ -124,6 +124,13 @@ QIcon PostedListWidget::groupIcon() return QIcon(); } +void PostedListWidget::groupIdChanged() +{ + mPostIndex = 0; + GxsMessageFramePostWidget::groupIdChanged(); + updateShowText(); +} + /*****************************************************************************************/ // Overloaded from FeedHolder. QScrollArea *PostedListWidget::getScrollArea() diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.h b/retroshare-gui/src/gui/Posted/PostedListWidget.h index 9d472c7a5..8184a444c 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.h +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.h @@ -44,6 +44,7 @@ public: /* GxsMessageFrameWidget */ virtual QIcon groupIcon(); + virtual void groupIdChanged(); /* FeedHolder */ virtual QScrollArea *getScrollArea(); From c91dc58c9897ebe65d399d4746fa2389a3908cf2 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sat, 5 Oct 2019 18:17:03 +0200 Subject: [PATCH 4/6] Removed the icon of other topics, because subscribed and popular don't have one. --- retroshare-gui/src/gui/Posted/PostedDialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/Posted/PostedDialog.cpp b/retroshare-gui/src/gui/Posted/PostedDialog.cpp index c312bd8e8..f83306103 100644 --- a/retroshare-gui/src/gui/Posted/PostedDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedDialog.cpp @@ -109,7 +109,7 @@ QString PostedDialog::icon(IconType type) case ICON_POPULAR_GROUP: return ""; case ICON_OTHER_GROUP: - return ":/icons/png/feed-other.png"; + return ""; case ICON_SEARCH: return ":/images/find.png"; case ICON_DEFAULT: From 145ecbd3b2268cc763abf53280326f0971a482d8 Mon Sep 17 00:00:00 2001 From: hunbernd Date: Sun, 6 Oct 2019 13:58:10 +0200 Subject: [PATCH 5/6] Fixed misleading comments in retroshare.pri and no_retroshare_service switch Note: the default state of the switches was not changed --- retroshare.pri | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/retroshare.pri b/retroshare.pri index b43736a0c..dcb9dc4cb 100644 --- a/retroshare.pri +++ b/retroshare.pri @@ -32,13 +32,13 @@ no_retroshare_gui:CONFIG -= retroshare_gui # Enable GXS distant syncronization CONFIG *= gxsdistsync -# To disable RetroShare-nogui append the following -# assignation to qmake command line "CONFIG+=no_retroshare_nogui" +# To enable RetroShare-nogui append the following +# assignation to qmake command line "CONFIG+=retroshare_nogui" CONFIG *= no_retroshare_nogui retroshare_nogui:CONFIG -= no_retroshare_nogui -# To disable cmark append the following -# assignation to qmake command line "CONFIG+=no_cmark" +# To enable cmark append the following +# assignation to qmake command line "CONFIG+=rs_gui_cmark" CONFIG *= no_rs_gui_cmark rs_gui_cmark:CONFIG -= no_rs_gui_cmark @@ -63,18 +63,19 @@ retroshare_android_notify_service:CONFIG -= no_retroshare_android_notify_service CONFIG *= no_retroshare_qml_app retroshare_qml_app:CONFIG -= no_retroshare_qml_app -# To enable RetroShare service append the following assignation to -# qmake command line "CONFIG+=retroshare_service" +# To disable RetroShare service append the following assignation to +# qmake command line "CONFIG+=no_retroshare_service" CONFIG *= retroshare_service -retroshare_service:CONFIG -= no_retroshare_service +no_retroshare_service:CONFIG -= retroshare_service # To enable libresapi (deprecated) append the following assignation to qmake command line +# "CONFIG+=libresapi" CONFIG+=no_libresapi libresapi:CONFIG -= no_libresapi # To enable libresapi via local socket (unix domain socket or windows named # pipes) append the following assignation to qmake command line -#"CONFIG+=libresapilocalserver" +# "CONFIG+=libresapilocalserver" CONFIG *= no_libresapilocalserver libresapilocalserver:CONFIG -= no_libresapilocalserver @@ -83,8 +84,8 @@ libresapilocalserver:CONFIG -= no_libresapilocalserver CONFIG *= no_libresapi_settings libresapi_settings:CONFIG -= no_libresapi_settings -# To disable libresapi via HTTP (based on libmicrohttpd) append the following -# assignation to qmake command line "CONFIG+=no_libresapihttpserver" +# To enable libresapi via HTTP (based on libmicrohttpd) append the following +# assignation to qmake command line "CONFIG+=libresapihttpserver" CONFIG *= no_libresapihttpserver libresapihttpserver:CONFIG -= no_libresapihttpserver @@ -164,7 +165,8 @@ rs_macos10.14:CONFIG -= rs_macos10.11 CONFIG *= no_rs_jsonapi rs_jsonapi:CONFIG -= no_rs_jsonapi -# To disable deep search append the following assignation to qmake command line +# To enable deep search append the following assignation to qmake command line +# CONFIG *= rs_deep_search CONFIG *= no_rs_deep_search rs_deep_search:CONFIG -= no_rs_deep_search From 1b071d106f18232c7227aed5e28bdba4c079f71a Mon Sep 17 00:00:00 2001 From: Gioacchino Mazzurco Date: Mon, 7 Oct 2019 18:37:44 +0200 Subject: [PATCH 6/6] Fix p3GxsChannels::createCommentV2 --- libretroshare/src/services/p3gxschannels.cc | 131 +++++++------------- 1 file changed, 42 insertions(+), 89 deletions(-) diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index 792606d78..d25d159df 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -1423,65 +1423,44 @@ bool p3GxsChannels::createCommentV2( RsGxsMessageId& commentMessageId, std::string& errorMessage ) { + constexpr auto fname = __PRETTY_FUNCTION__; + const auto failure = [&](const std::string& err) + { + errorMessage = err; + RsErr() << fname << " " << err << std::endl; + return false; + }; + + if(channelId.isNull()) return failure("channelId cannot be null"); + if(threadId.isNull()) return failure("threadId cannot be null"); + if(parentId.isNull()) return failure("parentId cannot be null"); + std::vector channelsInfo; if(!getChannelsInfo(std::list({channelId}),channelsInfo)) - { - errorMessage = "Channel with Id " + channelId.toStdString() - + " does not exist."; - return false; - } + return failure( "Channel with Id " + channelId.toStdString() + + " does not exist." ); std::vector posts; std::vector comments; if(!getChannelContent( // does the post thread exist? channelId,std::set({threadId}), posts, comments )) - { - errorMessage = "You cannot comment post " + threadId.toStdString() + - " of channel with Id " + channelId.toStdString() + - ": this post does not exists locally!"; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } + return failure( "You cannot comment post " + threadId.toStdString() + + " of channel with Id " + channelId.toStdString() + + ": this post does not exists locally!" ); // check that the post thread Id is actually that of a post thread if(posts.size() != 1 || !posts[0].mMeta.mParentId.isNull()) - { - errorMessage = "You cannot comment post " + threadId.toStdString() + - " of channel with Id " + channelId.toStdString() + - ": supplied threadId is not a thread, or parentMsgId is not a" + - " comment!"; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } + return failure( "You cannot comment post " + threadId.toStdString() + + " of channel with Id " + channelId.toStdString() + + ": supplied threadId is not a thread, or parentMsgId is" + " not a comment!"); - if(!parentId.isNull()) - { - if(!getChannelContent( // does the post thread exist? - channelId,std::set({parentId}),posts,comments )) - { - errorMessage = "You cannot comment post " + parentId.toStdString() + - ": supplied parent comment Id is not a comment!"; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } - else - { - if(comments.size() != 1 || comments[0].mMeta.mParentId.isNull()) - { // is the comment parent actually a comment? - errorMessage = "You cannot comment post " - + parentId.toStdString() - + " of channel with Id " + channelId.toStdString() + - ": supplied mParentMsgId is not a comment Id!"; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } - } - } + if(!getChannelContent( // does the post thread exist? + channelId, std::set({parentId}), + posts, comments )) + return failure( "You cannot comment post " + parentId.toStdString() + + ": supplied parent doesn't exists locally!" ); if(!origCommentId.isNull()) { @@ -1491,35 +1470,22 @@ bool p3GxsChannels::createCommentV2( if( !getChannelContent(channelId, s, posts, comments) || comments.size() != 1 ) - { - errorMessage = "You cannot edit comment " - + origCommentId.toStdString() - + " of channel with Id " + channelId.toStdString() - + ": this post does not exist locally!"; - RsErr() << __PRETTY_FUNCTION__ << " " << errorMessage << std::endl; - return false; - } + return failure( "You cannot edit comment " + + origCommentId.toStdString() + + " of channel with Id " + channelId.toStdString() + + ": this comment does not exist locally!"); const RsGxsId& commentAuthor = comments[0].mMeta.mAuthorId; if(commentAuthor != authorId) - { - errorMessage = "Editor identity and creator doesn't match " - + authorId.toStdString() + " != " - + commentAuthor.toStdString(); - RsErr() << __PRETTY_FUNCTION__ << " " << errorMessage << std::endl; - return false; - } + return failure( "Editor identity and creator doesn't match " + + authorId.toStdString() + " != " + + commentAuthor.toStdString() ); } if(!rsIdentity->isOwnId(authorId)) // is the author ID actually ours? - { - errorMessage = "You cannot comment to channel with Id " + - channelId.toStdString() + " with identity " + - authorId.toStdString() + " because it is not yours."; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } + return failure( "You cannot comment to channel with Id " + + channelId.toStdString() + " with identity " + + authorId.toStdString() + " because it is not yours." ); // Now create the comment RsGxsComment cmt; @@ -1532,28 +1498,15 @@ bool p3GxsChannels::createCommentV2( uint32_t token; if(!createNewComment(token, cmt)) - { - errorMessage = "Failed creating comment."; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } + return failure("createNewComment failed"); - if(waitToken(token) != RsTokenService::COMPLETE) - { - errorMessage = "GXS operation failed."; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } + RsTokenService::GxsRequestStatus wSt = waitToken(token); + if(wSt != RsTokenService::COMPLETE) + return failure( "GXS operation waitToken failed with: " + + std::to_string(wSt) ); if(!RsGenExchange::getPublishedMsgMeta(token, cmt.mMeta)) - { - errorMessage = "Failure getting created comment data."; - std::cerr << __PRETTY_FUNCTION__ << " Error: " << errorMessage - << std::endl; - return false; - } + return failure("Failure getting created comment data."); commentMessageId = cmt.mMeta.mMsgId; return true;