Commit 8d850b39 authored by Dimitris Kardarakos's avatar Dimitris Kardarakos
Browse files

Directly apply configuration

When a configuration option is changed on the settings page, the new configuration is immediately applied. On application quit, the config file is updated as well.
parent 220d3bea
Pipeline #51922 passed with stage
in 6 minutes and 10 seconds
......@@ -76,6 +76,8 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty(QStringLiteral("_settings"), &settings);
QObject::connect(&app, &QCoreApplication::aboutToQuit, &settings, &AlligatorSettings::save);
Database::instance();
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
......
......@@ -13,7 +13,6 @@ import org.kde.kirigami 2.12 as Kirigami
Kirigami.ScrollablePage {
title: i18n("Settings")
Kirigami.FormLayout {
Kirigami.Heading {
......@@ -28,12 +27,16 @@ Kirigami.ScrollablePage {
id: deleteAfterCount
value: _settings.deleteAfterCount
enabled: deleteAfterType.currentIndex !== 0
onValueModified: _settings.deleteAfterCount = value
}
Controls.ComboBox {
id: deleteAfterType
currentIndex: _settings.deleteAfterType
model: [i18n("Never"), i18n("Articles"), i18n("Days"), i18n("Weeks"), i18n("Months")]
onActivated: _settings.deleteAfterType = index
}
}
......@@ -50,24 +53,18 @@ Kirigami.ScrollablePage {
Kirigami.FormData.label: i18n("Font size:")
from: 6
to: 20
onValueModified: _settings.articleFontSize = value
}
Controls.CheckBox {
id: useSystemFontCheckBox
checked: _settings.articleFontUseSystem
text: i18n("Use system default")
}
Controls.Button {
text: i18n("Save")
onClicked: {
_settings.deleteAfterCount = deleteAfterCount.value
_settings.deleteAfterType = deleteAfterType.currentIndex
_settings.articleFontSize = articleFontSizeSpinBox.value
_settings.articleFontUseSystem = useSystemFontCheckBox.checked
_settings.save()
pageStack.pop()
}
onToggled: _settings.articleFontUseSystem = checked
}
}
}
Supports Markdown
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