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, in tab bar (Opera like behaviour)
This commit is contained in:
parent
4a4111161c
commit
c9741e9442
@ -194,6 +194,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
||||
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
|
||||
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
||||
ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
|
||||
settings.endGroup();
|
||||
//AddressBar
|
||||
settings.beginGroup("AddressBar");
|
||||
@ -684,6 +685,7 @@ void Preferences::saveSettings()
|
||||
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
||||
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
|
||||
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
||||
settings.setValue("closedInsteadOpenedTabs", ui->closedInsteadOpened->isChecked());
|
||||
settings.endGroup();
|
||||
|
||||
//DOWNLOADS
|
||||
|
@ -642,14 +642,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="4">
|
||||
<item row="9" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string><b>Address Bar behaviour</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<item row="13" column="1">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -662,21 +662,21 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="3">
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="selectAllOnFocus">
|
||||
<property name="text">
|
||||
<string>Select all text by double clicking in address bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1" colspan="3">
|
||||
<item row="12" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="addCountryWithAlt">
|
||||
<property name="text">
|
||||
<string>Add .co.uk domain by pressing ALT key</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<item row="8" column="1">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -696,7 +696,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<item row="11" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="selectAllOnClick">
|
||||
<property name="text">
|
||||
<string>Select all text by clicking in address bar</string>
|
||||
@ -730,6 +730,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="closedInsteadOpened">
|
||||
<property name="text">
|
||||
<string>Closed tabs list instead of opened in tab bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="stackedWidgetPage4">
|
||||
|
@ -126,12 +126,14 @@ 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(tr("Show list of opened tabs"));
|
||||
m_buttonListTabs->setToolTip(m_closedInsteadOpened ? tr("Show list of closed tabs") : tr("Show list of opened tabs"));
|
||||
m_buttonListTabs->setAutoRaise(true);
|
||||
m_buttonListTabs->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
@ -142,9 +144,8 @@ 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, SLOT(aboutToShowTabsMenu()));
|
||||
|
||||
loadSettings();
|
||||
connect(m_menuTabs, SIGNAL(aboutToShow()), this, m_closedInsteadOpened ? SLOT(aboutToShowClosedTabsMenu()) : SLOT(aboutToShowTabsMenu()));
|
||||
|
||||
}
|
||||
|
||||
void TabWidget::loadSettings()
|
||||
@ -153,6 +154,7 @@ void TabWidget::loadSettings()
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool();
|
||||
m_dontQuitWithOneTab = settings.value("dontQuitWithOneTab", false).toBool();
|
||||
m_closedInsteadOpened = settings.value("closedInsteadOpenedTabs", false).toBool();
|
||||
settings.endGroup();
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
m_urlOnNewTab = settings.value("newTabUrl", "qupzilla:speeddial").toUrl();
|
||||
@ -535,6 +537,29 @@ bool TabWidget::canRestoreTab()
|
||||
return m_closedTabsManager->isClosedTabAvailable();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
else {
|
||||
m_menuTabs->addAction(tr("Restore All Closed Tabs"), this, SLOT(restoreAllClosedTabs()));
|
||||
m_menuTabs->addAction(tr("Clear list"), this, SLOT(clearClosedTabsList()));
|
||||
}
|
||||
}
|
||||
|
||||
QList<WebTab*> TabWidget::allTabs(bool withPinned)
|
||||
{
|
||||
QList<WebTab*> allTabs;
|
||||
|
@ -84,6 +84,7 @@ public slots:
|
||||
void restoreClosedTab();
|
||||
void restoreAllClosedTabs();
|
||||
void clearClosedTabsList();
|
||||
void aboutToShowClosedTabsMenu();
|
||||
|
||||
void moveAddTabButton(int posX);
|
||||
void showButtons();
|
||||
@ -102,6 +103,7 @@ private:
|
||||
|
||||
bool m_hideTabBarWithOneTab;
|
||||
bool m_dontQuitWithOneTab;
|
||||
bool m_closedInsteadOpened;
|
||||
QUrl m_urlOnNewTab;
|
||||
QupZilla* p_QupZilla;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user