mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -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
@ -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()
|
||||
{
|
||||
|
@ -58,6 +58,7 @@ void toggleSendItem( QTreeWidgetItem *item, int col );
|
||||
|
||||
void setColor();
|
||||
void insertSendList();
|
||||
void checkChat();
|
||||
void sendMsg();
|
||||
|
||||
void privchat();
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -74,6 +74,7 @@ private slots:
|
||||
void getFont();
|
||||
void setFont();
|
||||
|
||||
void checkChat();
|
||||
void sendChat();
|
||||
|
||||
|
||||
|
@ -232,6 +232,14 @@ void ChanMsgDialog::channelstreeViewCostumPopupMenu( QPoint point )
|
||||
|
||||
void ChanMsgDialog::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
event->accept();
|
||||
return;
|
||||
|
||||
/* We can save to Drafts.... but we'll do this later.
|
||||
* ... no auto saving for the moment,
|
||||
*/
|
||||
|
||||
#if 0
|
||||
if (maybeSave())
|
||||
{
|
||||
event->accept();
|
||||
@ -244,6 +252,8 @@ void ChanMsgDialog::closeEvent (QCloseEvent * event)
|
||||
RshareSettings config;
|
||||
config.saveWidgetInformation(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void ChanMsgDialog::deletechannel()
|
||||
|
Loading…
Reference in New Issue
Block a user