From 8af3fb34b9f5d9148d81b4f0d836b486e075f053 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Sun, 1 Jul 2012 09:46:48 +0100 Subject: Don't allow labels to be lost or changed during correction. Resolves: #871 diff --git a/Swift/QtUI/QtChatView.cpp b/Swift/QtUI/QtChatView.cpp index a55161f..49e5974 100644 --- a/Swift/QtUI/QtChatView.cpp +++ b/Swift/QtUI/QtChatView.cpp @@ -169,7 +169,7 @@ void QtChatView::replaceMessage(const QString& newMessage, const QString& id, co rememberScrolledToBottom(); QWebElement message = document_.findFirst("#" + id); if (!message.isNull()) { - QWebElement replaceContent = message.findFirst("span.swift_message"); + QWebElement replaceContent = message.findFirst("span.swift_inner_message"); assert(!replaceContent.isNull()); QString old = replaceContent.toOuterXml(); replaceContent.setInnerXml(ChatSnippet::escape(newMessage)); diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 0d329d6..d20c627 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -275,6 +275,7 @@ void QtChatWindow::beginCorrection() { isCorrection_ = true; correctingLabel_->show(); input_->setStyleSheet(alertStyleSheet_); + labelsWidget_->setEnabled(false); } void QtChatWindow::cancelCorrection() { @@ -285,6 +286,7 @@ void QtChatWindow::cancelCorrection() { isCorrection_ = false; correctingLabel_->hide(); input_->setStyleSheet(qApp->styleSheet()); + labelsWidget_->setEnabled(true); } QByteArray QtChatWindow::getSplitterState() { @@ -488,8 +490,8 @@ std::string QtChatWindow::addMessage(const std::string &message, const std::stri QString htmlString; if (label) { - htmlString = QString("").arg(Qt::escape(P2QSTRING(label->getForegroundColor()))).arg(Qt::escape(P2QSTRING(label->getBackgroundColor()))); - htmlString += QString("%3 ").arg(Qt::escape(P2QSTRING(label->getDisplayMarking()))); + htmlString = QString("").arg(Qt::escape(P2QSTRING(label->getForegroundColor()))).arg(Qt::escape(P2QSTRING(label->getBackgroundColor()))); + htmlString += QString("%1 ").arg(Qt::escape(P2QSTRING(label->getDisplayMarking()))); } QString messageHTML(P2QSTRING(message)); messageHTML = Qt::escape(messageHTML); @@ -506,7 +508,7 @@ std::string QtChatWindow::addMessage(const std::string &message, const std::stri messageHTML.replace("\n","
"); QString styleSpanStart = style == "" ? "" : ""; QString styleSpanEnd = style == "" ? "" : ""; - htmlString += styleSpanStart + messageHTML + styleSpanEnd; + htmlString += "" + styleSpanStart + messageHTML + styleSpanEnd + "" ; bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasMessage, senderName, senderIsSelf); if (lastLineTracker_.getShouldMoveLastLine()) { -- cgit v0.10.2-6-g49f6