Replace all ==/!= by ===/!==
This commit is contained in:
parent
3b78d12f9c
commit
13d3f19997
3
TODO.md
3
TODO.md
|
@ -23,13 +23,12 @@
|
||||||
- EventFile & Downloading (right click on media > save as...)
|
- EventFile & Downloading (right click on media > save as...)
|
||||||
|
|
||||||
- Refactoring
|
- Refactoring
|
||||||
- Replace all the `==` by `===`
|
|
||||||
- Use a singleton for utils.js
|
- Use a singleton for utils.js
|
||||||
- Use HBox for Profile
|
- Use HBox for Profile
|
||||||
- Banners
|
- Banners
|
||||||
- Composer
|
- Composer
|
||||||
|
|
||||||
- Room Sidepane save/load size
|
- Room Sidepane save/load size & keybinds
|
||||||
|
|
||||||
- Fixes
|
- Fixes
|
||||||
- Pausing uploads doesn't work well with matrix.org
|
- Pausing uploads doesn't work well with matrix.org
|
||||||
|
|
|
@ -61,10 +61,10 @@ Rectangle {
|
||||||
text: modelData.text
|
text: modelData.text
|
||||||
icon.name: modelData.iconName || ""
|
icon.name: modelData.iconName || ""
|
||||||
icon.color: modelData.iconColor || (
|
icon.color: modelData.iconColor || (
|
||||||
name == "ok" || name == "apply" || name == "retry" ?
|
name === "ok" || name === "apply" || name === "retry" ?
|
||||||
theme.colors.positiveBackground :
|
theme.colors.positiveBackground :
|
||||||
|
|
||||||
name == "cancel" ?
|
name === "cancel" ?
|
||||||
theme.colors.negativeBackground :
|
theme.colors.negativeBackground :
|
||||||
|
|
||||||
theme.icons.colorize
|
theme.icons.colorize
|
||||||
|
@ -90,7 +90,7 @@ Rectangle {
|
||||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
if (name == focusButton) forceActiveFocus()
|
if (name === focusButton) forceActiveFocus()
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: theme.baseElementsHeight
|
Layout.preferredHeight: theme.baseElementsHeight
|
||||||
|
|
|
@ -52,7 +52,7 @@ Image {
|
||||||
parent.height - theme.spacing * 2,
|
parent.height - theme.spacing * 2,
|
||||||
theme.controls.image.maxPauseIndicatorSize,
|
theme.controls.image.maxPauseIndicatorSize,
|
||||||
)
|
)
|
||||||
scale: parent.status == Image.Ready && parent.paused ? 1 : 0
|
scale: parent.status === Image.Ready && parent.paused ? 1 : 0
|
||||||
|
|
||||||
Behavior on scale { HScaleAnimator { overshoot: 4 } }
|
Behavior on scale { HScaleAnimator { overshoot: 4 } }
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,5 +10,5 @@ Label {
|
||||||
color: theme.colors.text
|
color: theme.colors.text
|
||||||
linkColor: theme.colors.link
|
linkColor: theme.colors.link
|
||||||
|
|
||||||
maximumLineCount: elide == Label.ElideNone ? Number.MAX_VALUE : 1
|
maximumLineCount: elide === Label.ElideNone ? Number.MAX_VALUE : 1
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ JsonListModel {
|
||||||
let obj = JSON.parse(JSON.stringify(item))
|
let obj = JSON.parse(JSON.stringify(item))
|
||||||
|
|
||||||
for (let role in obj) {
|
for (let role in obj) {
|
||||||
if (obj[role]["objectName"] != undefined) {
|
if (obj[role]["objectName"] !== undefined) {
|
||||||
obj[role] = toObject(item[role])
|
obj[role] = toObject(item[role])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,5 +3,5 @@ import QtQuick 2.12
|
||||||
Loader {
|
Loader {
|
||||||
id: loader
|
id: loader
|
||||||
asynchronous: true
|
asynchronous: true
|
||||||
visible: status == Loader.Ready
|
visible: status === Loader.Ready
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ HImage {
|
||||||
if (! image) return // if it was destroyed
|
if (! image) return // if it was destroyed
|
||||||
|
|
||||||
if (! isMxc) {
|
if (! isMxc) {
|
||||||
if (source != mxc) source = mxc
|
if (source !== mxc) source = mxc
|
||||||
show = image.visible
|
show = image.visible
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ HImage {
|
||||||
|
|
||||||
py.callCoro("media_cache." + method, args, path => {
|
py.callCoro("media_cache." + method, args, path => {
|
||||||
if (! image) return
|
if (! image) return
|
||||||
if (image.cachedPath != path) image.cachedPath = path
|
if (image.cachedPath !== path) image.cachedPath = path
|
||||||
|
|
||||||
image.broken = false
|
image.broken = false
|
||||||
image.show = image.visible
|
image.show = image.visible
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
|
|
||||||
HAvatar {
|
HAvatar {
|
||||||
name: displayName[0] == "#" && displayName.length > 1 ?
|
name: displayName[0] === "#" && displayName.length > 1 ?
|
||||||
displayName.substring(1) :
|
displayName.substring(1) :
|
||||||
displayName
|
displayName
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ TextEdit {
|
||||||
var lastPos = container.selectionStartPosition
|
var lastPos = container.selectionStartPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (first == index && last == index) {
|
if (first === index && last === index) {
|
||||||
select(
|
select(
|
||||||
label.positionAt(firstPos.x, firstPos.y),
|
label.positionAt(firstPos.x, firstPos.y),
|
||||||
label.positionAt(lastPos.x, lastPos.y),
|
label.positionAt(lastPos.x, lastPos.y),
|
||||||
|
@ -65,10 +65,10 @@ TextEdit {
|
||||||
{
|
{
|
||||||
label.selectAll()
|
label.selectAll()
|
||||||
|
|
||||||
} else if (first == index) {
|
} else if (first === index) {
|
||||||
label.select(positionAt(firstPos.x, firstPos.y), length)
|
label.select(positionAt(firstPos.x, firstPos.y), length)
|
||||||
|
|
||||||
} else if (last == index) {
|
} else if (last === index) {
|
||||||
label.select(0, positionAt(lastPos.x, lastPos.y))
|
label.select(0, positionAt(lastPos.x, lastPos.y))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -121,8 +121,8 @@ TextEdit {
|
||||||
TapHandler {
|
TapHandler {
|
||||||
acceptedButtons: Qt.LeftButton
|
acceptedButtons: Qt.LeftButton
|
||||||
onTapped: {
|
onTapped: {
|
||||||
tapCount == 2 ? selectWordAt(eventPoint.position) :
|
tapCount === 2 ? selectWordAt(eventPoint.position) :
|
||||||
tapCount == 3 ? selectAllText() :
|
tapCount === 3 ? selectAllText() :
|
||||||
container.clearSelection()
|
container.clearSelection()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ TabButton {
|
||||||
readonly property alias label: contentItem.label
|
readonly property alias label: contentItem.label
|
||||||
|
|
||||||
property color backgroundColor:
|
property color backgroundColor:
|
||||||
TabBar.index % 2 == 0 ?
|
TabBar.index % 2 === 0 ?
|
||||||
theme.controls.tab.background : theme.controls.tab.alternateBackground
|
theme.controls.tab.background : theme.controls.tab.alternateBackground
|
||||||
|
|
||||||
property bool loading: false
|
property bool loading: false
|
||||||
|
|
|
@ -154,7 +154,7 @@ HColumnLayout {
|
||||||
boundPosition >= savedDuration - 500 ?
|
boundPosition >= savedDuration - 500 ?
|
||||||
"restart" :
|
"restart" :
|
||||||
|
|
||||||
media.playbackState == MediaPlayer.PlayingState ? "pause" :
|
media.playbackState === MediaPlayer.PlayingState ? "pause" :
|
||||||
|
|
||||||
"play"
|
"play"
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ Rectangle {
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: buttonsRightPadding
|
id: buttonsRightPadding
|
||||||
color: theme.controls.button.background
|
color: theme.controls.button.background
|
||||||
visible: bannerGrid.flow == GridLayout.TopToBottom
|
visible: bannerGrid.flow === GridLayout.TopToBottom
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
|
@ -157,7 +157,7 @@ Rectangle {
|
||||||
let parts = lineText.split(indent)
|
let parts = lineText.split(indent)
|
||||||
|
|
||||||
for (const [i, part] of parts.entries()) {
|
for (const [i, part] of parts.entries()) {
|
||||||
if (i == parts.length - 1 || part) { break }
|
if (i === parts.length - 1 || part) { break }
|
||||||
indents += 1
|
indents += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,8 +191,8 @@ Rectangle {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ev.modifiers == Qt.NoModifier &&
|
if (ev.modifiers === Qt.NoModifier &&
|
||||||
ev.key == Qt.Key_Backspace &&
|
ev.key === Qt.Key_Backspace &&
|
||||||
! textArea.selectedText)
|
! textArea.selectedText)
|
||||||
{
|
{
|
||||||
ev.accepted = true
|
ev.accepted = true
|
||||||
|
|
|
@ -7,7 +7,7 @@ Column {
|
||||||
id: eventDelegate
|
id: eventDelegate
|
||||||
width: eventList.width
|
width: eventList.width
|
||||||
topPadding:
|
topPadding:
|
||||||
model.event_type == "RoomCreateEvent" ? 0 :
|
model.event_type === "RoomCreateEvent" ? 0 :
|
||||||
dayBreak ? theme.spacing * 4 :
|
dayBreak ? theme.spacing * 4 :
|
||||||
talkBreak ? theme.spacing * 6 :
|
talkBreak ? theme.spacing * 6 :
|
||||||
combine ? theme.spacing / 2 :
|
combine ? theme.spacing / 2 :
|
||||||
|
|
|
@ -11,7 +11,7 @@ Rectangle {
|
||||||
HSelectableLabelContainer {
|
HSelectableLabelContainer {
|
||||||
id: selectableLabelContainer
|
id: selectableLabelContainer
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
reversed: eventList.verticalLayoutDirection == ListView.BottomToTop
|
reversed: eventList.verticalLayoutDirection === ListView.BottomToTop
|
||||||
|
|
||||||
DragHandler {
|
DragHandler {
|
||||||
target: null
|
target: null
|
||||||
|
@ -33,11 +33,11 @@ Rectangle {
|
||||||
Timer {
|
Timer {
|
||||||
id: dragFlicker
|
id: dragFlicker
|
||||||
interval: 100
|
interval: 100
|
||||||
running: speed != 0
|
running: speed !== 0
|
||||||
repeat: true
|
repeat: true
|
||||||
|
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (eventList.verticalOvershoot != 0) return
|
if (eventList.verticalOvershoot !== 0) return
|
||||||
if (speed < 0 && eventList.atYEnd) return
|
if (speed < 0 && eventList.atYEnd) return
|
||||||
if (eventList.atYBeggining) {
|
if (eventList.atYBeggining) {
|
||||||
if (bouncedStart) { return } else { bouncedStart = true }
|
if (bouncedStart) { return } else { bouncedStart = true }
|
||||||
|
@ -116,13 +116,13 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function canDayBreak(item, itemAfter) {
|
function canDayBreak(item, itemAfter) {
|
||||||
if (itemAfter && itemAfter.event_type == "RoomCreateEvent")
|
if (itemAfter && itemAfter.event_type === "RoomCreateEvent")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
if (! item || ! itemAfter || ! item.date || ! itemAfter.date)
|
if (! item || ! itemAfter || ! item.date || ! itemAfter.date)
|
||||||
return false
|
return false
|
||||||
|
|
||||||
return item.date.getDate() != itemAfter.date.getDate()
|
return item.date.getDate() !== itemAfter.date.getDate()
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPastEvents() {
|
function loadPastEvents() {
|
||||||
|
|
|
@ -29,7 +29,7 @@ HLoader {
|
||||||
]
|
]
|
||||||
|
|
||||||
readonly property int type: {
|
readonly property int type: {
|
||||||
if (singleMediaInfo.event_type == "RoomAvatarEvent")
|
if (singleMediaInfo.event_type === "RoomAvatarEvent")
|
||||||
return EventDelegate.Media.Image
|
return EventDelegate.Media.Image
|
||||||
|
|
||||||
let mainType = singleMediaInfo.media_mime.split("/")[0].toLowerCase()
|
let mainType = singleMediaInfo.media_mime.split("/")[0].toLowerCase()
|
||||||
|
|
|
@ -32,8 +32,8 @@ Rectangle {
|
||||||
text: {
|
text: {
|
||||||
let tm = chat.roomInfo.typing_members
|
let tm = chat.roomInfo.typing_members
|
||||||
|
|
||||||
if (tm.length == 0) return ""
|
if (tm.length === 0) return ""
|
||||||
if (tm.length == 1) return qsTr("%1 is typing...").arg(tm[0])
|
if (tm.length === 1) return qsTr("%1 is typing...").arg(tm[0])
|
||||||
|
|
||||||
return qsTr("%1 and %2 are typing...")
|
return qsTr("%1 and %2 are typing...")
|
||||||
.arg(tm.slice(0, -1).join(", ")).arg(tm.slice(-1)[0])
|
.arg(tm.slice(0, -1).join(", ")).arg(tm.slice(-1)[0])
|
||||||
|
|
|
@ -38,12 +38,12 @@ Item {
|
||||||
})
|
})
|
||||||
|
|
||||||
nameFilters:
|
nameFilters:
|
||||||
fileType == HFileDialogOpener.FileType.Images ?
|
fileType === HFileDialogOpener.FileType.Images ?
|
||||||
[filters.images, filters.all] :
|
[filters.images, filters.all] :
|
||||||
[filters.all]
|
[filters.all]
|
||||||
|
|
||||||
folder: StandardPaths.writableLocation(
|
folder: StandardPaths.writableLocation(
|
||||||
fileType == HFileDialogOpener.FileType.Images ?
|
fileType === HFileDialogOpener.FileType.Images ?
|
||||||
StandardPaths.PicturesLocation :
|
StandardPaths.PicturesLocation :
|
||||||
StandardPaths.HomeLocation
|
StandardPaths.HomeLocation
|
||||||
)
|
)
|
||||||
|
|
|
@ -52,7 +52,7 @@ HPage {
|
||||||
width: ready ? parent.width : 96
|
width: ready ? parent.width : 96
|
||||||
source: ready ?
|
source: ready ?
|
||||||
modelData :
|
modelData :
|
||||||
(modelData == "Profile.qml" ?
|
(modelData === "Profile.qml" ?
|
||||||
"../../Base/HBusyIndicator.qml" : "")
|
"../../Base/HBusyIndicator.qml" : "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,7 +147,7 @@ HGridLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
HLabeledTextField {
|
HLabeledTextField {
|
||||||
property bool changed: field.text != accountInfo.display_name
|
property bool changed: field.text !== accountInfo.display_name
|
||||||
|
|
||||||
readonly property string fText: field.text
|
readonly property string fText: field.text
|
||||||
onFTextChanged: accountSettings.headerName = field.text
|
onFTextChanged: accountSettings.headerName = field.text
|
||||||
|
@ -168,7 +168,7 @@ HGridLayout {
|
||||||
property string currentAlias:
|
property string currentAlias:
|
||||||
window.settings.writeAliases[userId] || ""
|
window.settings.writeAliases[userId] || ""
|
||||||
|
|
||||||
property bool changed: field.text != currentAlias
|
property bool changed: field.text !== currentAlias
|
||||||
|
|
||||||
id: aliasField
|
id: aliasField
|
||||||
label.text: qsTr("Write alias:")
|
label.text: qsTr("Write alias:")
|
||||||
|
|
|
@ -116,8 +116,8 @@ HBox {
|
||||||
HButton {
|
HButton {
|
||||||
icon.name: modelData
|
icon.name: modelData
|
||||||
circle: true
|
circle: true
|
||||||
checked: signInWith == modelData
|
checked: signInWith === modelData
|
||||||
enabled: modelData == "username"
|
enabled: modelData === "username"
|
||||||
autoExclusive: true
|
autoExclusive: true
|
||||||
onClicked: signInWith = modelData
|
onClicked: signInWith = modelData
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,9 @@ BoxPopup {
|
||||||
box.focusButton: "ok"
|
box.focusButton: "ok"
|
||||||
|
|
||||||
onOk: py.callClientCoro(userId, "room_forget", [roomId], () => {
|
onOk: py.callClientCoro(userId, "room_forget", [roomId], () => {
|
||||||
if (window.uiState.page == "Chat/Chat.qml" &&
|
if (window.uiState.page === "Chat/Chat.qml" &&
|
||||||
window.uiState.pageProperties.userId == userId &&
|
window.uiState.pageProperties.userId === userId &&
|
||||||
window.uiState.pageProperties.roomId == roomId)
|
window.uiState.pageProperties.roomId === roomId)
|
||||||
{
|
{
|
||||||
pageLoader.showPage("Default")
|
pageLoader.showPage("Default")
|
||||||
Qt.callLater(popup.destroy)
|
Qt.callLater(popup.destroy)
|
||||||
|
|
|
@ -82,7 +82,7 @@ BoxPopup {
|
||||||
theme.colors.negativeBackground
|
theme.colors.negativeBackground
|
||||||
|
|
||||||
Layout.preferredWidth:
|
Layout.preferredWidth:
|
||||||
passwordValid == null ||
|
passwordValid === null ||
|
||||||
(validateWhileTyping && ! okClicked && ! passwordValid) ?
|
(validateWhileTyping && ! okClicked && ! passwordValid) ?
|
||||||
0 :implicitWidth
|
0 :implicitWidth
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ BoxPopup {
|
||||||
|
|
||||||
if ((modelSources["Account"] || []).length < 2) {
|
if ((modelSources["Account"] || []).length < 2) {
|
||||||
pageLoader.showPage("AddAccount/AddAccount")
|
pageLoader.showPage("AddAccount/AddAccount")
|
||||||
} else if (window.uiState.pageProperties.userId == userId) {
|
} else if (window.uiState.pageProperties.userId === userId) {
|
||||||
pageLoader.showPage("Default")
|
pageLoader.showPage("Default")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ Item {
|
||||||
// Chat
|
// Chat
|
||||||
|
|
||||||
HShortcut {
|
HShortcut {
|
||||||
enabled: window.uiState.page == "Chat/Chat.qml"
|
enabled: window.uiState.page === "Chat/Chat.qml"
|
||||||
sequences: settings.keys.clearRoomMessages
|
sequences: settings.keys.clearRoomMessages
|
||||||
onActivated: Utils.makePopup(
|
onActivated: Utils.makePopup(
|
||||||
"Popups/ClearMessagesPopup.qml",
|
"Popups/ClearMessagesPopup.qml",
|
||||||
|
@ -193,7 +193,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
HShortcut {
|
HShortcut {
|
||||||
enabled: window.uiState.page == "Chat/Chat.qml"
|
enabled: window.uiState.page === "Chat/Chat.qml"
|
||||||
sequences: settings.keys.sendFile
|
sequences: settings.keys.sendFile
|
||||||
onActivated: Utils.makeObject(
|
onActivated: Utils.makeObject(
|
||||||
"Dialogs/SendFilePicker.qml",
|
"Dialogs/SendFilePicker.qml",
|
||||||
|
@ -208,7 +208,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
HShortcut {
|
HShortcut {
|
||||||
enabled: window.uiState.page == "Chat/Chat.qml"
|
enabled: window.uiState.page === "Chat/Chat.qml"
|
||||||
sequences: settings.keys.sendFileFromPathInClipboard
|
sequences: settings.keys.sendFileFromPathInClipboard
|
||||||
onActivated: Utils.sendFile(
|
onActivated: Utils.sendFile(
|
||||||
window.uiState.pageProperties.userId,
|
window.uiState.pageProperties.userId,
|
||||||
|
|
|
@ -13,8 +13,8 @@ HTileDelegate {
|
||||||
theme.sidePane.account.collapsedOpacity : 1
|
theme.sidePane.account.collapsedOpacity : 1
|
||||||
|
|
||||||
shouldBeCurrent:
|
shouldBeCurrent:
|
||||||
window.uiState.page == "Pages/AccountSettings/AccountSettings.qml" &&
|
window.uiState.page === "Pages/AccountSettings/AccountSettings.qml" &&
|
||||||
window.uiState.pageProperties.userId == model.data.user_id
|
window.uiState.pageProperties.userId === model.data.user_id
|
||||||
|
|
||||||
setCurrentTimer.running:
|
setCurrentTimer.running:
|
||||||
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
|
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
|
||||||
|
|
|
@ -10,9 +10,9 @@ HTileDelegate {
|
||||||
opacity: model.data.left ? theme.sidePane.room.leftRoomOpacity : 1
|
opacity: model.data.left ? theme.sidePane.room.leftRoomOpacity : 1
|
||||||
|
|
||||||
shouldBeCurrent:
|
shouldBeCurrent:
|
||||||
window.uiState.page == "Chat/Chat.qml" &&
|
window.uiState.page === "Chat/Chat.qml" &&
|
||||||
window.uiState.pageProperties.userId == model.user_id &&
|
window.uiState.pageProperties.userId === model.user_id &&
|
||||||
window.uiState.pageProperties.roomId == model.data.room_id
|
window.uiState.pageProperties.roomId === model.data.room_id
|
||||||
|
|
||||||
setCurrentTimer.running:
|
setCurrentTimer.running:
|
||||||
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
|
! sidePaneList.activateLimiter.running && ! sidePane.hasFocus
|
||||||
|
@ -54,7 +54,7 @@ HTileDelegate {
|
||||||
Utils.dateIsToday(lastEvent.date) ?
|
Utils.dateIsToday(lastEvent.date) ?
|
||||||
Utils.formatTime(lastEvent.date, false) : // no seconds
|
Utils.formatTime(lastEvent.date, false) : // no seconds
|
||||||
|
|
||||||
lastEvent.date.getFullYear() == new Date().getFullYear() ?
|
lastEvent.date.getFullYear() === new Date().getFullYear() ?
|
||||||
Qt.formatDate(lastEvent.date, "d MMM") : // e.g. "5 Dec"
|
Qt.formatDate(lastEvent.date, "d MMM") : // e.g. "5 Dec"
|
||||||
|
|
||||||
lastEvent.date.getFullYear()
|
lastEvent.date.getFullYear()
|
||||||
|
|
|
@ -26,13 +26,13 @@ HListView {
|
||||||
for (let i = 0; i < window.sidePaneModelSource.length; i++) {
|
for (let i = 0; i < window.sidePaneModelSource.length; i++) {
|
||||||
let item = window.sidePaneModelSource[i]
|
let item = window.sidePaneModelSource[i]
|
||||||
|
|
||||||
if (item.type == "Account" ||
|
if (item.type === "Account" ||
|
||||||
(filter ?
|
(filter ?
|
||||||
Utils.filterMatches(filter, item.data.filter_string) :
|
Utils.filterMatches(filter, item.data.filter_string) :
|
||||||
! window.uiState.collapseAccounts[item.user_id]))
|
! window.uiState.collapseAccounts[item.user_id]))
|
||||||
{
|
{
|
||||||
if (filter && show.length && item.type == "Account" &&
|
if (filter && show.length && item.type === "Account" &&
|
||||||
show[show.length - 1].type == "Account" &&
|
show[show.length - 1].type === "Account" &&
|
||||||
! Utils.filterMatches(
|
! Utils.filterMatches(
|
||||||
filter, show[show.length - 1].data.filter_string)
|
filter, show[show.length - 1].data.filter_string)
|
||||||
) {
|
) {
|
||||||
|
@ -47,7 +47,7 @@ HListView {
|
||||||
}
|
}
|
||||||
|
|
||||||
let last = show[show.length - 1]
|
let last = show[show.length - 1]
|
||||||
if (show.length && filter && last.type == "Account" &&
|
if (show.length && filter && last.type === "Account" &&
|
||||||
! Utils.filterMatches(filter, last.data.filter_string))
|
! Utils.filterMatches(filter, last.data.filter_string))
|
||||||
{
|
{
|
||||||
// If filter active, last item is an account and last item
|
// If filter active, last item is an account and last item
|
||||||
|
@ -95,7 +95,7 @@ HListView {
|
||||||
|
|
||||||
if (! currentItem) incrementCurrentIndex()
|
if (! currentItem) incrementCurrentIndex()
|
||||||
|
|
||||||
if (currentItem.item.delegateModel.type == "Account") {
|
if (currentItem.item.delegateModel.type === "Account") {
|
||||||
currentItem.item.toggleCollapse()
|
currentItem.item.toggleCollapse()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ HListView {
|
||||||
for (let i = 0; i < model.source.length; i++) {
|
for (let i = 0; i < model.source.length; i++) {
|
||||||
let item = model.source[i]
|
let item = model.source[i]
|
||||||
|
|
||||||
if (item.type == "Account" && item.user_id ==
|
if (item.type === "Account" && item.user_id ==
|
||||||
currentItem.item.delegateModel.user_id)
|
currentItem.item.delegateModel.user_id)
|
||||||
{
|
{
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
|
@ -121,7 +121,7 @@ HListView {
|
||||||
delegate: Loader {
|
delegate: Loader {
|
||||||
width: sidePaneList.width
|
width: sidePaneList.width
|
||||||
Component.onCompleted: setSource(
|
Component.onCompleted: setSource(
|
||||||
model.type == "Account" ?
|
model.type === "Account" ?
|
||||||
"AccountDelegate.qml" : "RoomDelegate.qml",
|
"AccountDelegate.qml" : "RoomDelegate.qml",
|
||||||
{view: sidePaneList}
|
{view: sidePaneList}
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ HRowLayout {
|
||||||
Component.onCompleted: filterField.text = uiState.sidePaneFilter
|
Component.onCompleted: filterField.text = uiState.sidePaneFilter
|
||||||
|
|
||||||
onTextChanged: {
|
onTextChanged: {
|
||||||
if (window.uiState.sidePaneFilter == text) return
|
if (window.uiState.sidePaneFilter === text) return
|
||||||
window.uiState.sidePaneFilter = text
|
window.uiState.sidePaneFilter = text
|
||||||
window.uiStateChanged()
|
window.uiStateChanged()
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ Item {
|
||||||
let page = window.uiState.page
|
let page = window.uiState.page
|
||||||
let props = window.uiState.pageProperties
|
let props = window.uiState.pageProperties
|
||||||
|
|
||||||
if (page == "Chat/Chat.qml") {
|
if (page === "Chat/Chat.qml") {
|
||||||
pageLoader.showRoom(props.userId, props.roomId)
|
pageLoader.showRoom(props.userId, props.roomId)
|
||||||
} else {
|
} else {
|
||||||
pageLoader._show(page, props)
|
pageLoader._show(page, props)
|
||||||
|
@ -133,7 +133,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
onStatusChanged: if (status == Loader.Ready) {
|
onStatusChanged: if (status === Loader.Ready) {
|
||||||
pageLoader.takeFocus()
|
pageLoader.takeFocus()
|
||||||
appearAnimation.start()
|
appearAnimation.start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ ApplicationWindow {
|
||||||
readonly property alias hovered: windowHover.hovered
|
readonly property alias hovered: windowHover.hovered
|
||||||
|
|
||||||
readonly property bool hidden:
|
readonly property bool hidden:
|
||||||
Qt.application.state == Qt.ApplicationSuspended ||
|
Qt.application.state === Qt.ApplicationSuspended ||
|
||||||
Qt.application.state == Qt.ApplicationHidden ||
|
Qt.application.state === Qt.ApplicationHidden ||
|
||||||
window.visibility == window.Minimized ||
|
window.visibility === window.Minimized ||
|
||||||
window.visibility == window.Hidden
|
window.visibility === window.Hidden
|
||||||
|
|
||||||
// NOTE: For JS object variables, the corresponding method to notify
|
// NOTE: For JS object variables, the corresponding method to notify
|
||||||
// key/value changes must be called manually, e.g. settingsChanged().
|
// key/value changes must be called manually, e.g. settingsChanged().
|
||||||
|
|
|
@ -7,7 +7,7 @@ function onExitRequested(exitCode) {
|
||||||
|
|
||||||
|
|
||||||
function onAlertRequested() {
|
function onAlertRequested() {
|
||||||
if (Qt.application.state != Qt.ApplicationActive) {
|
if (Qt.application.state !== Qt.ApplicationActive) {
|
||||||
window.alert(window.settings.alertOnMessageForMsec)
|
window.alert(window.settings.alertOnMessageForMsec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ function onCoroutineDone(uuid, result, error, traceback) {
|
||||||
|
|
||||||
|
|
||||||
function onModelUpdated(syncId, data, serializedSyncId) {
|
function onModelUpdated(syncId, data, serializedSyncId) {
|
||||||
if (serializedSyncId == ["Account"] || serializedSyncId[0] == "Room") {
|
if (serializedSyncId === ["Account"] || serializedSyncId[0] === "Room") {
|
||||||
py.callCoro("get_flat_sidepane_data", [], data => {
|
py.callCoro("get_flat_sidepane_data", [], data => {
|
||||||
window.sidePaneModelSource = data
|
window.sidePaneModelSource = data
|
||||||
})
|
})
|
||||||
|
|
|
@ -102,7 +102,7 @@ function escapeHtml(string) {
|
||||||
|
|
||||||
|
|
||||||
function processedEventText(ev) {
|
function processedEventText(ev) {
|
||||||
if (ev.event_type == "RoomMessageEmote")
|
if (ev.event_type === "RoomMessageEmote")
|
||||||
return coloredNameHtml(ev.sender_name, ev.sender_id) + " " + ev.content
|
return coloredNameHtml(ev.sender_name, ev.sender_id) + " " + ev.content
|
||||||
|
|
||||||
let unknown = ev.event_type === "RoomMessageUnknown"
|
let unknown = ev.event_type === "RoomMessageUnknown"
|
||||||
|
@ -124,7 +124,7 @@ function processedEventText(ev) {
|
||||||
function filterMatches(filter, text) {
|
function filterMatches(filter, text) {
|
||||||
let filter_lower = filter.toLowerCase()
|
let filter_lower = filter.toLowerCase()
|
||||||
|
|
||||||
if (filter_lower == filter) {
|
if (filter_lower === filter) {
|
||||||
// Consider case only if filter isn't all lowercase (smart case)
|
// Consider case only if filter isn't all lowercase (smart case)
|
||||||
filter = filter_lower
|
filter = filter_lower
|
||||||
text = text.toLowerCase()
|
text = text.toLowerCase()
|
||||||
|
@ -170,9 +170,9 @@ function minutesBetween(date1, date2) {
|
||||||
|
|
||||||
|
|
||||||
function dateIsDay(date, dayDate) {
|
function dateIsDay(date, dayDate) {
|
||||||
return date.getDate() == dayDate.getDate() &&
|
return date.getDate() === dayDate.getDate() &&
|
||||||
date.getMonth() == dayDate.getMonth() &&
|
date.getMonth() === dayDate.getMonth() &&
|
||||||
date.getFullYear() == dayDate.getFullYear()
|
date.getFullYear() === dayDate.getFullYear()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user