mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-01-23 22:01:05 -05:00
Fix Forum Post ToolButton enabled case.
Clear the tree widget too, when forum group selected else changing post do nothing.
This commit is contained in:
parent
40d9398b38
commit
eab5821ac3
@ -328,15 +328,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
|
||||
|
||||
//ui->threadTreeWidget->installEventFilter(this) ;
|
||||
|
||||
ui->postText->clear() ;
|
||||
ui->by_label->setId(RsGxsId()) ;
|
||||
ui->time_label->clear();
|
||||
ui->lineRight->hide();
|
||||
ui->lineLeft->hide();
|
||||
ui->by_text_label->hide();
|
||||
ui->by_label->hide();
|
||||
ui->postText->setImageBlockWidget(ui->imageBlockWidget) ;
|
||||
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
|
||||
blankPost();
|
||||
|
||||
ui->subscribeToolButton->setToolTip(tr( "<p>Subscribing to the forum will gather \
|
||||
available posts from your subscribed friends, and make the \
|
||||
@ -376,29 +368,17 @@ void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent
|
||||
|
||||
void GxsForumThreadWidget::blank()
|
||||
{
|
||||
ui->progressBar->hide();
|
||||
ui->progressText->hide();
|
||||
ui->postText->clear() ;
|
||||
ui->by_label->setId(RsGxsId()) ;
|
||||
ui->time_label->clear();
|
||||
ui->lineRight->hide();
|
||||
ui->lineLeft->hide();
|
||||
ui->by_text_label->hide();
|
||||
ui->by_label->hide();
|
||||
ui->postText->setImageBlockWidget(ui->imageBlockWidget) ;
|
||||
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
|
||||
#ifdef SUSPENDED_CODE
|
||||
ui->threadTreeWidget->clear();
|
||||
#endif
|
||||
ui->subscribeToolButton->hide();
|
||||
ui->newthreadButton->hide();
|
||||
ui->forumName->setText("");
|
||||
ui->progressText->hide();
|
||||
ui->progressBar->hide();
|
||||
ui->viewBox->setEnabled(false);
|
||||
ui->filterLineEdit->setEnabled(false);
|
||||
|
||||
//mThreadModel->clear();
|
||||
mThreadModel->clear();
|
||||
|
||||
mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->previousButton, false);
|
||||
mStateHelper->setWidgetEnabled(ui->nextButton, false);
|
||||
|
||||
ui->versions_CB->hide();
|
||||
blankPost();
|
||||
}
|
||||
|
||||
GxsForumThreadWidget::~GxsForumThreadWidget()
|
||||
@ -883,16 +863,38 @@ void GxsForumThreadWidget::clearForumDescription()
|
||||
ui->postText->clear();
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::blankPost()
|
||||
{
|
||||
ui->newmessageButton->setEnabled(false);
|
||||
ui->previousButton->setEnabled(false);
|
||||
ui->nextButton->setEnabled(false);
|
||||
ui->nextUnreadButton->setEnabled(false);
|
||||
ui->downloadButton->setEnabled(false);
|
||||
ui->lineLeft->hide();
|
||||
ui->time_label->clear();
|
||||
ui->versions_CB->hide();
|
||||
ui->lineRight->hide();
|
||||
ui->by_text_label->hide();
|
||||
ui->by_label->setId(RsGxsId()) ;
|
||||
ui->by_label->hide();
|
||||
ui->expandButton->hide();
|
||||
|
||||
ui->postText->clear() ;
|
||||
ui->postText->setImageBlockWidget(ui->imageBlockWidget) ;
|
||||
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
|
||||
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::updateForumDescription(bool success)
|
||||
{
|
||||
if(!success)
|
||||
{
|
||||
if(!success)
|
||||
{
|
||||
blank();
|
||||
QString forum_description = QString("<b>ERROR:</b> Forum could not be loaded. Database might be in heavy use. Please try later.");
|
||||
ui->postText->setText(forum_description);
|
||||
mStateHelper->setWidgetEnabled(ui->newthreadButton, false);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "Updating forum description" << std::endl;
|
||||
if (!mThreadId.isNull())
|
||||
@ -906,7 +908,10 @@ void GxsForumThreadWidget::updateForumDescription(bool success)
|
||||
|
||||
const RsGxsForumGroup& group = mForumGroup;
|
||||
|
||||
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
||||
ui->newthreadButton->show();
|
||||
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
||||
ui->viewBox->setEnabled(true);
|
||||
ui->filterLineEdit->setEnabled(true);
|
||||
|
||||
QString anti_spam_features1 ;
|
||||
QString forum_description;
|
||||
@ -1019,6 +1024,9 @@ void GxsForumThreadWidget::insertMessage()
|
||||
return;
|
||||
}
|
||||
|
||||
/* blank text, incase we get nothing */
|
||||
blankPost();
|
||||
|
||||
// We use this instead of getCurrentIndex() because right here the currentIndex() is not set yet.
|
||||
|
||||
QModelIndex index = mThreadProxyModel->mapFromSource(mThreadModel->getIndexOfMessage(mOrigThreadId));
|
||||
@ -1043,18 +1051,7 @@ void GxsForumThreadWidget::insertMessage()
|
||||
return;
|
||||
}
|
||||
|
||||
mStateHelper->setWidgetEnabled(ui->newmessageButton, (IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags) && mThreadId.isNull() == false));
|
||||
|
||||
/* blank text, incase we get nothing */
|
||||
ui->postText->clear();
|
||||
ui->by_label->setId(RsGxsId()) ;
|
||||
ui->time_label->clear();
|
||||
ui->lineRight->hide();
|
||||
ui->lineLeft->hide();
|
||||
ui->by_text_label->hide();
|
||||
ui->by_label->hide();
|
||||
ui->postText->setImageBlockWidget(ui->imageBlockWidget) ;
|
||||
ui->postText->resetImagesStatus(Settings->getForumLoadEmbeddedImages());
|
||||
ui->newmessageButton->setEnabled(IS_GROUP_SUBSCRIBED(mForumGroup.mMeta.mSubscribeFlags) && mThreadId.isNull() == false);
|
||||
|
||||
// add/show combobox for versions, if applicable, and enable it. If no older versions of the post available, hide the combobox.
|
||||
|
||||
@ -1145,11 +1142,12 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||
bool redacted =
|
||||
(overall_reputation == RsReputationLevel::LOCALLY_NEGATIVE);
|
||||
|
||||
ui->time_label->setText(DateTime::formatLongDateTime(msg.mMeta.mPublishTs));
|
||||
ui->by_label->setId(msg.mMeta.mAuthorId);
|
||||
ui->lineRight->show();
|
||||
ui->nextUnreadButton->setEnabled(true);
|
||||
ui->lineLeft->show();
|
||||
ui->time_label->setText(DateTime::formatLongDateTime(msg.mMeta.mPublishTs));
|
||||
ui->lineRight->show();
|
||||
ui->by_text_label->show();
|
||||
ui->by_label->setId(msg.mMeta.mAuthorId);
|
||||
ui->by_label->show();
|
||||
ui->threadTreeWidget->setFocus();
|
||||
|
||||
@ -1171,6 +1169,10 @@ void GxsForumThreadWidget::insertMessageData(const RsGxsForumMsg &msg)
|
||||
QString extraTxt = RsHtml().formatText(ui->postText->document(), QString::fromUtf8(msg.mMsg.c_str()),flags);
|
||||
ui->postText->setHtml(extraTxt);
|
||||
}
|
||||
|
||||
QStringList urls;
|
||||
RsHtml::findAnchors(ui->postText->toHtml(), urls);
|
||||
ui->downloadButton->setEnabled(urls.count() > 0);
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::previousMessage()
|
||||
@ -1675,6 +1677,9 @@ void GxsForumThreadWidget::filterItems(const QString& text)
|
||||
|
||||
void GxsForumThreadWidget::postForumLoading()
|
||||
{
|
||||
if(groupId().isNull())
|
||||
return;
|
||||
|
||||
#ifdef DEBUG_FORUMS
|
||||
std::cerr << "Post forum loading..." << std::endl;
|
||||
#endif
|
||||
@ -1719,12 +1724,15 @@ void GxsForumThreadWidget::postForumLoading()
|
||||
// we also need to restore expanded threads
|
||||
}
|
||||
|
||||
ui->newthreadButton->show();
|
||||
ui->forumName->setText(QString::fromUtf8(mForumGroup.mMeta.mGroupName.c_str()));
|
||||
ui->threadTreeWidget->sortByColumn(RsGxsForumModel::COLUMN_THREAD_DATE, Qt::DescendingOrder);
|
||||
ui->threadTreeWidget->update();
|
||||
ui->threadTreeWidget->update();
|
||||
ui->viewBox->setEnabled(true);
|
||||
ui->filterLineEdit->setEnabled(true);
|
||||
|
||||
recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages);
|
||||
//mUpdating = false;
|
||||
recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages);
|
||||
//mUpdating = false;
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::updateGroupData()
|
||||
|
@ -101,9 +101,9 @@ private slots:
|
||||
void changedSelection(const QModelIndex &, const QModelIndex &);
|
||||
void changedThread(QModelIndex index);
|
||||
void changedVersion();
|
||||
void clickedThread (QModelIndex index);
|
||||
void postForumLoading();
|
||||
|
||||
void clickedThread (QModelIndex index);
|
||||
void postForumLoading();
|
||||
|
||||
void reply_with_private_message();
|
||||
void replytoforummessage();
|
||||
void editforummessage();
|
||||
@ -157,9 +157,9 @@ private:
|
||||
void saveExpandedItems(QList<RsGxsMessageId>& expanded_items) const;
|
||||
|
||||
int getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTreeWidgetItem*> *pRowsRead, QList<QTreeWidgetItem*> *pRowsUnread);
|
||||
void setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool read);
|
||||
void markMsgAsReadUnread(bool read, bool children, bool forum, RsGxsMessageId msgId = RsGxsMessageId());
|
||||
void calculateUnreadCount();
|
||||
void setMsgReadStatus(QList<QTreeWidgetItem*> &rows, bool read);
|
||||
void markMsgAsReadUnread(bool read, bool children, bool forum, RsGxsMessageId msgId = RsGxsMessageId());
|
||||
void calculateUnreadCount();
|
||||
|
||||
void togglethreadview_internal();
|
||||
|
||||
@ -178,6 +178,7 @@ private:
|
||||
private:
|
||||
void setForumDescriptionLoading();
|
||||
void clearForumDescription();
|
||||
void blankPost();
|
||||
|
||||
RsGxsGroupId mLastForumID;
|
||||
RsGxsMessageId mThreadId;
|
||||
|
@ -245,32 +245,6 @@
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="postLayout">
|
||||
<item row="0" column="6">
|
||||
<widget class="QToolButton" name="downloadButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Download all files</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="newmessageButton">
|
||||
<property name="maximumSize">
|
||||
@ -300,53 +274,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="16">
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="Line" name="lineRight">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="13">
|
||||
<spacer name="postHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<item row="0" column="2">
|
||||
<widget class="QToolButton" name="previousButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
@ -384,7 +312,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<item row="0" column="3">
|
||||
<widget class="QToolButton" name="nextButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
@ -425,38 +353,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="12">
|
||||
<widget class="GxsIdLabel" name="by_label">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="Line" name="lineLeft">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="QComboBox" name="versions_CB"/>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QLabel" name="time_label">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<widget class="QLabel" name="by_text_label">
|
||||
<property name="text">
|
||||
<string>By </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<item row="0" column="4">
|
||||
<widget class="QToolButton" name="nextUnreadButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
@ -479,6 +376,109 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QToolButton" name="downloadButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Download all files</string>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
<normaloff>:/icons/png/download.png</normaloff>:/icons/png/download.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="6">
|
||||
<widget class="Line" name="lineLeft">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="7">
|
||||
<widget class="QLabel" name="time_label">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="8">
|
||||
<widget class="QComboBox" name="versions_CB"/>
|
||||
</item>
|
||||
<item row="0" column="9">
|
||||
<widget class="Line" name="lineRight">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="10">
|
||||
<widget class="QLabel" name="by_text_label">
|
||||
<property name="text">
|
||||
<string>By </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="11">
|
||||
<widget class="GxsIdLabel" name="by_label">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="12">
|
||||
<spacer name="postHSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="13">
|
||||
<widget class="QPushButton" name="expandButton">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../images.qrc">
|
||||
<normaloff>:/images/edit_remove24.png</normaloff>:/images/edit_remove24.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
Loading…
Reference in New Issue
Block a user