diff options
author | Richard Maudsley <richard.maudsley@isode.com> | 2014-08-01 09:23:34 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2014-10-08 07:32:25 (GMT) |
commit | b67aba2e28e5fd716c18bef9c2826b482ef832ad (patch) | |
tree | 235ad98446de8b91ef2eb725c148896527106386 /Swift/QtUI | |
parent | 138aa844b47b32ba1d3651e041ca11d8e3a12d6c (diff) | |
download | swift-b67aba2e28e5fd716c18bef9c2826b482ef832ad.zip swift-b67aba2e28e5fd716c18bef9c2826b482ef832ad.tar.bz2 |
Prevent multiple chat window alerts being shown with the same message.
Test-Information:
Enable message delivery receipts, check that only a single alert is displayed for repeated messages.
Change-Id: Ifb9f8bd74e592147745f95678f94c21563d301a5
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index 6500ba4..ed79dcc 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -271,11 +271,20 @@ void QtChatWindow::handleKeyPressEvent(QKeyEvent* event) { } void QtChatWindow::beginCorrection() { + boost::optional<AlertID> newCorrectingAlert; if (correctionEnabled_ == ChatWindow::Maybe) { - correctingAlert_ = addAlert(Q2PSTRING(tr("This chat may not support message correction. If you send a correction anyway, it may appear as a duplicate message"))); + newCorrectingAlert = addAlert(Q2PSTRING(tr("This chat may not support message correction. If you send a correction anyway, it may appear as a duplicate message"))); } else if (correctionEnabled_ == ChatWindow::No) { - correctingAlert_ = addAlert(Q2PSTRING(tr("This chat does not support message correction. If you send a correction anyway, it will appear as a duplicate message"))); + newCorrectingAlert = addAlert(Q2PSTRING(tr("This chat does not support message correction. If you send a correction anyway, it will appear as a duplicate message"))); } + + if (newCorrectingAlert) { + if (correctingAlert_) { + removeAlert(*correctingAlert_); + } + correctingAlert_ = newCorrectingAlert; + } + QTextCursor cursor = input_->textCursor(); cursor.select(QTextCursor::Document); cursor.beginEditBlock(); |