From 3eede1d8a2f033160471c3ee643172df5e4ca206 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Pejakovi=C4=87?= Date: Sat, 15 Feb 2014 18:49:48 +0100 Subject: [PATCH] Rework list of closed tabs --- src/lib/webview/tabwidget.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/lib/webview/tabwidget.cpp b/src/lib/webview/tabwidget.cpp index 282f78601..3f813b5fa 100644 --- a/src/lib/webview/tabwidget.cpp +++ b/src/lib/webview/tabwidget.cpp @@ -818,6 +818,18 @@ void TabWidget::aboutToShowClosedTabsMenu() } else { m_menuTabs->clear(); + + QAction* arestore = new QAction(tr("Restore All Closed Tabs"), this); + QAction* aclrlist = new QAction(tr("Clear list"), this); + + connect(arestore, SIGNAL(triggered()), this, SLOT(restoreAllClosedTabs())); + connect(aclrlist, SIGNAL(triggered()), this, SLOT(clearClosedTabsList())); + + m_menuTabs->addAction(arestore); + m_menuTabs->addAction(aclrlist); + + m_menuTabs->addSeparator(); + int i = 0; foreach (const ClosedTabsManager::Tab &tab, closedTabsManager()->allClosedTabs()) { QString title = tab.title; @@ -828,14 +840,12 @@ void TabWidget::aboutToShowClosedTabsMenu() m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i); i++; } - m_menuTabs->addSeparator(); + if (i == 0) { + arestore->setVisible(false); + aclrlist->setVisible(false); m_menuTabs->addAction(tr("Empty"))->setEnabled(false); } - else { - m_menuTabs->addAction(tr("Restore All Closed Tabs"), this, SLOT(restoreAllClosedTabs())); - m_menuTabs->addAction(tr("Clear list"), this, SLOT(clearClosedTabsList())); - } } }