From 6ab095181e81be314df4dbd39a0bab4318ec15eb Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Wed, 28 Oct 2009 00:58:42 +0100 Subject: Restoring CTRL + W shortcut (close tab) --- src/mainwindow.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d09bb490..e6543e86 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -362,7 +362,6 @@ void MainWindow::setupActions() // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); - a->setShortcut(KShortcut(Qt::CTRL + Qt::Key_W)); actionCollection()->addAction(QLatin1String("close_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeTab())); @@ -892,24 +891,34 @@ bool MainWindow::queryClose() void MainWindow::keyPressEvent(QKeyEvent *event) { + // hide findbar if (event->key() == Qt::Key_Escape) { m_findBar->hide(); return; } + // ctrl + tab action if ((event->modifiers() == Qt::ControlModifier) && (event->key() == Qt::Key_Tab)) { emit ctrlTabPressed(); return; } + // shift + ctrl + tab action if ((event->modifiers() == Qt::ControlModifier + Qt::ShiftModifier) && (event->key() == Qt::Key_Backtab)) { emit shiftCtrlTabPressed(); return; } + // close current tab action + if ((event->modifiers() == Qt::ControlModifier) && event->key() == Qt::Key_W) + { + m_view->slotCloseTab(m_view->currentIndex()); + return; + } + KMainWindow::keyPressEvent(event); } -- cgit v1.2.1