mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Asking whether to close window everytime it makes sense.
- you will be asked even when you have set "Restore session" and you are closing second+ window that won't be restored closes #501
This commit is contained in:
parent
2458cb8469
commit
93507492d8
|
@ -1690,6 +1690,31 @@ void QupZilla::closeEvent(QCloseEvent* event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Settings settings;
|
||||||
|
int afterLaunch = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
|
||||||
|
bool askOnClose = settings.value("Browser-Tabs-Settings/AskOnClosing", true).toBool();
|
||||||
|
|
||||||
|
if (afterLaunch == 3 && mApp->windowCount() == 1) {
|
||||||
|
askOnClose = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (askOnClose && m_tabWidget->count() > 1) {
|
||||||
|
CheckBoxDialog dialog(QDialogButtonBox::Yes | QDialogButtonBox::No, this);
|
||||||
|
dialog.setText(tr("There are still %1 open tabs and your session won't be stored. \nAre you sure to quit QupZilla?").arg(m_tabWidget->count()));
|
||||||
|
dialog.setCheckBoxText(tr("Don't ask again"));
|
||||||
|
dialog.setWindowTitle(tr("There are still open tabs"));
|
||||||
|
dialog.setIcon(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning));
|
||||||
|
|
||||||
|
if (dialog.exec() != QDialog::Accepted) {
|
||||||
|
event->ignore();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dialog.isChecked()) {
|
||||||
|
settings.setValue("Browser-Tabs-Settings/AskOnClosing", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_isClosing = true;
|
m_isClosing = true;
|
||||||
mApp->saveStateSlot();
|
mApp->saveStateSlot();
|
||||||
|
|
||||||
|
@ -1759,9 +1784,6 @@ bool QupZilla::quitApp()
|
||||||
|
|
||||||
if (!mApp->isPrivateSession()) {
|
if (!mApp->isPrivateSession()) {
|
||||||
Settings settings;
|
Settings settings;
|
||||||
int afterLaunch = settings.value("Web-URL-Settings/afterLaunch", 1).toInt();
|
|
||||||
bool askOnClose = settings.value("Browser-Tabs-Settings/AskOnClosing", true).toBool();
|
|
||||||
|
|
||||||
settings.beginGroup("Browser-View-Settings");
|
settings.beginGroup("Browser-View-Settings");
|
||||||
settings.setValue("WindowMaximised", windowState().testFlag(Qt::WindowMaximized));
|
settings.setValue("WindowMaximised", windowState().testFlag(Qt::WindowMaximized));
|
||||||
settings.setValue("WindowGeometry", saveGeometry());
|
settings.setValue("WindowGeometry", saveGeometry());
|
||||||
|
@ -1770,20 +1792,6 @@ bool QupZilla::quitApp()
|
||||||
settings.setValue("SideBarWidth", m_sideBarWidth);
|
settings.setValue("SideBarWidth", m_sideBarWidth);
|
||||||
settings.setValue("WebViewWidth", m_webViewWidth);
|
settings.setValue("WebViewWidth", m_webViewWidth);
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
if (askOnClose && afterLaunch != 3 && m_tabWidget->count() > 1) {
|
|
||||||
CheckBoxDialog dialog(QDialogButtonBox::Yes | QDialogButtonBox::No, this);
|
|
||||||
dialog.setText(tr("There are still %1 open tabs and your session won't be stored. \nAre you sure to quit QupZilla?").arg(m_tabWidget->count()));
|
|
||||||
dialog.setCheckBoxText(tr("Don't ask again"));
|
|
||||||
dialog.setWindowTitle(tr("There are still open tabs"));
|
|
||||||
dialog.setIcon(qIconProvider->standardIcon(QStyle::SP_MessageBoxWarning));
|
|
||||||
if (dialog.exec() != QDialog::Accepted) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (dialog.isChecked()) {
|
|
||||||
settings.setValue("Browser-Tabs-Settings/AskOnClosing", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, mApp, SLOT(quitApplication()));
|
QTimer::singleShot(0, mApp, SLOT(quitApplication()));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user