diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-05-07 14:38:47 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-05-07 14:38:47 (GMT) |
commit | 5eec1003100cfff8897f23dada9fb636187640a4 (patch) | |
tree | 292e2aade5ce9c24e90c5a698995e641d1c7cd2f /Swift | |
parent | 7eb27a2228fdb34d6c629ddc5fcce82583db3a85 (diff) | |
download | swift-contrib-5eec1003100cfff8897f23dada9fb636187640a4.zip swift-contrib-5eec1003100cfff8897f23dada9fb636187640a4.tar.bz2 |
Allow chat messages to be composed while offline.
Resolves: #331
Diffstat (limited to 'Swift')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 7 | ||||
-rw-r--r-- | Swift/QtUI/QtChatWindow.h | 1 |
2 files changed, 7 insertions, 1 deletions
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_; }; } |