diff options
author | kali kaneko (leap communications) <kali@leap.se> | 2021-12-08 18:31:20 +0100 |
---|---|---|
committer | kali kaneko (leap communications) <kali@leap.se> | 2021-12-08 19:54:17 +0100 |
commit | e5c9f5ae9b892af8eac28bdbd6231e47ce917214 (patch) | |
tree | 1f06da55cfcbc414d14a6d047ad4d0073bbcca50 /gui/components/Splash.qml | |
parent | 6ad6c1f6ae54c4b8ed6cf7d2c2fb236fd2c52084 (diff) |
[ui] fix check for empty motd
isEmpty was not enough, have to go to .txt field
Diffstat (limited to 'gui/components/Splash.qml')
-rw-r--r-- | gui/components/Splash.qml | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/gui/components/Splash.qml b/gui/components/Splash.qml index dfdd622..1bbb412 100644 --- a/gui/components/Splash.qml +++ b/gui/components/Splash.qml @@ -55,7 +55,7 @@ Page { id: connectionImage height: 180 anchors.horizontalCenter: parent.horizontalCenter - source: "../resources/icon-noshield.svg" + source: customTheme.iconSplash fillMode: Image.PreserveAspectFit } @@ -93,7 +93,7 @@ Page { } function hasMotd() { - return needsUpgrade() || (ctx && !isEmpty(ctx.motd)) + return needsUpgrade() || (ctx && !isEmptyMotd(ctx.motd)) } function getUpgradeText() { @@ -126,6 +126,8 @@ Page { function showMotd() { // XXX this is not picking locales configured by LANG or LC_ALL + // Need to fix this; probably also with allowing to select translation + // manually on runtime. let isUpgrade = false let lang = Qt.locale().name.substring(0,2) let messages = JSON.parse(ctx.motd) @@ -221,7 +223,16 @@ Page { } function isEmpty(val) { - return val == ""; + return val.length == 0; + } + + function isEmptyMotd(motd) { + let m = JSON.parse(motd) + let first = m[0] + if (first == undefined) { + return true + } + return isEmpty(first.txt) } } |