From d44c64e440e8d551d528eeafef97407c77cd420a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 4 Jun 2010 02:38:35 +0200 Subject: This should fix the Ctrl+w bug. Anyway, it really doesn't solve it: there is a corner case where the trick implemented doesn't work. We'll see if someone can fix also that.. BUG:233937 --- src/mainview.cpp | 7 ++++--- src/mainview.h | 7 +++++-- src/mainwindow.cpp | 8 +------- src/tabbar.cpp | 5 +++++ 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/src/mainview.cpp b/src/mainview.cpp index 0b17ef2a..166c1a1b 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -413,9 +413,11 @@ void MainView::windowCloseRequested() void MainView::closeOtherTabs(int index) { - if (-1 == index) + if (index < 0) + index = currentIndex(); + if (index < 0 || index >= count()) return; - + for (int i = count() - 1; i > index; --i) { closeTab(i); @@ -430,7 +432,6 @@ void MainView::closeOtherTabs(int index) } -// When index is -1 index chooses the current tab void MainView::cloneTab(int index) { if (index < 0) diff --git a/src/mainview.h b/src/mainview.h index 636d37ac..f0a1982f 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -125,14 +125,17 @@ public slots: */ void newTab(); + // Indexed slots void cloneTab(int index = -1); void closeTab(int index = -1, bool del = true); - void closeOtherTabs(int index); + void closeOtherTabs(int index = -1); void reloadTab(int index = -1); + void detachTab(int index = -1); + void reloadAllTabs(); void nextTab(); void previousTab(); - void detachTab(int index = -1); + void openClosedTabs(); void openClosedTab(); void switchToTab(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5a0b2568..dc1dc708 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -402,6 +402,7 @@ void MainWindow::setupActions() // ============================== Indexed Tab Actions ==================================== a = new KAction(KIcon("tab-close"), i18n("&Close Tab"), this); + a->setShortcuts( KStandardShortcut::close() ); actionCollection()->addAction(QL1S("close_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view->tabBar(), SLOT(closeTab())); @@ -1094,13 +1095,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event) return; } - // close current tab action - if ((event->modifiers() == Qt::ControlModifier) && event->key() == Qt::Key_W) - { - m_view->closeTab(m_view->currentIndex()); - return; - } - KMainWindow::keyPressEvent(event); } diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 94c5efbd..09aa814d 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -120,30 +120,35 @@ QSize TabBar::tabSizeHint(int index) const void TabBar::cloneTab() { emit cloneTab(m_actualIndex); + m_actualIndex = -1; } void TabBar::closeTab() { emit closeTab(m_actualIndex); + m_actualIndex = -1; } void TabBar::closeOtherTabs() { emit closeOtherTabs(m_actualIndex); + m_actualIndex = -1; } void TabBar::reloadTab() { emit reloadTab(m_actualIndex); + m_actualIndex = -1; } void TabBar::detachTab() { emit detachTab(m_actualIndex); + m_actualIndex = -1; } -- cgit v1.2.1