Added subscribe button to forums.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7442 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2014-07-07 11:18:20 +00:00
parent 13256578ed
commit 1164344976
4 changed files with 58 additions and 21 deletions

View File

@ -100,6 +100,22 @@
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="SubscribeToolButton" name="subscribeToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Subscribe</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="postButton">
<property name="focusPolicy">
@ -123,22 +139,6 @@
</property>
</widget>
</item>
<item>
<widget class="SubscribeToolButton" name="subscribeToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Subscribe</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">

View File

@ -99,6 +99,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->progressBar, UISTATE_LOADING_VISIBLE);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->progressText, UISTATE_LOADING_VISIBLE);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->subscribeToolButton);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->newthreadButton);
mStateHelper->addWidget(TOKEN_TYPE_CURRENTFORUM, ui->threadTreeWidget, UISTATE_ACTIVE_ENABLED);
@ -131,6 +132,7 @@ GxsForumThreadWidget::GxsForumThreadWidget(const RsGxsGroupId &forumId, QWidget
connect(ui->threadTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(threadListCustomPopupMenu(QPoint)));
connect(ui->subscribeToolButton, SIGNAL(subscribe(bool)), this, SLOT(subscribeGroup(bool)));
connect(ui->newmessageButton, SIGNAL(clicked()), this, SLOT(createmessage()));
connect(ui->newthreadButton, SIGNAL(clicked()), this, SLOT(createthread()));
@ -919,6 +921,8 @@ void GxsForumThreadWidget::insertForumThreads(const RsGxsForumGroup &group)
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
mForumDescription = QString::fromUtf8(group.mDescription.c_str());
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags));
ui->progressBar->reset();
mStateHelper->setActive(TOKEN_TYPE_CURRENTFORUM, true);
@ -1523,6 +1527,17 @@ void GxsForumThreadWidget::copyMessageLink()
QMessageBox::warning(this, "RetroShare", "ToDo");
}
void GxsForumThreadWidget::subscribeGroup(bool subscribe)
{
if (mForumId.isNull()) {
return;
}
uint32_t token;
rsGxsForums->subscribeToGroup(token, mForumId, subscribe);
// mThreadQueue->queueRequest(token, 0, RS_TOKREQ_ANSTYPE_ACK, TOKEN_TYPE_SUBSCRIBE_CHANGE);
}
void GxsForumThreadWidget::createmessage()
{
if (mForumId.isNull () || !IS_GROUP_SUBSCRIBED(mSubscribeFlags)) {

View File

@ -85,6 +85,7 @@ private slots:
/* handle splitter */
void togglethreadview();
void subscribeGroup(bool subscribe);
void createthread();
void createmessage();

View File

@ -42,6 +42,22 @@
<property name="margin">
<number>2</number>
</property>
<item>
<widget class="SubscribeToolButton" name="subscribeToolButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">Subscribe</string>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="newthreadButton">
<property name="focusPolicy">
@ -520,16 +536,21 @@
</layout>
</widget>
<customwidgets>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>LineEditClear</class>
<extends>QLineEdit</extends>
<header location="global">gui/common/LineEditClear.h</header>
</customwidget>
<customwidget>
<class>SubscribeToolButton</class>
<extends>QToolButton</extends>
<header>gui/common/SubscribeToolButton.h</header>
</customwidget>
<customwidget>
<class>RSTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/common/RSTextBrowser.h</header>
</customwidget>
<customwidget>
<class>GxsIdRSTreeWidget</class>
<extends>QTreeWidget</extends>