diff options
author | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-09-19 17:58:29 +0200 |
---|---|---|
committer | Benjamin Poulain <benjamin.poulain@nokia.com> | 2010-09-19 20:45:30 +0200 |
commit | 142e0d44a8b8ef1f639aaf772aa9631d220d0275 (patch) | |
tree | 0758d1a9b45a3f62aedf718241ec6244ee9df60d | |
parent | some minor changes to the INSTALL file (diff) | |
download | rekonq-142e0d44a8b8ef1f639aaf772aa9631d220d0275.tar.xz |
Change the behavior of Ctrl+Maj+T to open only the last closed tab
Previously, the action of Ctrl+Maj+T was opening all the closed tabs.
This was differing from Firefox and Chrome, which can be confusing
for users.
This patch change the behavior to open only the last closed tab,
making the behavior more like the other browsers.
-rw-r--r-- | src/mainview.cpp | 12 | ||||
-rw-r--r-- | src/mainview.h | 2 | ||||
-rw-r--r-- | src/mainwindow.cpp | 6 | ||||
-rw-r--r-- | src/tabbar.cpp | 8 |
4 files changed, 14 insertions, 14 deletions
diff --git a/src/mainview.cpp b/src/mainview.cpp index f020fb53..3daee339 100644 --- a/src/mainview.cpp +++ b/src/mainview.cpp @@ -633,13 +633,13 @@ void MainView::previousTab() } -void MainView::openClosedTabs() +void MainView::openLastClosedTab() { - foreach (const HistoryItem &item, recentlyClosedTabs()) - { - Application::instance()->loadUrl( KUrl(item.url), Rekonq::NewTab); - } - m_recentlyClosedTabs.clear(); + if (m_recentlyClosedTabs.isEmpty()) + return; + + const HistoryItem item = m_recentlyClosedTabs.takeFirst(); + Application::instance()->loadUrl(KUrl(item.url), Rekonq::NewTab); } diff --git a/src/mainview.h b/src/mainview.h index 6fab7fc0..29162dd1 100644 --- a/src/mainview.h +++ b/src/mainview.h @@ -135,7 +135,7 @@ public slots: void nextTab(); void previousTab(); - void openClosedTabs(); + void openLastClosedTab(); void openClosedTab(); void switchToTab(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4c766ba0..4d3dfc91 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -449,10 +449,10 @@ void MainWindow::setupActions() actionCollection()->addAction(QL1S("show_prev_tab"), a); connect(a, SIGNAL(triggered(bool)), m_view, SLOT(previousTab())); - a = new KAction(KIcon("tab-new"), i18n("Open Closed Tabs"), this); + a = new KAction(KIcon("tab-new"), i18n("Open Last Closed Tab"), this); a->setShortcut(KShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_T)); - actionCollection()->addAction(QL1S("open_closed_tabs"), a); - connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openClosedTabs())); + actionCollection()->addAction(QL1S("open_last_closed_tab"), a); + connect(a, SIGNAL(triggered(bool)), m_view, SLOT(openLastClosedTab())); // Closed Tabs Menu KActionMenu *closedTabsMenu = new KActionMenu(KIcon("tab-new"), i18n("Closed Tabs"), this); diff --git a/src/tabbar.cpp b/src/tabbar.cpp index d403a39c..1756c20e 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -293,7 +293,7 @@ void TabBar::contextMenu(int tab, const QPoint &pos) menu.addAction(mainWindow->actionByName( QL1S("clone_tab") )); if (count() > 1) menu.addAction(mainWindow->actionByName( QL1S("detach_tab") )); - menu.addAction(mainWindow->actionByName( QL1S("open_closed_tabs") )); + menu.addAction(mainWindow->actionByName( QL1S("open_last_closed_tab") )); menu.addAction(mainWindow->actionByName( QL1S("closed_tab_menu") )); menu.addSeparator(); menu.addAction(mainWindow->actionByName( QL1S("close_tab") )); @@ -314,7 +314,7 @@ void TabBar::emptyAreaContextMenu(const QPoint &pos) MainWindow *mainWindow = Application::instance()->mainWindow(); menu.addAction(mainWindow->actionByName( QL1S("new_tab") )); - menu.addAction(mainWindow->actionByName( QL1S("open_closed_tabs") )); + menu.addAction(mainWindow->actionByName( QL1S("open_last_closed_tab") )); menu.addAction(mainWindow->actionByName( QL1S("closed_tab_menu") )); menu.addSeparator(); menu.addAction(mainWindow->actionByName( QL1S("reload_all_tabs") )); @@ -357,8 +357,8 @@ void TabBar::setupHistoryActions() MainWindow *w = Application::instance()->mainWindow(); MainView *mv = qobject_cast<MainView *>(parent()); - QAction *openClosedTabsAction = w->actionByName( QL1S("open_closed_tabs") ); - openClosedTabsAction->setEnabled( mv->recentlyClosedTabs().size() > 0 ); + QAction *openLastClosedTabAction = w->actionByName( QL1S("open_last_closed_tab") ); + openLastClosedTabAction->setEnabled( mv->recentlyClosedTabs().size() > 0 ); // update closed tabs menu KActionMenu *am = qobject_cast<KActionMenu *>( w->actionByName( QL1S("closed_tab_menu") )); |