diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-05-25 18:49:30 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-05-25 18:49:30 (GMT) |
commit | 1934734a0a0ef46d5db2eeedfb380a269116e3b4 (patch) | |
tree | 8a777b83acc6405ad0c9a317725a4e786943d7e2 /Swift/QtUI/QtChatWindow.cpp | |
parent | 2a5340bd4c758a1e61c10aaaf5ebed725243a151 (diff) | |
download | swift-contrib-1934734a0a0ef46d5db2eeedfb380a269116e3b4.zip swift-contrib-1934734a0a0ef46d5db2eeedfb380a269116e3b4.tar.bz2 |
Allow Ctrl-W to close chat windows
Diffstat (limited to 'Swift/QtUI/QtChatWindow.cpp')
-rw-r--r-- | Swift/QtUI/QtChatWindow.cpp | 14 |
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); } |