Verified Commit 840e1b1c authored by ivan tkachenko's avatar ivan tkachenko
Browse files

[applet] Replace == equality with strict === equality in JavaScript

Avoid sloppy implicit type casts and slightly speed up the process.
parent 394127af
......@@ -11,10 +11,10 @@ import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PlasmaComponents3
MouseArea {
readonly property bool inPanel: (plasmoid.location == PlasmaCore.Types.TopEdge
|| plasmoid.location == PlasmaCore.Types.RightEdge
|| plasmoid.location == PlasmaCore.Types.BottomEdge
|| plasmoid.location == PlasmaCore.Types.LeftEdge)
readonly property bool inPanel: (plasmoid.location === PlasmaCore.Types.TopEdge
|| plasmoid.location === PlasmaCore.Types.RightEdge
|| plasmoid.location === PlasmaCore.Types.BottomEdge
|| plasmoid.location === PlasmaCore.Types.LeftEdge)
Layout.maximumWidth: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
Layout.maximumHeight: inPanel ? PlasmaCore.Units.iconSizeHints.panel : -1
......
......@@ -66,7 +66,7 @@ PlasmaExtras.ExpandableListItem {
id: browseFilesButton
text: i18n("Browse Files")
icon.name: "folder"
visible: Uuids.indexOf(BluezQt.Services.ObexFileTransfer) != -1
visible: Uuids.indexOf(BluezQt.Services.ObexFileTransfer) !== -1
onClicked: {
var url = "obexftp://%1/".arg(Address.replace(/:/g, "-"));
......@@ -78,7 +78,7 @@ PlasmaExtras.ExpandableListItem {
id: sendFileButton
text: i18n("Send File")
icon.name: "folder-download"
visible: Uuids.indexOf(BluezQt.Services.ObexObjectPush) != -1
visible: Uuids.indexOf(BluezQt.Services.ObexObjectPush) !== -1
onClicked: {
PlasmaBt.LaunchApp.runCommand("bluedevil-sendfile", ["-u", Ubi]);
......@@ -186,12 +186,12 @@ PlasmaExtras.ExpandableListItem {
property QtObject __dev
readonly property QtObject dev : Device
onDevChanged: {
if (__dev == dev) {
if (__dev === dev) {
return;
}
__dev = dev;
if (expandedView.status == Component.Ready) {
if (expandedView.status === Component.Ready) {
expandableListItem.collapse()
expandableListItem.ListView.view.currentIndex = -1
}
......@@ -208,7 +208,7 @@ PlasmaExtras.ExpandableListItem {
function adapterName(a)
{
var hci = devicesModel.adapterHciString(a.ubi);
if (hci != "") {
if (hci !== "") {
return "%1 (%2)".arg(a.name).arg(hci);
}
return a.name;
......@@ -217,7 +217,7 @@ PlasmaExtras.ExpandableListItem {
function createContent() {
var details = [];
if (Name != RemoteName) {
if (Name !== RemoteName) {
details.push(i18n("Remote Name"));
details.push(RemoteName);
}
......@@ -270,19 +270,19 @@ PlasmaExtras.ExpandableListItem {
default:
var profiles = [];
if (Uuids.indexOf(BluezQt.Services.ObexFileTransfer) != -1) {
if (Uuids.indexOf(BluezQt.Services.ObexFileTransfer) !== -1) {
profiles.push(i18n("File transfer"));
}
if (Uuids.indexOf(BluezQt.Services.ObexObjectPush) != -1) {
if (Uuids.indexOf(BluezQt.Services.ObexObjectPush) !== -1) {
profiles.push(i18n("Send file"));
}
if (Uuids.indexOf(BluezQt.Services.HumanInterfaceDevice) != -1) {
if (Uuids.indexOf(BluezQt.Services.HumanInterfaceDevice) !== -1) {
profiles.push(i18n("Input"));
}
if (Uuids.indexOf(BluezQt.Services.AdvancedAudioDistribution) != -1) {
if (Uuids.indexOf(BluezQt.Services.AdvancedAudioDistribution) !== -1) {
profiles.push(i18n("Audio"));
}
if (Uuids.indexOf(BluezQt.Services.Nap) != -1) {
if (Uuids.indexOf(BluezQt.Services.Nap) !== -1) {
profiles.push(i18n("Network"));
}
......@@ -333,7 +333,7 @@ PlasmaExtras.ExpandableListItem {
switch (call.error) {
case BluezQt.PendingCall.Failed:
if (call.errorText == "Host is down") {
if (call.errorText === "Host is down") {
text = i18nc("Notification when the connection failed due to Failed:HostIsDown",
"The device is unreachable");
} else {
......
......@@ -79,7 +79,7 @@ PlasmaExtras.Representation {
// group because it's unnecessary; all we want to do here is
// separate the connected devices from the available ones
section.delegate: Loader {
active: section != "Connected" && Logic.conectedDevicesCount() > 0
active: section !== "Connected" && Logic.conectedDevicesCount() > 0
// Need to manually set the height or else the loader takes up
// space after the first time it unloads a previously-loaded item
height: active ? PlasmaCore.Units.gridUnit : 0
......
......@@ -20,7 +20,7 @@ ColumnLayout {
Layout.fillWidth: true
elide: Text.ElideRight
font.weight: MediaPlayer && MediaPlayer.track.title ? Font.DemiBold : Font.Normal
font.italic: MediaPlayer && MediaPlayer.status == BluezQt.MediaPlayer.Playing
font.italic: MediaPlayer && MediaPlayer.status === BluezQt.MediaPlayer.Playing
font.pointSize: PlasmaCore.Theme.smallestFont.pointSize
font.family: PlasmaCore.Theme.smallestFont.family
opacity: 0.6
......@@ -71,7 +71,7 @@ ColumnLayout {
PlasmaComponents3.ToolButton {
id: stopButton
icon.name: "media-playback-stop"
enabled: MediaPlayer && MediaPlayer.status != BluezQt.MediaPlayer.Stopped
enabled: MediaPlayer && MediaPlayer.status !== BluezQt.MediaPlayer.Stopped
onClicked: MediaPlayer.stop()
}
......@@ -92,7 +92,7 @@ ColumnLayout {
var play = "\u25B6";
if (MediaPlayer.status == BluezQt.MediaPlayer.Playing) {
if (MediaPlayer.status === BluezQt.MediaPlayer.Playing) {
return "%1 %2".arg(play).arg(MediaPlayer.track.title);
}
return MediaPlayer.track.title;
......@@ -104,7 +104,7 @@ ColumnLayout {
return "";
}
if (MediaPlayer.status != BluezQt.MediaPlayer.Playing) {
if (MediaPlayer.status !== BluezQt.MediaPlayer.Playing) {
return "media-playback-start";
} else {
return "media-playback-pause";
......@@ -113,7 +113,7 @@ ColumnLayout {
function playPauseButtonClicked()
{
if (MediaPlayer.status != BluezQt.MediaPlayer.Playing) {
if (MediaPlayer.status !== BluezQt.MediaPlayer.Playing) {
MediaPlayer.play()
} else {
MediaPlayer.pause()
......
......@@ -37,7 +37,7 @@ function updateStatus()
} else {
text = i18n("Bluetooth is offline");
}
} else if (connectedDevices.length == 1) {
} else if (connectedDevices.length === 1) {
text = i18n("%1 connected", connectedDevices[0].name);
} else if (connectedDevices.length > 1) {
text = i18ncp("Number of connected devices", "%1 connected device", "%1 connected devices", connectedDevices.length);
......
......@@ -66,7 +66,7 @@ SimpleKCM {
Kirigami.FormData.label: i18n("On login:")
text: i18n("Enable Bluetooth")
QQC2.ButtonGroup.group: loginStateRadioGroup
checked: kcm.bluetoothStatusAtLogin == "enable"
checked: kcm.bluetoothStatusAtLogin === "enable"
onToggled: {
if (enabled) {
kcm.bluetoothStatusAtLogin = "enable";
......@@ -76,7 +76,7 @@ SimpleKCM {
QQC2.RadioButton {
text: i18n("Disable Bluetooth")
QQC2.ButtonGroup.group: loginStateRadioGroup
checked: kcm.bluetoothStatusAtLogin == "disable"
checked: kcm.bluetoothStatusAtLogin === "disable"
onToggled: {
if (enabled) {
kcm.bluetoothStatusAtLogin = "disable"
......@@ -86,7 +86,7 @@ SimpleKCM {
QQC2.RadioButton {
text: i18n("Remember previous status")
QQC2.ButtonGroup.group: loginStateRadioGroup
checked: kcm.bluetoothStatusAtLogin == "remember"
checked: kcm.bluetoothStatusAtLogin === "remember"
onToggled: {
if (enabled) {
kcm.bluetoothStatusAtLogin = "remember"
......@@ -104,7 +104,7 @@ SimpleKCM {
QQC2.RadioButton {
Kirigami.FormData.label: i18n("When receiving files:")
checked: FileReceiverSettings.autoAccept == 0
checked: FileReceiverSettings.autoAccept === 0
text: i18n("Ask for confirmation")
QQC2.ButtonGroup.group: receivingFilesRadioGroup
onClicked: {
......@@ -115,7 +115,7 @@ SimpleKCM {
QQC2.RadioButton {
text: i18n("Accept for trusted devices")
checked: FileReceiverSettings.autoAccept == 1
checked: FileReceiverSettings.autoAccept === 1
QQC2.ButtonGroup.group: receivingFilesRadioGroup
onClicked: {
FileReceiverSettings.autoAccept = 1
......@@ -126,7 +126,7 @@ SimpleKCM {
QQC2.RadioButton {
text: i18n("Always accept")
QQC2.ButtonGroup.group: receivingFilesRadioGroup
checked: FileReceiverSettings.autoAccept == 2
checked: FileReceiverSettings.autoAccept === 2
onClicked: {
FileReceiverSettings.autoAccept = 2
FileReceiverSettings.save()
......
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