summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoanna Hulboj <joanna.hulboj@isode.com>2017-03-28 09:38:23 (GMT)
committerJoanna Hulboj <joanna.hulboj@isode.com>2017-04-07 13:04:59 (GMT)
commit0b4c4ade26c7ff77ba7f8b4ae83e4bd3581bf345 (patch)
tree3044fef83e2a0f09af6fc8df07b1afc98a251560
parented2226782ac15345aeb8e615b41d30e5aab67b51 (diff)
downloadswift-0b4c4ade26c7ff77ba7f8b4ae83e4bd3581bf345.zip
swift-0b4c4ade26c7ff77ba7f8b4ae83e4bd3581bf345.tar.bz2
Do not grey out chat view after clearing
Test-Information: Run Swift, open chat window, enter a message and send it. Right click on chat view and choose Clear. Chat log in a view will be cleared but it will stay white. On the top of the chat view will be a message: e.g. Starting chat with test - test@test.isode.net: Offline. Change-Id: Ie453602e2f2b14e3ecca699821521ad33937ccf6
-rw-r--r--Swift/Controllers/Chat/ChatController.cpp1
-rw-r--r--Swift/Controllers/Chat/MUCController.cpp24
-rw-r--r--Swift/Controllers/Chat/MUCController.h2
-rw-r--r--Swift/QtUI/QtWebKitChatView.cpp2
4 files changed, 20 insertions, 9 deletions
diff --git a/Swift/Controllers/Chat/ChatController.cpp b/Swift/Controllers/Chat/ChatController.cpp
index d0ee891..36e12e3 100644
--- a/Swift/Controllers/Chat/ChatController.cpp
+++ b/Swift/Controllers/Chat/ChatController.cpp
@@ -86,6 +86,7 @@ ChatController::ChatController(const JID& self, StanzaChannel* stanzaChannel, IQ
chatStateNotifier_->setContactIsOnline(theirPresence && theirPresence->getType() == Presence::Available);
startMessage += ".";
chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(startMessage), ChatWindow::DefaultDirection);
+ chatWindow_->onContinuationsBroken.connect([this, startMessage]() { chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(startMessage), ChatWindow::DefaultDirection); });
chatWindow_->onUserTyping.connect(boost::bind(&ChatStateNotifier::setUserIsTyping, chatStateNotifier_));
chatWindow_->onUserCancelsTyping.connect(boost::bind(&ChatStateNotifier::userCancelledNewMessage, chatStateNotifier_));
chatWindow_->onFileTransferStart.connect(boost::bind(&ChatController::handleFileTransferStart, this, _1, _2));
diff --git a/Swift/Controllers/Chat/MUCController.cpp b/Swift/Controllers/Chat/MUCController.cpp
index a142ee0..73cf748 100644
--- a/Swift/Controllers/Chat/MUCController.cpp
+++ b/Swift/Controllers/Chat/MUCController.cpp
@@ -128,6 +128,7 @@ MUCController::MUCController (
chatWindow_->onGetAffiliationsRequest.connect(boost::bind(&MUCController::handleGetAffiliationsRequest, this));
chatWindow_->onChangeAffiliationsRequest.connect(boost::bind(&MUCController::handleChangeAffiliationsRequest, this, _1));
chatWindow_->onUnblockUserRequest.connect(boost::bind(&MUCController::handleUnblockUserRequest, this));
+ chatWindow_->onContinuationsBroken.connect(boost::bind(&MUCController::addChatSystemMessage, this));
muc_->onJoinComplete.connect(boost::bind(&MUCController::handleJoinComplete, this, _1));
muc_->onJoinFailed.connect(boost::bind(&MUCController::handleJoinFailed, this, _1));
muc_->onOccupantJoined.connect(boost::bind(&MUCController::handleOccupantJoined, this, _1));
@@ -381,14 +382,14 @@ void MUCController::handleJoinComplete(const std::string& nick) {
receivedActivity();
renameCounter_ = 0;
joined_ = true;
- std::string joinMessage;
if (isImpromptu_) {
- joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have joined the chat as %1%.")) % nick);
- } else {
- joinMessage = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick);
+ lastStartMessage_ = str(format(QT_TRANSLATE_NOOP("", "You have joined the chat as %1%.")) % nick);
+ }
+ else {
+ lastStartMessage_ = str(format(QT_TRANSLATE_NOOP("", "You have entered room %1% as %2%.")) % toJID_.toString() % nick);
}
setNick(nick);
- chatWindow_->replaceSystemMessage(chatMessageParser_->parseMessageBody(joinMessage, "", true), lastJoinMessageUID_, ChatWindow::UpdateTimestamp);
+ chatWindow_->replaceSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_, "", true), lastJoinMessageUID_, ChatWindow::UpdateTimestamp);
lastJoinMessageUID_ = "";
#ifdef SWIFT_EXPERIMENTAL_HISTORY
@@ -660,13 +661,16 @@ void MUCController::setOnline(bool online) {
std::shared_ptr<BlockList> blockList = clientBlockListManager_->getBlockList();
if (blockList && blockList->isBlocked(muc_->getJID())) {
handleBlockingStateChanged();
- lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "You've blocked this room. To enter the room, first unblock it using the cog menu and try again")), ChatWindow::DefaultDirection);
+ lastStartMessage_ = QT_TRANSLATE_NOOP("", "You've blocked this room. To enter the room, first unblock it using the cog menu and try again");
+ lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_ ), ChatWindow::DefaultDirection);
}
else {
if (isImpromptu_) {
- lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(QT_TRANSLATE_NOOP("", "Trying to join chat")), ChatWindow::DefaultDirection);
+ lastStartMessage_ = QT_TRANSLATE_NOOP("", "Trying to join chat");
+ lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_), ChatWindow::DefaultDirection);
} else {
- lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(str(format(QT_TRANSLATE_NOOP("", "Trying to enter room %1%")) % toJID_.toString())), ChatWindow::DefaultDirection);
+ lastStartMessage_ = str(format(QT_TRANSLATE_NOOP("", "Trying to enter room %1%")) % toJID_.toString());
+ lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_), ChatWindow::DefaultDirection);
}
if (loginCheckTimer_) {
loginCheckTimer_->start();
@@ -1239,4 +1243,8 @@ void MUCController::displaySubjectIfChanged(const std::string& subject) {
}
}
+void MUCController::addChatSystemMessage() {
+ lastJoinMessageUID_ = chatWindow_->addSystemMessage(chatMessageParser_->parseMessageBody(lastStartMessage_), ChatWindow::DefaultDirection);
+}
+
}
diff --git a/Swift/Controllers/Chat/MUCController.h b/Swift/Controllers/Chat/MUCController.h
index 6244f6d..9d6428b 100644
--- a/Swift/Controllers/Chat/MUCController.h
+++ b/Swift/Controllers/Chat/MUCController.h
@@ -145,6 +145,7 @@ namespace Swift {
void updateChatWindowBookmarkStatus(const boost::optional<MUCBookmark>& bookmark);
void displaySubjectIfChanged(const std::string& sucject);
+ void addChatSystemMessage();
private:
MUC::ref muc_;
@@ -169,6 +170,7 @@ namespace Swift {
bool isImpromptuAlreadyConfigured_;
RosterVCardProvider* rosterVCardProvider_;
std::string lastJoinMessageUID_;
+ std::string lastStartMessage_;
ClientBlockListManager* clientBlockListManager_;
boost::signals2::scoped_connection blockingOnStateChangedConnection_;
diff --git a/Swift/QtUI/QtWebKitChatView.cpp b/Swift/QtUI/QtWebKitChatView.cpp
index ce3e9cd..290bd59 100644
--- a/Swift/QtUI/QtWebKitChatView.cpp
+++ b/Swift/QtUI/QtWebKitChatView.cpp
@@ -114,8 +114,8 @@ void QtWebKitChatView::handleClearRequested() {
messageBox.setDefaultButton(QMessageBox::Yes);
int button = messageBox.exec();
if (button == QMessageBox::Yes) {
- logCleared();
resetView();
+ logCleared();
resizeFont(fontSizeSteps_);
}
}