mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 04:36:34 +01:00
Don't quit upon closing last tab option
This commit is contained in:
parent
0aeead3825
commit
7a5af39981
@ -191,6 +191,7 @@ Preferences::Preferences(QupZilla* mainClass, QWidget* parent)
|
||||
ui->makeMovable->setChecked(settings.value("makeTabsMovable", true).toBool());
|
||||
ui->hideTabsOnTab->setChecked(settings.value("hideTabsWithOneTab", false).toBool());
|
||||
ui->activateLastTab->setChecked(settings.value("ActivateLastTabWhenClosingActual", false).toBool());
|
||||
ui->dontQuitOnTab->setChecked(settings.value("dontQuitWithOneTab", false).toBool());
|
||||
ui->askWhenClosingMultipleTabs->setChecked(settings.value("AskOnClosing", false).toBool());
|
||||
settings.endGroup();
|
||||
//AddressBar
|
||||
@ -680,6 +681,7 @@ void Preferences::saveSettings()
|
||||
settings.setValue("makeTabsMovable", ui->makeMovable->isChecked());
|
||||
settings.setValue("hideTabsWithOneTab", ui->hideTabsOnTab->isChecked());
|
||||
settings.setValue("ActivateLastTabWhenClosingActual", ui->activateLastTab->isChecked());
|
||||
settings.setValue("dontQuitWithOneTab", ui->dontQuitOnTab->isChecked());
|
||||
settings.setValue("AskOnClosing", ui->askWhenClosingMultipleTabs->isChecked());
|
||||
settings.endGroup();
|
||||
|
||||
|
@ -182,7 +182,7 @@
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="stackedWidgetPage1">
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
@ -635,6 +635,74 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="hideTabsOnTab">
|
||||
<property name="text">
|
||||
<string>Hide tabs when there is only one tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" 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">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" 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">
|
||||
<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">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QCheckBox" name="askWhenClosingMultipleTabs">
|
||||
<property name="text">
|
||||
<string>Ask when closing multiple tabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="selectAllOnClick">
|
||||
<property name="text">
|
||||
<string>Select all text by clicking in address bar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
@ -648,78 +716,17 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="2" column="1" colspan="2">
|
||||
<widget class="QCheckBox" name="hideTabsOnTab">
|
||||
<property name="text">
|
||||
<string>Hide tabs when there is only one tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" 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="7" 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="9" 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="10" column="1">
|
||||
<spacer name="verticalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="activateLastTab">
|
||||
<property name="text">
|
||||
<string>Activate last tab when closing active tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QCheckBox" name="askWhenClosingMultipleTabs">
|
||||
<item row="5" column="1">
|
||||
<widget class="QCheckBox" name="dontQuitOnTab">
|
||||
<property name="text">
|
||||
<string>Ask when closing multiple tabs</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="3">
|
||||
<widget class="QCheckBox" name="selectAllOnClick">
|
||||
<property name="text">
|
||||
<string>Select all text by clicking in address bar</string>
|
||||
<string>Don't quit upon closing last tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2005,7 +2012,6 @@
|
||||
<tabstop>tabWidget_2</tabstop>
|
||||
<tabstop>makeMovable</tabstop>
|
||||
<tabstop>hideTabsOnTab</tabstop>
|
||||
<tabstop>activateLastTab</tabstop>
|
||||
<tabstop>askWhenClosingMultipleTabs</tabstop>
|
||||
<tabstop>selectAllOnFocus</tabstop>
|
||||
<tabstop>selectAllOnClick</tabstop>
|
||||
|
@ -152,6 +152,7 @@ void TabWidget::loadSettings()
|
||||
Settings settings;
|
||||
settings.beginGroup("Browser-Tabs-Settings");
|
||||
m_hideTabBarWithOneTab = settings.value("hideTabsWithOneTab", false).toBool();
|
||||
m_dontQuitWithOneTab = settings.value("dontQuitWithOneTab", false).toBool();
|
||||
settings.endGroup();
|
||||
settings.beginGroup("Web-URL-Settings");
|
||||
m_urlOnNewTab = settings.value("newTabUrl", "qupzilla:speeddial").toUrl();
|
||||
@ -329,13 +330,22 @@ void TabWidget::setTabText(int index, const QString &text)
|
||||
|
||||
void TabWidget::closeTab(int index)
|
||||
{
|
||||
if (count() == 1) {
|
||||
p_QupZilla->close();
|
||||
}
|
||||
if (index == -1) {
|
||||
index = currentIndex();
|
||||
}
|
||||
|
||||
if (count() == 1) {
|
||||
if (m_dontQuitWithOneTab) {
|
||||
weView(index)->load(m_urlOnNewTab);
|
||||
weView(index)->page()->history()->clear();
|
||||
return;
|
||||
}
|
||||
else {
|
||||
p_QupZilla->close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
WebView* webView = weView(index);
|
||||
WebPage* webPage = webView->webPage();
|
||||
WebTab* webTab = webView->webTab();
|
||||
|
@ -102,6 +102,7 @@ private:
|
||||
inline WebView* weView(int index) { WebTab* webTab = qobject_cast<WebTab*>(widget(index)); if (!webTab) return 0; return webTab->view(); }
|
||||
|
||||
bool m_hideTabBarWithOneTab;
|
||||
bool m_dontQuitWithOneTab;
|
||||
QUrl m_urlOnNewTab;
|
||||
QupZilla* p_QupZilla;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user