diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtHighlightEditor.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtWebKitChatView.cpp | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/Swift/QtUI/QtHighlightEditor.cpp b/Swift/QtUI/QtHighlightEditor.cpp index 50d1f78..1d47c4e 100644 --- a/Swift/QtUI/QtHighlightEditor.cpp +++ b/Swift/QtUI/QtHighlightEditor.cpp @@ -424,22 +424,22 @@ HighlightRule QtHighlightEditor::ruleFromDialog() } else { rule.setMatchChat(false); rule.setMatchMUC(true); } if (ui_.allMsgRadio->isChecked()) { - action.setHighlightAllText(true); + action.setHighlightWholeMessage(true); } if (ui_.senderRadio->isChecked()) { QString senderName = jid_->text(); if (!senderName.isEmpty()) { std::vector<std::string> senders; senders.push_back(Q2PSTRING(senderName)); rule.setSenders(senders); - action.setHighlightAllText(true); + action.setHighlightWholeMessage(true); } } if (ui_.keywordRadio->isChecked()) { QString keywordString = ui_.keyword->text(); if (!keywordString.isEmpty()) { diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp index f1278b8..7e0e505 100644 --- a/Swift/QtUI/QtWebKitChatView.cpp +++ b/Swift/QtUI/QtWebKitChatView.cpp @@ -620,14 +620,16 @@ std::string QtWebKitChatView::addMessage( htmlString = QString("<span style=\"border: thin dashed grey; padding-left: .5em; padding-right: .5em; color: %1; background-color: %2; font-size: 90%; margin-right: .5em; \" class='swift_label'>").arg(QtUtilities::htmlEscape(P2QSTRING(label->getForegroundColor()))).arg(QtUtilities::htmlEscape(P2QSTRING(label->getBackgroundColor()))); htmlString += QString("%1</span> ").arg(QtUtilities::htmlEscape(P2QSTRING(label->getDisplayMarking()))); } QString styleSpanStart = style == "" ? "" : "<span style=\"" + style + "\">"; QString styleSpanEnd = style == "" ? "" : "</span>"; - QString highlightSpanStart = highlight.highlightAllText() ? getHighlightSpanStart(highlight) : ""; - QString highlightSpanEnd = highlight.highlightAllText() ? "</span>" : ""; + + bool highlightWholeMessage = highlight.highlightWholeMessage() && highlight.getTextBackground() != "" && highlight.getTextColor() != ""; + QString highlightSpanStart = highlightWholeMessage ? getHighlightSpanStart(highlight) : ""; + QString highlightSpanEnd = highlightWholeMessage ? "</span>" : ""; htmlString += "<span class='swift_inner_message'>" + styleSpanStart + highlightSpanStart + message + highlightSpanEnd + styleSpanEnd + "</span>" ; bool appendToPrevious = appendToPreviousCheck(PreviousMessageWasMessage, senderName, senderIsSelf); QString qAvatarPath = scaledAvatarPath.isEmpty() ? "qrc:/icons/avatar.png" : QUrl::fromLocalFile(scaledAvatarPath).toEncoded(); std::string id = "id" + boost::lexical_cast<std::string>(idCounter_++); @@ -868,14 +870,14 @@ void QtWebKitChatView::replaceMessage(const QString& message, const std::string& } QString messageHTML(message); QString styleSpanStart = style == "" ? "" : "<span style=\"" + style + "\">"; QString styleSpanEnd = style == "" ? "" : "</span>"; - QString highlightSpanStart = highlight.highlightAllText() ? getHighlightSpanStart(highlight) : ""; - QString highlightSpanEnd = highlight.highlightAllText() ? "</span>" : ""; + QString highlightSpanStart = highlight.highlightWholeMessage() ? getHighlightSpanStart(highlight) : ""; + QString highlightSpanEnd = highlight.highlightWholeMessage() ? "</span>" : ""; messageHTML = styleSpanStart + highlightSpanStart + messageHTML + highlightSpanEnd + styleSpanEnd; replaceMessage(messageHTML, P2QSTRING(id), B2QDATE(time)); } else { std::cerr << "Trying to replace a message with no id"; |