From 7017a35581787a7b83898d80d38039bb637e1a11 Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 9 Jan 2010 16:33:00 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/ForumsDialog.cpp | 50 +++++++++++++++++++++---- retroshare-gui/src/gui/ForumsDialog.h | 4 ++ 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/retroshare-gui/src/gui/ForumsDialog.cpp b/retroshare-gui/src/gui/ForumsDialog.cpp index 9002b2a20..a8d282e1b 100644 --- a/retroshare-gui/src/gui/ForumsDialog.cpp +++ b/retroshare-gui/src/gui/ForumsDialog.cpp @@ -23,6 +23,7 @@ #include "gui/forums/CreateForum.h" #include "gui/forums/CreateForumMsg.h" #include "gui/forums/ForumDetails.h" +#include "msgs/ChanMsgDialog.h" #include "rsiface/rsiface.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 ); 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.addAction( replyAct); contextMnu.addAction( viewAct); + contextMnu.addAction( replyauthorAct); contextMnu.exec( mevent->globalPos() ); } @@ -193,13 +198,6 @@ void ForumsDialog::newmessage() /* window will destroy itself! */ } -void ForumsDialog::replytomessage() -{ - /* put msg on msgBoard, and switch to it. */ - - -} - void ForumsDialog::togglefileview() { /* if msg header visible -> hide by changing splitter @@ -914,7 +912,6 @@ void ForumsDialog::createmessage() cfm->show(); } - void ForumsDialog::showthread() { 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")); + } +} diff --git a/retroshare-gui/src/gui/ForumsDialog.h b/retroshare-gui/src/gui/ForumsDialog.h index 5c5b3c5a6..963a04c99 100644 --- a/retroshare-gui/src/gui/ForumsDialog.h +++ b/retroshare-gui/src/gui/ForumsDialog.h @@ -36,6 +36,7 @@ public: void insertPost(); void loadForumEmoticons(); + private slots: @@ -88,6 +89,9 @@ private: QFont itemFont; QHash smileys; + + std::string fId; + std::string pId; /** Qt Designer generated object */ Ui::ForumsDialog ui;