From 4b363ed35e880a6a74ac7784fcad713c62902f3a Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 3 Jan 2012 18:31:13 +0100 Subject: improve closed tabs management - remove reopened tabs from the closed tabs list. - limit them to MAX 8 elements (it seems enough to me) - save history also when there is just one tab closed - DON'T save history when you opened a "rekonq" page BUG:271224 --- src/tabbar.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/tabbar.cpp') diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 1634f284..4834095a 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -3,7 +3,7 @@ * This file is a part of the rekonq project * * Copyright (C) 2008 Benjamin C. Meyer -* Copyright (C) 2008-2011 by Andrea Diamantini +* Copyright (C) 2008-2012 by Andrea Diamantini * Copyright (C) 2009 by Paweł Prażak * Copyright (C) 2009-2011 by Lionel Chauvin * @@ -380,26 +380,28 @@ void TabBar::setupHistoryActions() MainView *mv = qobject_cast(parent()); QAction *openLastClosedTabAction = w->actionByName(QL1S("open_last_closed_tab")); - openLastClosedTabAction->setEnabled(mv->recentlyClosedTabs().size() > 0); + + bool closedTabsAvailable = (mv->recentlyClosedTabs().size() > 0); + openLastClosedTabAction->setEnabled(closedTabsAvailable); // update closed tabs menu KActionMenu *am = qobject_cast(w->actionByName(QL1S("closed_tab_menu"))); if (!am) return; - bool isEnabled = (mv->recentlyClosedTabs().size() > 0); - am->setEnabled(isEnabled); + am->setEnabled(closedTabsAvailable); if (am->menu()) am->menu()->clear(); - if (!isEnabled) + if (!closedTabsAvailable) return; - Q_FOREACH(const TabHistory & item, mv->recentlyClosedTabs()) + for (int i = 0; i < mv->recentlyClosedTabs().count(); ++i) { + TabHistory item = mv->recentlyClosedTabs().at(i); KAction *a = new KAction(rApp->iconManager()->iconForUrl(item.url), item.title, this); - a->setData(item.history); + a->setData(i); connect(a, SIGNAL(triggered()), mv, SLOT(openClosedTab())); am->addAction(a); } -- cgit v1.2.1