summaryrefslogtreecommitdiff
path: root/src/tabbar.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-01-03 18:31:13 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-01-03 18:31:13 +0100
commit4b363ed35e880a6a74ac7784fcad713c62902f3a (patch)
treec2fcf830a13d10c45ac15ad947fb20b4e381a1e2 /src/tabbar.cpp
parentDo NOT load previews if not present (diff)
downloadrekonq-4b363ed35e880a6a74ac7784fcad713c62902f3a.tar.xz
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
Diffstat (limited to 'src/tabbar.cpp')
-rw-r--r--src/tabbar.cpp16
1 files changed, 9 insertions, 7 deletions
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 <ben@meyerhome.net>
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2009 by Paweł Prażak <pawelprazak at gmail dot com>
* Copyright (C) 2009-2011 by Lionel Chauvin <megabigbug@yahoo.fr>
*
@@ -380,26 +380,28 @@ void TabBar::setupHistoryActions()
MainView *mv = qobject_cast<MainView *>(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<KActionMenu *>(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);
}