From 393e799e5fd77a6133cb8a33bfd8a7efbf4e31e2 Mon Sep 17 00:00:00 2001 From: thunder2 Date: Thu, 4 Jul 2013 22:51:43 +0000 Subject: [PATCH] Show forum description as post text when no thread is selected. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6480 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/ForumsDialog.cpp | 19 ++++++++++- .../gui/gxsforums/GxsForumThreadWidget.cpp | 15 ++++++++- .../src/gui/gxsforums/GxsForumThreadWidget.h | 1 + retroshare-gui/src/lang/retroshare_en.ts | 33 +++++++++++++++++++ 4 files changed, 66 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index 8487304ef..3a15f60dc 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -1111,7 +1111,7 @@ QString ForumsDialog::messageFromInfo(ForumMsgInfo &msgInfo) void ForumsDialog::insertPost() { - if ((mCurrForumId == "") || (mCurrThreadId == "")) + if (mCurrForumId.empty()) { ui.postText->setText(""); ui.threadTitle->setText(""); @@ -1121,6 +1121,23 @@ void ForumsDialog::insertPost() return; } + if (mCurrThreadId.empty()) + { + ui.previousButton->setEnabled(false); + ui.nextButton->setEnabled(false); + ui.newmessageButton->setEnabled (false); + + ForumInfo fi; + if (!rsForums->getForumInfo(mCurrForumId, fi)) { + ui.postText->setText(""); + ui.threadTitle->setText(""); + return; + } + ui.threadTitle->setText(tr("Forum Description")); + ui.postText->setText(QString::fromStdWString(fi.forumDesc)); + return; + } + QTreeWidgetItem *curr = ui.threadTreeWidget->currentItem(); if (curr) { QTreeWidgetItem *Parent = curr->parent (); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 2e6b0c4db..c3a405897 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -903,6 +903,7 @@ void GxsForumThreadWidget::insertThreads() } mSubscribeFlags = 0; + mForumDescription.clear(); ui->newmessageButton->setEnabled(false); ui->newthreadButton->setEnabled(false); @@ -938,6 +939,7 @@ void GxsForumThreadWidget::insertForumThreads(const RsGroupMetaData &fi) { mSubscribeFlags = fi.mSubscribeFlags; ui->forumName->setText(QString::fromUtf8(fi.mGroupName.c_str())); +// mForumDescription = QString::fromUtf8(fi.mDescription); // not available ui->progressBarLayout->setEnabled(true); @@ -1156,7 +1158,7 @@ void GxsForumThreadWidget::fillChildren(QTreeWidgetItem *parentItem, QTreeWidget void GxsForumThreadWidget::insertPost() { - if (mForumId.empty() || mThreadId.empty()) + if (mForumId.empty()) { ui->postText->setText(""); ui->threadTitle->setText(""); @@ -1166,6 +1168,17 @@ void GxsForumThreadWidget::insertPost() return; } + if (mThreadId.empty()) + { + ui->previousButton->setEnabled(false); + ui->nextButton->setEnabled(false); + ui->newmessageButton->setEnabled (false); + + ui->threadTitle->setText(tr("Forum Description")); + ui->postText->setText(mForumDescription); + return; + } + QTreeWidgetItem *item = ui->threadTreeWidget->currentItem(); if (item) { QTreeWidgetItem *parentItem = item->parent(); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h index 4eebd53b5..204e05423 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.h @@ -137,6 +137,7 @@ private: std::string mForumId; std::string mLastForumID; std::string mThreadId; + QString mForumDescription; int mSubscribeFlags; bool mInProcessSettings; bool mInMsgAsReadUnread; diff --git a/retroshare-gui/src/lang/retroshare_en.ts b/retroshare-gui/src/lang/retroshare_en.ts index 2f66200d7..cacc42751 100644 --- a/retroshare-gui/src/lang/retroshare_en.ts +++ b/retroshare-gui/src/lang/retroshare_en.ts @@ -4969,6 +4969,10 @@ p, li { white-space: pre-wrap; } You can't reply an Anonymous Author + + Forum Description + + ForumsFillThread @@ -5207,6 +5211,18 @@ p, li { white-space: pre-wrap; } Sort by + + IP + + + + Sort by IP + + + + Show IP Column + + FriendRecommendDialog @@ -6767,6 +6783,10 @@ before you can comment You cant reply to an Anonymous Author + + Forum Description + + GxsForumsDialog @@ -12761,6 +12781,19 @@ Try to be patient! Please enter a new--and valid--filename + + Last Time Seen + i.e: Last Time Receiced Data + + + + UserID + + + + File Never Seen + + TreeStyle_RDM