[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] plasma/generic/applets/batterymonitor/contents/ui: Use typeof string intead of !== u
From:       Kai Uwe Broulik <kde () privat ! broulik ! de>
Date:       2013-07-07 19:34:01
Message-ID: E1Uvuif-0001v4-QA () scm ! kde ! org
[Download RAW message or body]

Git commit 4c2fda8ea42ad3ca742af3b82517bbcb730393c1 by Kai Uwe Broulik.
Committed on 07/07/2013 at 19:33.
Pushed by broulik into branch 'master'.

Use typeof string intead of !== undefined to check whether those properties are \
availble. My JavaScript is a bit rusty ;)

M  +3    -3    plasma/generic/applets/batterymonitor/contents/ui/BatteryItem.qml

http://commits.kde.org/kde-workspace/4c2fda8ea42ad3ca742af3b82517bbcb730393c1

diff --git a/plasma/generic/applets/batterymonitor/contents/ui/BatteryItem.qml \
b/plasma/generic/applets/batterymonitor/contents/ui/BatteryItem.qml index \
                705640f..9bc9522 100644
--- a/plasma/generic/applets/batterymonitor/contents/ui/BatteryItem.qml
+++ b/plasma/generic/applets/batterymonitor/contents/ui/BatteryItem.qml
@@ -285,7 +285,7 @@ Item {
                     width: parent.width
                     elide: Text.ElideRight
                     text: i18nc("Placeholder is battery capacity", "%1%", \
                model["Capacity"])
-                    visible: model["Is Power Supply"] &&  model["Capacity"] != "" && \
model["Capacity"] !== undefined +                    visible: model["Is Power \
Supply"] &&  model["Capacity"] != "" && typeof model["Capacity"] == 'number'  \
font.pointSize: theme.smallestFont.pointSize  color: \
"#99"+(theme.textColor.toString().substr(1))  }
@@ -295,7 +295,7 @@ Item {
                     width: parent.width
                     elide: Text.ElideRight
                     text: model["Vendor"]
-                    visible: model["Vendor"] != "" && model["Vendor"] !== undefined
+                    visible: model["Vendor"] != "" && typeof model["Vendor"] == \
'string'  font.pointSize: theme.smallestFont.pointSize
                     color: "#99"+(theme.textColor.toString().substr(1))
                 }
@@ -305,7 +305,7 @@ Item {
                     width: parent.width
                     elide: Text.ElideRight
                     text: model["Product"]
-                    visible: model["Product"] != "" && model["Product"] !== \
undefined +                    visible: model["Product"] != "" && typeof \
model["Product"] == 'string'  font.pointSize: theme.smallestFont.pointSize
                     color: "#99"+(theme.textColor.toString().substr(1))
                 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic