Added modified patch from AC

- don't remove color and font when the last char is deleted from the chat text entry box

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5095 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2012-04-12 23:00:39 +00:00
parent 722bade918
commit f2f5d60a8a
4 changed files with 44 additions and 4 deletions

View file

@ -82,6 +82,7 @@ FriendsDialog::FriendsDialog(QWidget *parent)
}
last_status_send_time = 0 ;
inChatCharFormatChanged = false;
connect( ui.mypersonalstatuslabel, SIGNAL(clicked()), SLOT(statusmessage()));
connect( ui.actionSet_your_Avatar, SIGNAL(triggered()), this, SLOT(getAvatar()));
@ -116,6 +117,8 @@ FriendsDialog::FriendsDialog(QWidget *parent)
connect(ui.emoticonBtn, SIGNAL(clicked()), this, SLOT(smileyWidgetgroupchat()));
connect(ui.lineEdit,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(contextMenu(QPoint)));
// reset text and color after removing all characters from the QTextEdit and after calling QTextEdit::clear
connect(ui.lineEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));
connect(ui.textboldChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
connect(ui.textunderlineChatButton, SIGNAL(clicked()), this, SLOT(setFont()));
@ -276,6 +279,23 @@ void FriendsDialog::contextMenu(QPoint /*point*/)
delete(contextMnu);
}
void FriendsDialog::chatCharFormatChanged()
{
if (inChatCharFormatChanged) {
return;
}
inChatCharFormatChanged = true;
// Reset font and color before inserting a character if edit box is empty
// (color info disappears when the user deletes all text)
if (ui.lineEdit->toPlainText().isEmpty()) {
setColorAndFont();
}
inChatCharFormatChanged = false;
}
void FriendsDialog::updateDisplay()
{
}
@ -494,8 +514,6 @@ void FriendsDialog::sendMsg()
// QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed.
ui.lineEdit->setCurrentCharFormat(QTextCharFormat ());
setColorAndFont();
/* redraw send list */
insertSendList();
}