mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-13 10:32:11 +01:00
BrowserWindow: Always save/restore window geometry
This commit is contained in:
parent
ed39aefdad
commit
423e06c7d6
|
@ -338,37 +338,31 @@ void BrowserWindow::setupUi()
|
||||||
|
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("Browser-View-Settings");
|
settings.beginGroup("Browser-View-Settings");
|
||||||
if (settings.value("WindowMaximised", false).toBool()) {
|
|
||||||
|
// Let the WM decides where to put new browser window
|
||||||
|
if (m_windowType != Qz::BW_FirstAppWindow && m_windowType != Qz::BW_MacFirstWindow && mApp->getWindow()) {
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
// Windows WM places every new window in the middle of screen .. for some reason
|
||||||
|
QPoint p = mApp->getWindow()->geometry().topLeft();
|
||||||
|
p.setX(p.x() + 30);
|
||||||
|
p.setY(p.y() + 30);
|
||||||
|
|
||||||
|
if (!desktop->availableGeometry(mApp->getWindow()).contains(p)) {
|
||||||
|
p.setX(desktop->availableGeometry(mApp->getWindow()).x() + 30);
|
||||||
|
p.setY(desktop->availableGeometry(mApp->getWindow()).y() + 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
setGeometry(QRect(p, mApp->getWindow()->size()));
|
||||||
|
#else
|
||||||
|
resize(mApp->getWindow()->size());
|
||||||
|
#endif
|
||||||
|
} else if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) {
|
||||||
|
#ifdef Q_WS_WIN
|
||||||
|
setGeometry(QRect(desktop->availableGeometry(mApp->getWindow()).x() + 30,
|
||||||
|
desktop->availableGeometry(mApp->getWindow()).y() + 30, windowWidth, windowHeight));
|
||||||
|
#else
|
||||||
resize(windowWidth, windowHeight);
|
resize(windowWidth, windowHeight);
|
||||||
setWindowState(Qt::WindowMaximized);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Let the WM decides where to put new browser window
|
|
||||||
if ((m_windowType != Qz::BW_FirstAppWindow && m_windowType != Qz::BW_MacFirstWindow) && mApp->getWindow()) {
|
|
||||||
#ifdef Q_WS_WIN
|
|
||||||
// Windows WM places every new window in the middle of screen .. for some reason
|
|
||||||
QPoint p = mApp->getWindow()->geometry().topLeft();
|
|
||||||
p.setX(p.x() + 30);
|
|
||||||
p.setY(p.y() + 30);
|
|
||||||
|
|
||||||
if (!desktop->availableGeometry(mApp->getWindow()).contains(p)) {
|
|
||||||
p.setX(desktop->availableGeometry(mApp->getWindow()).x() + 30);
|
|
||||||
p.setY(desktop->availableGeometry(mApp->getWindow()).y() + 30);
|
|
||||||
}
|
|
||||||
|
|
||||||
setGeometry(QRect(p, mApp->getWindow()->size()));
|
|
||||||
#else
|
|
||||||
resize(mApp->getWindow()->size());
|
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
else if (!restoreGeometry(settings.value("WindowGeometry").toByteArray())) {
|
|
||||||
#ifdef Q_WS_WIN
|
|
||||||
setGeometry(QRect(desktop->availableGeometry(mApp->getWindow()).x() + 30,
|
|
||||||
desktop->availableGeometry(mApp->getWindow()).y() + 30, windowWidth, windowHeight));
|
|
||||||
#else
|
|
||||||
resize(windowWidth, windowHeight);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locationBarWidth = settings.value("LocationBarWidth", 480).toInt();
|
locationBarWidth = settings.value("LocationBarWidth", 480).toInt();
|
||||||
|
@ -1507,13 +1501,11 @@ void BrowserWindow::saveSettings()
|
||||||
if (!mApp->isPrivate()) {
|
if (!mApp->isPrivate()) {
|
||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("Browser-View-Settings");
|
settings.beginGroup("Browser-View-Settings");
|
||||||
settings.setValue("WindowMaximised", windowState().testFlag(Qt::WindowMaximized));
|
|
||||||
settings.setValue("LocationBarWidth", m_navigationToolbar->splitter()->sizes().at(0));
|
settings.setValue("LocationBarWidth", m_navigationToolbar->splitter()->sizes().at(0));
|
||||||
settings.setValue("WebSearchBarWidth", m_navigationToolbar->splitter()->sizes().at(1));
|
settings.setValue("WebSearchBarWidth", m_navigationToolbar->splitter()->sizes().at(1));
|
||||||
settings.setValue("SideBarWidth", m_sideBarWidth);
|
settings.setValue("SideBarWidth", m_sideBarWidth);
|
||||||
settings.setValue("WebViewWidth", m_webViewWidth);
|
settings.setValue("WebViewWidth", m_webViewWidth);
|
||||||
if (!isFullScreen())
|
settings.setValue("WindowGeometry", saveGeometry());
|
||||||
settings.setValue("WindowGeometry", saveGeometry());
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user