1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

Rework list of closed tabs

This commit is contained in:
Mladen Pejaković 2014-02-15 18:49:48 +01:00
parent 5301495966
commit 3eede1d8a2

View File

@ -818,6 +818,18 @@ void TabWidget::aboutToShowClosedTabsMenu()
} }
else { else {
m_menuTabs->clear(); 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; int i = 0;
foreach (const ClosedTabsManager::Tab &tab, closedTabsManager()->allClosedTabs()) { foreach (const ClosedTabsManager::Tab &tab, closedTabsManager()->allClosedTabs()) {
QString title = tab.title; QString title = tab.title;
@ -828,14 +840,12 @@ void TabWidget::aboutToShowClosedTabsMenu()
m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i); m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i);
i++; i++;
} }
m_menuTabs->addSeparator();
if (i == 0) { if (i == 0) {
arestore->setVisible(false);
aclrlist->setVisible(false);
m_menuTabs->addAction(tr("Empty"))->setEnabled(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()));
}
} }
} }