From 43ef74b4cabb4bb08eabec942bc50d9aa4a4bc44 Mon Sep 17 00:00:00 2001 From: chelovechishko Date: Wed, 1 Jul 2020 16:54:09 +0900 Subject: [PATCH] gxsforums: disable visibility for childless actions at context menu --- .../gui/gxsforums/GxsForumThreadWidget.cpp | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 8ea70849b..51c14c276 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -622,11 +622,19 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/) QAction *showinpeopleAct = new QAction(FilesDefs::getIconFromQtResourcePath(":/images/info16.png"), tr("Show author in people tab"), &contextMnu); connect(showinpeopleAct, SIGNAL(triggered()), this, SLOT(showInPeopleTab())); + bool has_children = false; + if (has_current_post) { + has_children = !current_post.mChildren.empty(); + } + if (IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags)) { markMsgAsReadChildren->setEnabled(current_post.mPostFlags & ForumModelPostEntry::FLAG_POST_HAS_UNREAD_CHILDREN); markMsgAsUnreadChildren->setEnabled(current_post.mPostFlags & ForumModelPostEntry::FLAG_POST_HAS_READ_CHILDREN); +#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) + expandSubtree->setEnabled(has_children); +#endif replyAct->setEnabled (true); replyauthorAct->setEnabled (true); } @@ -644,6 +652,19 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/) #endif } + // disable visibility for childless + if (has_current_post) { + replyAct->setVisible(has_children); + // still no setEnabled + markMsgAsRead->setVisible(IS_MSG_UNREAD(current_post.mMsgStatus)); + markMsgAsUnread->setVisible(!IS_MSG_UNREAD(current_post.mMsgStatus)); +#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0) + expandSubtree->setVisible(has_children); +#endif + markMsgAsReadChildren->setVisible(has_children); + markMsgAsUnreadChildren->setVisible(has_children); + } + if(has_current_post) { bool is_pinned = mForumGroup.mPinnedPosts.ids.find( current_post.mMsgId ) != mForumGroup.mPinnedPosts.ids.end();