mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-24 00:31:32 -04:00
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:
parent
e07783ac2b
commit
1c73d22eef
5 changed files with 59 additions and 4 deletions
|
@ -57,6 +57,7 @@ ChatDialog::ChatDialog(QWidget *parent)
|
|||
setWindowIcon(QIcon(QString(":/images/rstray3.png")));
|
||||
|
||||
//connect(ui.lineEdit, SIGNAL(returnPressed( ) ), this, SLOT(sendMsg( ) ));
|
||||
connect(ui.lineEdit, SIGNAL(textChanged ( ) ), this, SLOT(checkChat( ) ));
|
||||
connect(ui.Sendbtn, SIGNAL(clicked()), this, SLOT(sendMsg()));
|
||||
|
||||
connect( ui.msgSendList, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( msgSendListCostumPopupMenu( QPoint ) ) );
|
||||
|
@ -162,8 +163,27 @@ void ChatDialog::insertChat()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ChatDialog::checkChat()
|
||||
{
|
||||
/* if <return> at the end of the text -> we can send it! */
|
||||
QTextEdit *chatWidget = ui.lineEdit;
|
||||
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 ... */
|
||||
sendMsg();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//std::cerr << "No <return> found in :" << txt << ":";
|
||||
//std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void ChatDialog::sendMsg()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue