mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 17:04:58 -04:00
Added fast reply feature to ForumsMsgItem
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3987 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4fb593f1b9
commit
3f446d8f3c
3 changed files with 99 additions and 8 deletions
|
@ -20,6 +20,7 @@
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include "ForumMsgItem.h"
|
#include "ForumMsgItem.h"
|
||||||
#include "FeedHolder.h"
|
#include "FeedHolder.h"
|
||||||
|
@ -56,12 +57,17 @@ ForumMsgItem::ForumMsgItem(FeedHolder *parent, uint32_t feedId, const std::strin
|
||||||
/* specific ones */
|
/* specific ones */
|
||||||
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
|
connect( unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeForum ( void ) ) );
|
||||||
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
|
connect( replyButton, SIGNAL( clicked( void ) ), this, SLOT( replyToPost ( void ) ) );
|
||||||
|
connect( sendButton, SIGNAL( clicked( ) ), this, SLOT( sendMsg() ) );
|
||||||
|
|
||||||
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewAvatar(const QString&)), this, SLOT(updateAvatar(const QString&)));
|
||||||
|
|
||||||
small();
|
small();
|
||||||
updateItemStatic();
|
updateItemStatic();
|
||||||
updateItem();
|
updateItem();
|
||||||
|
textEdit->hide();
|
||||||
|
sendButton->hide();
|
||||||
|
signedcheckBox->hide();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -232,6 +238,9 @@ void ForumMsgItem::toggle()
|
||||||
if (prevFrame->isHidden())
|
if (prevFrame->isHidden())
|
||||||
{
|
{
|
||||||
prevFrame->show();
|
prevFrame->show();
|
||||||
|
textEdit->show();
|
||||||
|
sendButton->show();
|
||||||
|
signedcheckBox->show();
|
||||||
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
expandButton->setIcon(QIcon(QString(":/images/edit_remove24.png")));
|
||||||
expandButton->setToolTip("Hide");
|
expandButton->setToolTip("Hide");
|
||||||
if (!mIsTop)
|
if (!mIsTop)
|
||||||
|
@ -243,6 +252,9 @@ void ForumMsgItem::toggle()
|
||||||
{
|
{
|
||||||
prevFrame->hide();
|
prevFrame->hide();
|
||||||
nextFrame->hide();
|
nextFrame->hide();
|
||||||
|
textEdit->hide();
|
||||||
|
sendButton->hide();
|
||||||
|
signedcheckBox->hide();
|
||||||
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
expandButton->setIcon(QIcon(QString(":/images/edit_add24.png")));
|
||||||
expandButton->setToolTip("Expand");
|
expandButton->setToolTip("Expand");
|
||||||
}
|
}
|
||||||
|
@ -309,13 +321,49 @@ void ForumMsgItem::replyToPost()
|
||||||
#endif
|
#endif
|
||||||
if (mParent)
|
if (mParent)
|
||||||
{
|
{
|
||||||
//mParent->openMsg(FEEDHOLDER_MSG_FORUM, mForumId, mPostId);
|
|
||||||
CreateForumMsg *cfm = new CreateForumMsg(mForumId, mPostId);
|
CreateForumMsg *cfm = new CreateForumMsg(mForumId, mPostId);
|
||||||
cfm->show();
|
cfm->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ForumMsgItem::sendMsg()
|
||||||
|
{
|
||||||
|
QString name = prevSubLabel->text();
|
||||||
|
QString desc = textEdit->toHtml();
|
||||||
|
|
||||||
|
if(textEdit->toPlainText().isEmpty())
|
||||||
|
{ /* error message */
|
||||||
|
QMessageBox::warning(this, tr("RetroShare"),tr("Please give a Text Message"),
|
||||||
|
QMessageBox::Ok, QMessageBox::Ok);
|
||||||
|
|
||||||
|
return; //Don't add a empty Message!!
|
||||||
|
}
|
||||||
|
|
||||||
|
ForumMsgInfo msgInfo;
|
||||||
|
|
||||||
|
msgInfo.forumId = mForumId;
|
||||||
|
msgInfo.threadId = "";
|
||||||
|
msgInfo.parentId = mPostId;
|
||||||
|
msgInfo.msgId = "";
|
||||||
|
|
||||||
|
msgInfo.title = name.toStdWString();
|
||||||
|
msgInfo.msg = desc.toStdWString();
|
||||||
|
msgInfo.msgflags = 0;
|
||||||
|
|
||||||
|
if (signedcheckBox->isChecked())
|
||||||
|
{
|
||||||
|
msgInfo.msgflags = RS_DISTRIB_AUTHEN_REQ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((msgInfo.msg == L"") && (msgInfo.title == L""))
|
||||||
|
return; /* do nothing */
|
||||||
|
|
||||||
|
if (rsForums->ForumMessageSend(msgInfo) == true) {
|
||||||
|
textEdit->clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ForumMsgItem::updateAvatar(const QString &peer_id)
|
void ForumMsgItem::updateAvatar(const QString &peer_id)
|
||||||
{
|
{
|
||||||
if (mGpgIdPrev.empty() == false) {
|
if (mGpgIdPrev.empty() == false) {
|
||||||
|
|
|
@ -49,6 +49,8 @@ private slots:
|
||||||
void unsubscribeForum();
|
void unsubscribeForum();
|
||||||
void subscribeForum();
|
void subscribeForum();
|
||||||
void replyToPost();
|
void replyToPost();
|
||||||
|
void sendMsg();
|
||||||
|
|
||||||
|
|
||||||
void updateItem();
|
void updateItem();
|
||||||
void updateAvatar(const QString &peer_id);
|
void updateAvatar(const QString &peer_id);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>764</width>
|
<width>577</width>
|
||||||
<height>319</height>
|
<height>423</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<property name="margin">
|
<property name="margin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QFrame" name="frame_3">
|
<widget class="QFrame" name="frame_3">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
@ -37,7 +37,7 @@ border-radius: 10px}</string>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Raised</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_6">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
|
@ -487,14 +487,14 @@ border-radius: 10px}</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="nextnamelabel">
|
<widget class="QLabel" name="nextnamelabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Next Name</string>
|
<string>Next Name</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="2">
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_9">
|
<widget class="QLabel" name="label_9">
|
||||||
|
@ -543,7 +543,7 @@ border-radius: 10px}</string>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1" rowspan="2">
|
<item row="2" column="2" rowspan="2">
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="nextMsgLabel">
|
<widget class="QLabel" name="nextMsgLabel">
|
||||||
|
@ -569,6 +569,47 @@ border-radius: 10px}</string>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="4" column="0" colspan="2">
|
||||||
|
<widget class="QTextEdit" name="textEdit">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>16777215</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2">
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>2</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QPushButton" name="sendButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Send</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QCheckBox" name="signedcheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Signed</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue