summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r--Swift/QtUI/QtChatWindow.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatWindow.cpp b/Swift/QtUI/QtChatWindow.cpp
index e5c48f2..2f85571 100644
--- a/Swift/QtUI/QtChatWindow.cpp
+++ b/Swift/QtUI/QtChatWindow.cpp
@@ -67,7 +67,7 @@ QtChatWindow::QtChatWindow(const QString &contact, UIEventStream* eventStream) :
inputClearing_ = false;
contactIsTyping_ = false;
- connect(input_, SIGNAL(unhandledKeyPressEvent(QKeyEvent*)), messageLog_, SLOT(handleKeyPressEvent(QKeyEvent*)));
+ connect(input_, SIGNAL(unhandledKeyPressEvent(QKeyEvent*)), this, SLOT(handleKeyPressEvent(QKeyEvent*)));
connect(input_, SIGNAL(returnPressed()), this, SLOT(returnPressed()));
connect(input_, SIGNAL(textChanged()), this, SLOT(handleInputChanged()));
setFocusProxy(input_);
@@ -80,6 +80,18 @@ QtChatWindow::~QtChatWindow() {
}
+void QtChatWindow::handleKeyPressEvent(QKeyEvent* event) {
+ int key = event->key();
+ Qt::KeyboardModifiers modifiers = event->modifiers();
+ if (
+ (key == Qt::Key_W && modifiers == Qt::ControlModifier)
+ ) {
+ close();
+ } else {
+ messageLog_->handleKeyPressEvent(event);
+ }
+}
+
void QtChatWindow::setRosterModel(Roster* roster) {
treeWidget_->setRosterModel(roster);
}