Added Reply to Author feature for each Forum Message

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1987 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-01-09 16:33:00 +00:00
parent d549d8d144
commit 7017a35581
2 changed files with 46 additions and 8 deletions

View File

@ -23,6 +23,7 @@
#include "gui/forums/CreateForum.h" #include "gui/forums/CreateForum.h"
#include "gui/forums/CreateForumMsg.h" #include "gui/forums/CreateForumMsg.h"
#include "gui/forums/ForumDetails.h" #include "gui/forums/ForumDetails.h"
#include "msgs/ChanMsgDialog.h"
#include "rsiface/rsiface.h" #include "rsiface/rsiface.h"
#include "rsiface/rspeers.h" #include "rsiface/rspeers.h"
@ -169,10 +170,14 @@ void ForumsDialog::threadListCustomPopupMenu( QPoint point )
QAction *viewAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Start New Thread" ), this ); QAction *viewAct = new QAction(QIcon(IMAGE_DOWNLOADALL), tr( "Start New Thread" ), this );
connect( viewAct , SIGNAL( triggered() ), this, SLOT( showthread() ) ); connect( viewAct , SIGNAL( triggered() ), this, SLOT( showthread() ) );
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr( "Reply to Author" ), this );
connect( replyauthorAct , SIGNAL( triggered() ), this, SLOT( replytomessage() ) );
contextMnu.clear(); contextMnu.clear();
contextMnu.addAction( replyAct); contextMnu.addAction( replyAct);
contextMnu.addAction( viewAct); contextMnu.addAction( viewAct);
contextMnu.addAction( replyauthorAct);
contextMnu.exec( mevent->globalPos() ); contextMnu.exec( mevent->globalPos() );
} }
@ -193,13 +198,6 @@ void ForumsDialog::newmessage()
/* window will destroy itself! */ /* window will destroy itself! */
} }
void ForumsDialog::replytomessage()
{
/* put msg on msgBoard, and switch to it. */
}
void ForumsDialog::togglefileview() void ForumsDialog::togglefileview()
{ {
/* if msg header visible -> hide by changing splitter /* if msg header visible -> hide by changing splitter
@ -914,7 +912,6 @@ void ForumsDialog::createmessage()
cfm->show(); cfm->show();
} }
void ForumsDialog::showthread() void ForumsDialog::showthread()
{ {
if (mCurrForumId == "") if (mCurrForumId == "")
@ -1030,4 +1027,41 @@ void ForumsDialog::loadForumEmoticons()
} }
} }
void ForumsDialog::replytomessage()
{
if (mCurrForumId == "")
{
return;
}
fId = mCurrForumId;
pId = mCurrPostId;
ForumMsgInfo msgInfo ;
rsForums->getForumMessage(fId,pId,msgInfo) ;
if (rsPeers->getPeerName(msgInfo.srcId) !="")
{
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
nMsgDialog->newMsg();
nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ;
nMsgDialog->setWindowTitle(tr("Re: ") + QString::fromStdWString(msgInfo.title) ) ;
QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
std::string cited_text(doc.toPlainText().toStdString()) ;
nMsgDialog->insertPastedText(cited_text) ;
nMsgDialog->addRecipient( msgInfo.srcId ) ;
nMsgDialog->show();
nMsgDialog->activateWindow();
}
else
{
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply a Anonymous Author"));
}
}

View File

@ -36,6 +36,7 @@ public:
void insertPost(); void insertPost();
void loadForumEmoticons(); void loadForumEmoticons();
private slots: private slots:
@ -88,6 +89,9 @@ private:
QFont itemFont; QFont itemFont;
QHash<QString, QString> smileys; QHash<QString, QString> smileys;
std::string fId;
std::string pId;
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::ForumsDialog ui; Ui::ForumsDialog ui;