1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Updated behaviour with closing window

This commit is contained in:
nowrep 2011-03-05 10:57:36 +01:00
parent 66c67551c6
commit 9c24e291aa
2 changed files with 6 additions and 17 deletions

View File

@ -67,7 +67,7 @@ public:
inline QString getActiveLanguage() { return m_activeLanguage; } inline QString getActiveLanguage() { return m_activeLanguage; }
inline bool isClosing() { return m_isClosing; } inline bool isClosing() { return m_isClosing; }
inline bool isExited() { return m_isExited; } inline bool isExited() { return m_isExited; }
inline int windowCount() { return m_mainWindows.count(); }
bool checkProfileDir(); bool checkProfileDir();
QupZilla* getWindow(); QupZilla* getWindow();

View File

@ -59,6 +59,7 @@ QupZilla::QupZilla(bool tryRestore, QUrl startUrl) :
,m_webInspectorDock(0) ,m_webInspectorDock(0)
,m_webSearchToolbar(0) ,m_webSearchToolbar(0)
{ {
setAttribute(Qt::WA_DeleteOnClose);
this->resize(640,480); this->resize(640,480);
this->setWindowState(Qt::WindowMaximized); this->setWindowState(Qt::WindowMaximized);
this->setWindowTitle("QupZilla"); this->setWindowTitle("QupZilla");
@ -653,25 +654,13 @@ void QupZilla::closeEvent(QCloseEvent* event)
{ {
if (mApp->isClosing()) if (mApp->isClosing())
return; return;
if (mApp->windowCount() == 1) {
QSettings settings(m_activeProfil+"settings.ini", QSettings::IniFormat); quitApp();
settings.beginGroup("Web-URL-Settings"); return;
if (settings.value("afterLaunch",0).toInt()!=2 && m_tabWidget->count()>1) {
QMessageBox::StandardButton button = QMessageBox::warning(this, tr("There are still open tabs"),
tr("There are still %1 open tabs and your session won't be stored. Are you sure to quit?").arg(m_tabWidget->count()), QMessageBox::Yes | QMessageBox::No);
if (button != QMessageBox::Yes) {
event->ignore();
return;
}
} }
settings.endGroup();
mApp->cookieJar()->saveCookies();
mApp->saveStateSlot();
mApp->aboutToCloseWindow(this); mApp->aboutToCloseWindow(this);
mApp->saveStateSlot();
this->~QupZilla();
event->accept(); event->accept();
} }