diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index c632b380f..3cef99a85 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -795,6 +795,11 @@ void GxsForumThreadWidget::headerContextMenuRequested(const QPoint &pos) // author->setChecked(!ui->threadTreeWidget->isColumnHidden(RsGxsForumModel::COLUMN_THREAD_AUTHOR)); // author->setData(RsGxsForumModel::COLUMN_THREAD_AUTHOR); // connect(author, SIGNAL(toggled(bool)), this, SLOT(changeHeaderColumnVisibility(bool))); + + QAction* show_text_from_banned = header_context_menu->addAction(QIcon(), tr("Show text from banned persons")); + show_text_from_banned->setCheckable(true); + show_text_from_banned->setChecked(mDisplayBannedText); + connect(show_text_from_banned, SIGNAL(toggled(bool)), this, SLOT(showBannedText(bool))); header_context_menu->exec(mapToGlobal(pos)); delete(header_context_menu); @@ -808,6 +813,13 @@ void GxsForumThreadWidget::changeHeaderColumnVisibility(bool visibility) { ui->threadTreeWidget->setColumnHidden(the_action->data().toInt(), !visibility); } +void GxsForumThreadWidget::showBannedText(bool display) { + mDisplayBannedText = display; + if (!mThreadId.isNull()) { + updateMessageData(mThreadId); + } +} + #ifdef TODO bool GxsForumThreadWidget::eventFilter(QObject *obj, QEvent *event) { @@ -1239,13 +1251,28 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg) ui->by_label->show(); ui->threadTreeWidget->setFocus(); + QString banned_text_info = ""; if(redacted) { - QString extraTxt = tr( "

The author of this message (with ID %1) is banned.").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString())) ; - extraTxt += tr( "

") ; - extraTxt += tr( "

You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.

") ; + ui->downloadButton->setDisabled(true); + if (!mDisplayBannedText) { + QString extraTxt = tr( "

The author of this message (with ID %1) is banned.").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString())) ; + extraTxt += tr( "

") ; + extraTxt += tr( "

You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.

") ; + + ui->postText->setHtml(extraTxt) ; + return; + } + else { + RsIdentityDetails details; + rsIdentity->getIdDetails(msg.mMeta.mAuthorId, details); + QString name = GxsIdDetails::getName(details); + + banned_text_info += "

" + tr( "The author of this message (with ID %1) is banned. And named by name ( %2 )").arg(QString::fromStdString(msg.mMeta.mAuthorId.toStdString()), name) + ""; + banned_text_info += "

"; + banned_text_info += "

" + tr( "You can force the visibility and forwarding of messages by setting a different opinion for that Id in People's tab.") + "


"; + } - ui->postText->setHtml(extraTxt) ; } else { uint32_t flags = RSHTML_FORMATTEXT_EMBED_LINKS; if(Settings->getForumLoadEmoticons()) @@ -1258,7 +1285,7 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg) int desiredMinimumFontSize = Settings->valueFromGroup("Forum", "MinimumFontSize", 10).toInt(); - QString extraTxt = RsHtml().formatText(ui->postText->document(), + QString extraTxt = banned_text_info + RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()), flags , backgroundColor, desiredContrast, desiredMinimumFontSize ); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h index 919c755a9..cc3342344 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h @@ -153,6 +153,7 @@ private slots: void expandSubtree(); #endif void changeHeaderColumnVisibility(bool visibility); + void showBannedText(bool display); private: void insertMessageData(const RsGxsForumMsg &msg); bool getCurrentPost(ForumModelPostEntry& fmpe) const ; @@ -201,6 +202,7 @@ private: GxsForumsFillThread *mFillThread; unsigned int mUnreadCount; unsigned int mNewCount; + bool mDisplayBannedText; /* Color definitions (for standard see qss.default) */ QColor mTextColorRead;