diff options
author | Tobias Markmann <tm@ayena.de> | 2015-01-15 20:58:00 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2015-02-17 11:54:49 (GMT) |
commit | 265b779d6766130afa8f2f166733dc172ba22dca (patch) | |
tree | 5eb420f523cdfc561ff8c3a2ee44ecc28a717062 /Swift/QtUI/QtChatTabs.cpp | |
parent | 619c4611e7c495c4545d65df5c86aa051ab6d354 (diff) | |
download | swift-265b779d6766130afa8f2f166733dc172ba22dca.zip swift-265b779d6766130afa8f2f166733dc172ba22dca.tar.bz2 |
Fix shortcut handling for chat window navigation
This commit fixes CTRL-Tab, CTRL-Backtab and CTRL-W shortcuts on Mac,
Windows and Linux.
These shortcuts work in all mode except --no-tabs mode. This will be fixed
in a future commit. There is still different behavior across platforms:
on Windows and Linux they are handled on key press and repeat, and on
Mac they are handled on key release and do not repeat.
Test-Information:
Tested on OS X 10.9.5, Windows 7 and Elementary OS.
Change-Id: I2179f234cfd76b86cf261f2cf7500fc1cf0439a4
Diffstat (limited to 'Swift/QtUI/QtChatTabs.cpp')
-rw-r--r-- | Swift/QtUI/QtChatTabs.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Swift/QtUI/QtChatTabs.cpp b/Swift/QtUI/QtChatTabs.cpp index 0701d33..04c6a49 100644 --- a/Swift/QtUI/QtChatTabs.cpp +++ b/Swift/QtUI/QtChatTabs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2014 Isode Limited. + * Copyright (c) 2010-2015 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -70,9 +70,19 @@ QtChatTabs::QtChatTabs(bool singleWindow, SettingsProvider* settingsProvider, bo } gridSelectionDialog_ = new QtGridSelectionDialog(); + + // setup shortcuts + shortcuts_ << new QShortcut(QKeySequence(tr("CTRL+W", "Close chat tab.")), window(), SLOT(handleCloseTabShortcut())); + shortcuts_ << new QShortcut(QKeySequence(Qt::CTRL, Qt::Key_PageUp), window(), SLOT(handleRequestedPreviousTab())); + shortcuts_ << new QShortcut(QKeySequence(Qt::CTRL, Qt::Key_PageDown), window(), SLOT(handleRequestedNextTab())); + shortcuts_ << new QShortcut(QKeySequence(Qt::ALT + Qt::Key_A), window(), SLOT(handleRequestedActiveTab())); } QtChatTabs::~QtChatTabs() { + foreach (QShortcut* shortcut, shortcuts_) { + delete shortcut; + } + if (trellisMode_) { storeTabPositions(); } @@ -230,6 +240,13 @@ void QtChatTabs::handleRequestedActiveTab() { } +void QtChatTabs::handleCloseTabShortcut() { + QWidget* currentWidget = dynamicGrid_->currentWidget(); + if (currentWidget) { + currentWidget->close(); + } +} + void QtChatTabs::handleTabCloseRequested(int index) { if (trellisMode_) { storeTabPositions(); |