From 5eec1003100cfff8897f23dada9fb636187640a4 Mon Sep 17 00:00:00 2001 From: Kevin Smith Date: Fri, 7 May 2010 14:38:47 +0000 Subject: Allow chat messages to be composed while offline. Resolves: #331 diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp index d1b3194..e5c48f2 100644 --- a/Swift/QtUI/QtChatWindow.cpp +++ b/Swift/QtUI/QtChatWindow.cpp @@ -28,6 +28,7 @@ namespace Swift { QtChatWindow::QtChatWindow(const QString &contact, UIEventStream* eventStream) : QtTabbable(), contact_(contact), previousMessageWasSelf_(false), previousMessageWasSystem_(false), eventStream_(eventStream) { unreadCount_ = 0; + inputEnabled_ = true; updateTitleWithUnreadCount(); QBoxLayout *layout = new QBoxLayout(QBoxLayout::TopToBottom, this); @@ -133,7 +134,8 @@ void QtChatWindow::qAppFocusChanged(QWidget *old, QWidget *now) { } void QtChatWindow::setInputEnabled(bool enabled) { - input_->setEnabled(enabled); + inputEnabled_ = enabled; +// input_->setEnabled(enabled); } void QtChatWindow::showEvent(QShowEvent* event) { @@ -232,6 +234,9 @@ void QtChatWindow::addSystemMessage(const String& message) { } void QtChatWindow::returnPressed() { + if (!inputEnabled_) { + return; + } onSendMessageRequest(Q2PSTRING(input_->toPlainText())); messageLog_->scrollToBottom(); inputClearing_ = true; diff --git a/Swift/QtUI/QtChatWindow.h b/Swift/QtUI/QtChatWindow.h index 0b22ea1..4581a67 100644 --- a/Swift/QtUI/QtChatWindow.h +++ b/Swift/QtUI/QtChatWindow.h @@ -73,6 +73,7 @@ namespace Swift { QString previousSenderName_; bool inputClearing_; UIEventStream* eventStream_; + bool inputEnabled_; }; } -- cgit v0.10.2-6-g49f6