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

@ -61,6 +61,7 @@ ChatWidget::ChatWidget(QWidget *parent) :
peerStatus = 0;
isChatLobby = false;
firstShow = true;
inChatCharFormatChanged = false;
lastStatusSendTime = 0 ;
@ -86,6 +87,8 @@ ChatWidget::ChatWidget(QWidget *parent) :
connect(NotifyQt::getInstance(), SIGNAL(peerHasNewCustomStateString(const QString&, const QString&)), this, SLOT(updatePeersCustomStateString(const QString&, const QString&)));
connect(ui->chattextEdit, 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->chattextEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(chatCharFormatChanged()));
ui->infoframe->setVisible(false);
ui->statusmessagelabel->hide();
@ -368,6 +371,23 @@ void ChatWidget::contextMenu(QPoint /*point*/)
delete(contextMnu);
}
void ChatWidget::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->chattextEdit->toPlainText().isEmpty()) {
setColorAndFont();
}
inChatCharFormatChanged = false;
}
void ChatWidget::resetStatusBar()
{
ui->statusLabel->clear();
@ -422,8 +442,6 @@ void ChatWidget::sendChat()
// workaround for Qt bug - http://bugreports.qt.nokia.com/browse/QTBUG-2533
// QTextEdit::clear() does not reset the CharFormat if document contains hyperlinks that have been accessed.
chatWidget->setCurrentCharFormat(QTextCharFormat ());
setColorAndFont();
}
void ChatWidget::on_closeInfoFrameButton_clicked()

View file

@ -98,6 +98,7 @@ protected:
private slots:
void pasteLink();
void contextMenu(QPoint);
void chatCharFormatChanged();
void fileHashingFinished(QList<HashedFile> hashedFiles);
@ -149,6 +150,7 @@ private:
RSStyle style;
bool firstShow;
bool inChatCharFormatChanged;
Ui::ChatWidget *ui;
};