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 ""
|
msgstr ""
|
||||||
"Project-Id-Version: pantalaimon.thrrgilag\n"
|
"Project-Id-Version: pantalaimon.thrrgilag\n"
|
||||||
"Report-Msgid-Bugs-To: \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"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -71,50 +71,50 @@ msgid ""
|
||||||
"'True'."
|
"'True'."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:17
|
#: ../qml/SettingsPage.qml:18
|
||||||
msgid "warning"
|
msgid "warning"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:18
|
#: ../qml/SettingsPage.qml:19
|
||||||
msgid "info"
|
msgid "info"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:19
|
#: ../qml/SettingsPage.qml:20
|
||||||
msgid "debug"
|
msgid "debug"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:20
|
#: ../qml/SettingsPage.qml:21
|
||||||
msgid "error"
|
msgid "error"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:25 pantalaimon.desktop.in.h:1
|
#: ../qml/SettingsPage.qml:26 pantalaimon.desktop.in.h:1
|
||||||
msgid "Pantalaimon UT"
|
msgid "Pantalaimon UT"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:30
|
#: ../qml/SettingsPage.qml:31
|
||||||
msgid "About"
|
msgid "About"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:45
|
#: ../qml/SettingsPage.qml:46
|
||||||
msgid "Service start disabled"
|
msgid "Service start disabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:45
|
#: ../qml/SettingsPage.qml:46
|
||||||
msgid "Service start enabled"
|
msgid "Service start enabled"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:92
|
#: ../qml/SettingsPage.qml:93
|
||||||
msgid "LogLevel"
|
msgid "LogLevel"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:144
|
#: ../qml/SettingsPage.qml:148
|
||||||
msgid "Delete homeserver"
|
msgid "Delete homeserver"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:162
|
#: ../qml/SettingsPage.qml:166
|
||||||
msgid "No homeservers"
|
msgid "No homeservers"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../qml/SettingsPage.qml:222
|
#: ../qml/SettingsPage.qml:227
|
||||||
msgid "Add Homeserver"
|
msgid "Add Homeserver"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -12,6 +12,7 @@ Page {
|
||||||
property bool is_running: false
|
property bool is_running: false
|
||||||
property bool upstart: false
|
property bool upstart: false
|
||||||
property string status_msg
|
property string status_msg
|
||||||
|
property int loglevel_idx
|
||||||
|
|
||||||
property var loglevels: [
|
property var loglevels: [
|
||||||
i18n.tr("warning"),
|
i18n.tr("warning"),
|
||||||
|
@ -94,6 +95,7 @@ Page {
|
||||||
model: loglevels
|
model: loglevels
|
||||||
containerHeight: itemHeight * 6
|
containerHeight: itemHeight * 6
|
||||||
onDelegateClicked: {
|
onDelegateClicked: {
|
||||||
|
loglevel_idx = index;
|
||||||
saveConfig();
|
saveConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,6 +178,7 @@ Page {
|
||||||
console.log('DEBUG: ' + JSON.stringify(result));
|
console.log('DEBUG: ' + JSON.stringify(result));
|
||||||
var defaults = result[0];
|
var defaults = result[0];
|
||||||
loglevel.selectedIndex = defaults.loglevel_idx;
|
loglevel.selectedIndex = defaults.loglevel_idx;
|
||||||
|
loglevel_idx = defaults.loglevel_idx;
|
||||||
var data = result[1];
|
var data = result[1];
|
||||||
for (var i=0; i<data.length; i++) {
|
for (var i=0; i<data.length; i++) {
|
||||||
listModel.append(data[i]);
|
listModel.append(data[i]);
|
||||||
|
@ -198,7 +201,7 @@ Page {
|
||||||
lmdata.push(listModel.get(i));
|
lmdata.push(listModel.get(i));
|
||||||
}
|
}
|
||||||
var defaults = {
|
var defaults = {
|
||||||
'loglevel': loglevels[loglevel.selectedIndex]
|
'loglevel': loglevels[loglevel_idx]
|
||||||
}
|
}
|
||||||
py.call("config.save", [JSON.stringify(defaults), JSON.stringify(lmdata)], function(result) {});
|
py.call("config.save", [JSON.stringify(defaults), JSON.stringify(lmdata)], function(result) {});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue