Verified Commit 93221d0e authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Store window dimensions using KConfig

parent 0f979b4e
......@@ -7,7 +7,7 @@
<include>"settingshelper.h"</include>
<group name="SettingsPage">
<!-- The custom search engine that can be added to the list of engines -->
<entry key="searchCustomUrl" type="string"></entry>
<entry key="searchCustomUrl" type="string" />
</group>
<group name="Browser">
<entry key="homepage" type="string">
......@@ -44,4 +44,14 @@
</entry>
<entry key="navBarContextMenu" type="bool"></entry>
</group>
<group name="Window">
<entry key="windowX" type="int" />
<entry key="windowY" type="int" />
<entry key="windowWidth" type="int">
<default>300</default>
</entry>
<entry key="windowHeight" type="int">
<default>450</default>
</entry>
</group>
</kcfg>
......@@ -99,7 +99,7 @@ WebEngineView {
settings {
autoLoadImages: Settings.webAutoLoadImages
javascriptEnabled: Settings.webJavascriptEnabled
javascriptEnabled: Settings.webJavaScriptEnabled
// Disable builtin error pages in favor of our own
errorPageEnabled: false
// Load larger touch icons
......
......@@ -23,12 +23,11 @@ import QtQuick 2.1
import QtWebEngine 1.6
import QtQuick.Window 2.3
import QtGraphicalEffects 1.0
import Qt.labs.settings 1.0 as QtSettings
import QtQuick.Layouts 1.2
import org.kde.kirigami 2.7 as Kirigami
import org.kde.mobile.angelfish 1.0
import QtQuick.Layouts 1.2
import org.kde.mobile.angelfish 1.0
Kirigami.ApplicationWindow {
id: webBrowser
......@@ -56,8 +55,10 @@ Kirigami.ApplicationWindow {
property int borderWidth: Math.round(Kirigami.Units.gridUnit / 18);
property color borderColor: Kirigami.Theme.highlightColor;
width: Kirigami.Units.gridUnit * 20
height: Kirigami.Units.gridUnit * 30
x: Settings.windowX
y: Settings.windowY
width: Settings.windowWidth
height: Settings.windowHeight
pageStack.globalToolBar.showNavigationButtons: {
if (pageStack.depth <= 1)
......@@ -419,15 +420,15 @@ Kirigami.ApplicationWindow {
}
}
QtSettings.Settings {
// kept separate to simplify definition of aliases
property alias x: webBrowser.x
property alias y: webBrowser.y
property alias width: webBrowser.width
property alias height: webBrowser.height
}
// Store window dimensions
Component.onCompleted: {
rootPage.initialized = true
Component.onCompleted: rootPage.initialized = true
Settings.windowX = Qt.binding(function() {return webBrowser.x})
Settings.windowY = Qt.binding(function() {return webBrowser.y})
Settings.windowWidth = Qt.binding(function() {return webBrowser.width})
Settings.windowHeight = Qt.binding(function() {return webBrowser.height})
}
function popSubPages() {
while (webBrowser.pageStack.depth > 1)
......
......@@ -32,6 +32,8 @@ SettingsHelper *SettingsHelper::instance()
}
SettingsHelper::SettingsHelper()
: m_isMobile(qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE")
? QByteArrayList{"1", "true"}.contains(qgetenv("QT_QUICK_CONTROLS_MOBILE"))
: false)
{
m_isMobile = qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE") ? QByteArrayList{"1", "true"}.contains(qgetenv("QT_QUICK_CONTROLS_MOBILE")) : false;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment