diff --git a/src/qml/Chat/Banners/InviteBanner.qml b/src/qml/Chat/Banners/InviteBanner.qml index 8f6621ed..4a8b7c34 100644 --- a/src/qml/Chat/Banners/InviteBanner.qml +++ b/src/qml/Chat/Banners/InviteBanner.qml @@ -35,18 +35,18 @@ Banner { ] buttonCallbacks: { - "accept": function(button) { + "accept": button => { button.loading = true py.callClientCoro( - chatPage.userId, "join", [chatPage.roomId], function() { + chatPage.userId, "join", [chatPage.roomId], () => { button.loading = false }) }, - "decline": function(button) { + "decline": button => { button.loading = true py.callClientCoro( - chatPage.userId, "room_leave", [chatPage.roomId], function() { + chatPage.userId, "room_leave", [chatPage.roomId], () => { button.loading = false }) } diff --git a/src/qml/Chat/Banners/LeftBanner.qml b/src/qml/Chat/Banners/LeftBanner.qml index 43ab8465..00e0ab16 100644 --- a/src/qml/Chat/Banners/LeftBanner.qml +++ b/src/qml/Chat/Banners/LeftBanner.qml @@ -23,10 +23,10 @@ Banner { ] buttonCallbacks: { - "forget": function(button) { + "forget": button => { button.loading = true py.callClientCoro( - chatPage.userId, "room_forget", [chatPage.roomId], function() { + chatPage.userId, "room_forget", [chatPage.roomId], () => { button.loading = false }) } diff --git a/src/qml/Chat/Banners/UnknownDevicesBanner.qml b/src/qml/Chat/Banners/UnknownDevicesBanner.qml index de49c254..aee56546 100644 --- a/src/qml/Chat/Banners/UnknownDevicesBanner.qml +++ b/src/qml/Chat/Banners/UnknownDevicesBanner.qml @@ -21,8 +21,8 @@ Banner { ] buttonCallbacks: { - "inspect": function(button) { + "inspect": button => { print("show") - }, + } } } diff --git a/src/qml/Chat/Chat.qml b/src/qml/Chat/Chat.qml index 9b763ab9..9d7d486e 100644 --- a/src/qml/Chat/Chat.qml +++ b/src/qml/Chat/Chat.qml @@ -107,7 +107,7 @@ HPage { to: target.oldWidth onStopped: target.Layout.minimumWidth = Qt.binding( - function() { return theme.avatar.size } + () => theme.avatar.size ) } @@ -131,9 +131,7 @@ HPage { currentWidth = referenceWidth width = referenceWidth wasSnapped = true - currentWidth = Qt.binding( - function() { return roomSidePane.width } - ) + currentWidth = Qt.binding(() => roomSidePane.width) } else { wasSnapped = false } diff --git a/src/qml/Chat/Timeline/EventList.qml b/src/qml/Chat/Timeline/EventList.qml index f5534b02..085ea97f 100644 --- a/src/qml/Chat/Timeline/EventList.qml +++ b/src/qml/Chat/Timeline/EventList.qml @@ -48,10 +48,8 @@ HRectangle { print(canLoad, zz) eventList.canLoad = false py.callClientCoro( - chatPage.userId, - "load_past_events", - [chatPage.roomId], - function(more_to_load) { eventList.canLoad = more_to_load } + chatPage.userId, "load_past_events", [chatPage.roomId], + more_to_load => { eventList.canLoad = more_to_load } ) } } diff --git a/src/qml/EventHandlers/rooms.js b/src/qml/EventHandlers/rooms.js index c32e12c9..eb8b0aa5 100644 --- a/src/qml/EventHandlers/rooms.js +++ b/src/qml/EventHandlers/rooms.js @@ -14,7 +14,7 @@ function typingTextFor(members, our_user_id) { } } - profiles.sort(function(left, right) { + profiles.sort((left, right) => { if (left.displayName < right.displayName) { return -1 } if (left.displayName > right.displayName) { return +1 } return 0 diff --git a/src/qml/Pages/RememberAccount.qml b/src/qml/Pages/RememberAccount.qml index e5ed148b..4a7c596a 100644 --- a/src/qml/Pages/RememberAccount.qml +++ b/src/qml/Pages/RememberAccount.qml @@ -22,11 +22,11 @@ Item { ] buttonCallbacks: { - "yes": function(button) { + "yes": button => { py.callCoro("save_account", [userId]) pageStack.showPage("Default") }, - "no": function(button) { + "no": button => { py.callCoro("forget_account", [userId]) pageStack.showPage("Default") }, diff --git a/src/qml/Pages/SignIn.qml b/src/qml/Pages/SignIn.qml index 7b7f7976..fc2f80ee 100644 --- a/src/qml/Pages/SignIn.qml +++ b/src/qml/Pages/SignIn.qml @@ -23,13 +23,13 @@ Item { ] buttonCallbacks: { - "register": function(button) {}, + "register": button => {}, - "login": function(button) { + "login": button => { button.loading = true var args = [idField.text, passwordField.text] - py.callCoro("login_client", args, function(user_id) { + py.callCoro("login_client", args, user_id => { pageStack.showPage( "RememberAccount", {"loginWith": loginWith, "userId": user_id} @@ -38,7 +38,7 @@ Item { }) }, - "forgot": function(button) {} + "forgot": button => {} } HRowLayout { diff --git a/src/qml/Python.qml b/src/qml/Python.qml index 7ffe045e..9c90f981 100644 --- a/src/qml/Python.qml +++ b/src/qml/Python.qml @@ -42,17 +42,17 @@ Python { addImportPath("src") addImportPath("qrc:/") - importNames("python", ["APP"], function() { - call("APP.is_debug_on", [Qt.application.arguments], function(on) { + importNames("python", ["APP"], () => { + call("APP.is_debug_on", [Qt.application.arguments], on => { window.debug = on - callCoro("has_saved_accounts", [], function(has) { + callCoro("has_saved_accounts", [], has => { py.ready = true willLoadAccounts(has) if (has) { py.loadingAccounts = true - py.callCoro("load_saved_accounts", [], function() { + py.callCoro("load_saved_accounts", [], () => { py.loadingAccounts = false }) } diff --git a/src/qml/UI.qml b/src/qml/UI.qml index f5f5bad1..0b41a6b9 100644 --- a/src/qml/UI.qml +++ b/src/qml/UI.qml @@ -13,9 +13,9 @@ Item { Connections { target: py - onWillLoadAccounts: function(will) { + onWillLoadAccounts: will => { pageStack.showPage(will ? "Default": "SignIn") - if (will) {initialRoomTimer.start()} + if (will) { initialRoomTimer.start() } } } diff --git a/src/qml/utils.js b/src/qml/utils.js index 0e88376c..ba4345a0 100644 --- a/src/qml/utils.js +++ b/src/qml/utils.js @@ -112,7 +112,7 @@ function filterMatches(filter, text) { var words = filter.split(" ") for (var i = 0; i < words.length; i++) { - if (words[i] && text.indexOf(words[i]) == -1) { + if (words[i] && ! text.includes(words[i])) { return false } }