Added check to catch <return> to ChatDialog and PopupChatDialog.

Removed Save Check on ChanMsgDialog.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@451 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2008-03-31 21:02:12 +00:00
parent e07783ac2b
commit 1c73d22eef
5 changed files with 59 additions and 4 deletions

View file

@ -61,6 +61,7 @@ PopupChatDialog::PopupChatDialog(std::string id, std::string name,
connect(ui.avatarFrameButton, SIGNAL(toggled(bool)), this, SLOT(showAvatarFrame(bool)));
//connect(ui.chattextEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendChat( ) ));
connect(ui.chattextEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) ));
connect(ui.sendButton, SIGNAL(clicked( ) ), this, SLOT(sendChat( ) ));
@ -206,6 +207,28 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
qsb -> setValue(qsb->maximum());
}
void PopupChatDialog::checkChat()
{
/* if <return> at the end of the text -> we can send it! */
QTextEdit *chatWidget = ui.chattextEdit;
std::string txt = chatWidget->toPlainText().toStdString();
if ('\n' == txt[txt.length()-1])
{
//std::cerr << "Found <return> found at end of :" << txt << ": should send!";
//std::cerr << std::endl;
if (txt.length()-1 == txt.find('\n')) /* only if on first line! */
{
/* should remove last char ... */
sendChat();
}
}
else
{
//std::cerr << "No <return> found in :" << txt << ":";
//std::cerr << std::endl;
}
}
void PopupChatDialog::sendChat()
{