mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 04:36:34 +01:00
Option to replace opened tabs list with closed tabs list: no need to restart after change
This commit is contained in:
parent
c9741e9442
commit
80216ce7dc
@ -126,14 +126,12 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
|
||||
connect(m_tabBar, SIGNAL(showButtons()), this, SLOT(showButtons()));
|
||||
connect(m_tabBar, SIGNAL(hideButtons()), this, SLOT(hideButtons()));
|
||||
|
||||
loadSettings();
|
||||
|
||||
m_buttonListTabs = new ToolButton(this);
|
||||
m_buttonListTabs->setObjectName("tabwidget-button-opentabs");
|
||||
m_menuTabs = new QMenu(this);
|
||||
m_buttonListTabs->setMenu(m_menuTabs);
|
||||
m_buttonListTabs->setPopupMode(QToolButton::InstantPopup);
|
||||
m_buttonListTabs->setToolTip(m_closedInsteadOpened ? tr("Show list of closed tabs") : tr("Show list of opened tabs"));
|
||||
m_buttonListTabs->setToolTip(tr("List of tabs"));
|
||||
m_buttonListTabs->setAutoRaise(true);
|
||||
m_buttonListTabs->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
@ -144,8 +142,9 @@ TabWidget::TabWidget(QupZilla* mainClass, QWidget* parent)
|
||||
m_buttonAddTab->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
connect(m_buttonAddTab, SIGNAL(clicked()), p_QupZilla, SLOT(addTab()));
|
||||
connect(m_menuTabs, SIGNAL(aboutToShow()), this, m_closedInsteadOpened ? SLOT(aboutToShowClosedTabsMenu()) : SLOT(aboutToShowTabsMenu()));
|
||||
|
||||
connect(m_menuTabs, SIGNAL(aboutToShow()), this, SLOT(aboutToShowClosedTabsMenu()));
|
||||
|
||||
loadSettings();
|
||||
}
|
||||
|
||||
void TabWidget::loadSettings()
|
||||
@ -539,24 +538,29 @@ bool TabWidget::canRestoreTab()
|
||||
|
||||
void TabWidget::aboutToShowClosedTabsMenu()
|
||||
{
|
||||
m_menuTabs->clear();
|
||||
int i = 0;
|
||||
foreach(ClosedTabsManager::Tab tab, this->closedTabsManager()->allClosedTabs()) {
|
||||
QString title = tab.title;
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
}
|
||||
m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i);
|
||||
i++;
|
||||
}
|
||||
m_menuTabs->addSeparator();
|
||||
if (i == 0) {
|
||||
m_menuTabs->addAction(tr("Empty"))->setEnabled(false);
|
||||
if (!m_closedInsteadOpened) {
|
||||
aboutToShowTabsMenu();
|
||||
}
|
||||
else {
|
||||
m_menuTabs->addAction(tr("Restore All Closed Tabs"), this, SLOT(restoreAllClosedTabs()));
|
||||
m_menuTabs->addAction(tr("Clear list"), this, SLOT(clearClosedTabsList()));
|
||||
m_menuTabs->clear();
|
||||
int i = 0;
|
||||
foreach(ClosedTabsManager::Tab tab, this->closedTabsManager()->allClosedTabs()) {
|
||||
QString title = tab.title;
|
||||
if (title.length() > 40) {
|
||||
title.truncate(40);
|
||||
title += "..";
|
||||
}
|
||||
m_menuTabs->addAction(_iconForUrl(tab.url), title, this, SLOT(restoreClosedTab()))->setData(i);
|
||||
i++;
|
||||
}
|
||||
m_menuTabs->addSeparator();
|
||||
if (i == 0) {
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user