fix loglevel setting on save
selectedIndex doesn't actually change until after onDelegateClicked completes, which results in the previous value being saved rather than the desired one. This correctly handles the change in setting.
This commit is contained in:
parent
2f68728ea9
commit
48de066938
2 changed files with 17 additions and 14 deletions
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: pantalaimon.thrrgilag\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2020-09-08 03:23+0000\n"
|
||||
"POT-Creation-Date: 2020-09-08 03:47+0000\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -71,50 +71,50 @@ msgid ""
|
|||
"'True'."
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:17
|
||||
#: ../qml/SettingsPage.qml:18
|
||||
msgid "warning"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:18
|
||||
#: ../qml/SettingsPage.qml:19
|
||||
msgid "info"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:19
|
||||
#: ../qml/SettingsPage.qml:20
|
||||
msgid "debug"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:20
|
||||
#: ../qml/SettingsPage.qml:21
|
||||
msgid "error"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:25 pantalaimon.desktop.in.h:1
|
||||
#: ../qml/SettingsPage.qml:26 pantalaimon.desktop.in.h:1
|
||||
msgid "Pantalaimon UT"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:30
|
||||
#: ../qml/SettingsPage.qml:31
|
||||
msgid "About"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:45
|
||||
#: ../qml/SettingsPage.qml:46
|
||||
msgid "Service start disabled"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:45
|
||||
#: ../qml/SettingsPage.qml:46
|
||||
msgid "Service start enabled"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:92
|
||||
#: ../qml/SettingsPage.qml:93
|
||||
msgid "LogLevel"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:144
|
||||
#: ../qml/SettingsPage.qml:148
|
||||
msgid "Delete homeserver"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:162
|
||||
#: ../qml/SettingsPage.qml:166
|
||||
msgid "No homeservers"
|
||||
msgstr ""
|
||||
|
||||
#: ../qml/SettingsPage.qml:222
|
||||
#: ../qml/SettingsPage.qml:227
|
||||
msgid "Add Homeserver"
|
||||
msgstr ""
|
||||
|
|
|
@ -12,6 +12,7 @@ Page {
|
|||
property bool is_running: false
|
||||
property bool upstart: false
|
||||
property string status_msg
|
||||
property int loglevel_idx
|
||||
|
||||
property var loglevels: [
|
||||
i18n.tr("warning"),
|
||||
|
@ -94,6 +95,7 @@ Page {
|
|||
model: loglevels
|
||||
containerHeight: itemHeight * 6
|
||||
onDelegateClicked: {
|
||||
loglevel_idx = index;
|
||||
saveConfig();
|
||||
}
|
||||
}
|
||||
|
@ -176,6 +178,7 @@ Page {
|
|||
console.log('DEBUG: ' + JSON.stringify(result));
|
||||
var defaults = result[0];
|
||||
loglevel.selectedIndex = defaults.loglevel_idx;
|
||||
loglevel_idx = defaults.loglevel_idx;
|
||||
var data = result[1];
|
||||
for (var i=0; i<data.length; i++) {
|
||||
listModel.append(data[i]);
|
||||
|
@ -198,7 +201,7 @@ Page {
|
|||
lmdata.push(listModel.get(i));
|
||||
}
|
||||
var defaults = {
|
||||
'loglevel': loglevels[loglevel.selectedIndex]
|
||||
'loglevel': loglevels[loglevel_idx]
|
||||
}
|
||||
py.call("config.save", [JSON.stringify(defaults), JSON.stringify(lmdata)], function(result) {});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue