Enabled (and implemented) response to message

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@717 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2008-09-03 12:56:37 +00:00
parent fffe6d6d97
commit 4e53b5fa95
3 changed files with 43 additions and 1 deletions

View File

@ -65,6 +65,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(newmessage()));
connect(ui.removemessageButton, SIGNAL(clicked()), this, SLOT(removemessage()));
connect(ui.replymessageButton, SIGNAL(clicked()), this, SLOT(replytomessage()));
//connect(ui.printbutton, SIGNAL(clicked()), this, SLOT(print()));
connect(ui.actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(ui.actionPrintPreview, SIGNAL(triggered()), this, SLOT(printpreview()));
@ -107,7 +108,7 @@ MessagesDialog::MessagesDialog(QWidget *parent)
ui.printbutton->setIcon(QIcon(QString(":/images/print24.png")));
/*Disabled Reply Button */
ui.replymessageButton->setEnabled(false);
//ui.replymessageButton->setEnabled(false);
QMenu * printmenu = new QMenu();
printmenu->addAction(ui.actionPrint);
@ -183,7 +184,37 @@ void MessagesDialog::replytomessage()
{
/* put msg on msgBoard, and switch to it. */
std::string cid;
std::string mid;
if(!getCurrentMsg(cid, mid))
return ;
mCurrCertId = cid;
mCurrMsgId = mid;
MessageInfo msgInfo;
if (!rsMsgs -> getMessage(mid, msgInfo))
return ;
ChanMsgDialog *nMsgDialog = new ChanMsgDialog(true);
/* fill it in */
//std::cerr << "MessagesDialog::newmessage()" << std::endl;
nMsgDialog->newMsg();
nMsgDialog->insertTitleText( (QString("Re: ") + QString::fromStdWString(msgInfo.title)).toStdString()) ;
QTextDocument doc ;
doc.setHtml(QString::fromStdWString(msgInfo.msg)) ;
std::string cited_text(doc.toPlainText().toStdString()) ;
std::string::size_type i=0 ;
while( (i=cited_text.find_first_of('\n',i+1)) < cited_text.size())
cited_text.replace(i,1,std::string("\n> ")) ;
nMsgDialog->insertMsgText( std::string("> ") + cited_text ) ;
nMsgDialog->addRecipient( msgInfo.srcId ) ;
nMsgDialog->show();
nMsgDialog->activateWindow();
}
void MessagesDialog::togglefileview()

View File

@ -573,6 +573,16 @@ void ChanMsgDialog::cancelMessage()
* Chan or Msg Dialog.
*/
void ChanMsgDialog::addRecipient(std::string id)
{
QTreeWidget *sendWidget = ui.msgSendList;
for(int i=0;i<sendWidget->topLevelItemCount();++i)
if(sendWidget->topLevelItem(i)->text(1).toStdString() == id)
sendWidget->topLevelItem(i)->setCheckState(0,Qt::Checked) ;
else
sendWidget->topLevelItem(i)->setCheckState(0,Qt::Unchecked) ;
}
/* First the Msg (People) ones */
void ChanMsgDialog::togglePersonItem( QTreeWidgetItem *item, int col )

View File

@ -54,6 +54,7 @@ void insertChannelSendList(); /* for Channels */
void insertFileList(); /* for Both */
void insertTitleText(std::string title);
void insertMsgText(std::string msg);
void addRecipient(std::string id) ;
void Create_New_Image_Tag( const QString urlremoteorlocal );
QSettings setter;