diff --git a/src/qml/AccountEditorPage.qml b/src/qml/AccountEditorPage.qml index b36a7ede9..2866dbbc9 100644 --- a/src/qml/AccountEditorPage.qml +++ b/src/qml/AccountEditorPage.qml @@ -40,9 +40,8 @@ FormCard.FormCardPage { if (fileDialog) { return; } - fileDialog = openFileDialog.createObject(this); - fileDialog.chosen.connect((receivedSource) => { + fileDialog.chosen.connect(receivedSource => { if (!receivedSource) { return; } @@ -137,7 +136,9 @@ FormCard.FormCardPage { visible: root.connection !== undefined && root.connection.canChangePassword === false text: i18n("Your server doesn't support changing your password") } - FormCard.FormDelegateSeparator { visible: root.connection !== undefined && root.connection.canChangePassword === false } + FormCard.FormDelegateSeparator { + visible: root.connection !== undefined && root.connection.canChangePassword === false + } FormCard.FormTextFieldDelegate { id: currentPassword label: i18n("Current Password:") @@ -212,7 +213,11 @@ FormCard.FormCardPage { FormCard.FormButtonDelegate { id: deactivateAccountButton text: i18n("Deactivate Account") - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ConfirmDeactivateAccountDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Confirm Deactivating Account")}) + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ConfirmDeactivateAccountDialog.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Confirm Deactivating Account") + }) } } diff --git a/src/qml/AccountMenu.qml b/src/qml/AccountMenu.qml index 9e593e4a8..87a148710 100644 --- a/src/qml/AccountMenu.qml +++ b/src/qml/AccountMenu.qml @@ -24,24 +24,24 @@ QQC2.Menu { connection: root.connection }, { title: i18n("Account editor") - }); + }) } QQC2.MenuItem { text: i18n("Notification settings") icon.name: "notifications" onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { defaultPage: "notifications", - connection: root.connection, + connection: root.connection }, { title: i18n("Configure") - }); + }) } QQC2.MenuItem { text: i18n("Devices") icon.name: "computer-symbolic" onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { defaultPage: "devices", - connection: root.connection, + connection: root.connection }, { title: i18n("Configure") }) diff --git a/src/qml/AccountsPage.qml b/src/qml/AccountsPage.qml index d070f5582..98b0abc6b 100644 --- a/src/qml/AccountsPage.qml +++ b/src/qml/AccountsPage.qml @@ -80,7 +80,7 @@ FormCard.FormCardPage { connection: accountDelegate.connection onAccepted: { if (AccountRegistry.accountCount === 1) { - root.Window.window.close() + root.Window.window.close(); } } } @@ -93,7 +93,9 @@ FormCard.FormCardPage { } } } - FormCard.FormDelegateSeparator { below: addAccountDelegate } + FormCard.FormDelegateSeparator { + below: addAccountDelegate + } FormCard.FormButtonDelegate { id: addAccountDelegate @@ -107,7 +109,7 @@ FormCard.FormCardPage { target: Controller function onConnectionAdded() { if (pageStack.layers.depth > 2) { - pageStack.layers.pop() + pageStack.layers.pop(); } } } diff --git a/src/qml/AppearanceSettingsPage.qml b/src/qml/AppearanceSettingsPage.qml index b3758b045..2a373b570 100644 --- a/src/qml/AppearanceSettingsPage.qml +++ b/src/qml/AppearanceSettingsPage.qml @@ -31,7 +31,9 @@ FormCard.FormCardPage { Item { Layout.fillWidth: true } - QQC2.ButtonGroup { id: themeGroup } + QQC2.ButtonGroup { + id: themeGroup + } ThemeRadioButton { thin: timelineModeSetting.width < Kirigami.Units.gridUnit * 22 innerObject: [ @@ -196,7 +198,9 @@ FormCard.FormCardPage { } } - FormCard.FormDelegateSeparator { below: compactRoomListDelegate } + FormCard.FormDelegateSeparator { + below: compactRoomListDelegate + } FormCard.FormCheckDelegate { id: compactRoomListDelegate @@ -208,7 +212,11 @@ FormCard.FormCardPage { } } - FormCard.FormDelegateSeparator { above: compactRoomListDelegate ; below: colorSchemeDelegate.item ; visible: colorSchemeDelegate.visible } + FormCard.FormDelegateSeparator { + above: compactRoomListDelegate + below: colorSchemeDelegate.item + visible: colorSchemeDelegate.visible + } Loader { id: colorSchemeDelegate @@ -231,7 +239,10 @@ FormCard.FormCardPage { } } - FormCard.FormDelegateSeparator { above: showFancyEffectsDelegate ; below: hasWindowSystemDelegate } + FormCard.FormDelegateSeparator { + above: showFancyEffectsDelegate + below: hasWindowSystemDelegate + } FormCard.FormCheckDelegate { id: hasWindowSystemDelegate @@ -245,7 +256,10 @@ FormCard.FormCardPage { } } - FormCard.FormDelegateSeparator { above: hasWindowSystemDelegate; below: transparencyDelegate } + FormCard.FormDelegateSeparator { + above: hasWindowSystemDelegate + below: transparencyDelegate + } FormCard.AbstractFormDelegate { id: transparencyDelegate @@ -269,7 +283,9 @@ FormCard.FormCardPage { } Layout.fillWidth: true - HoverHandler { id: sliderHover } + HoverHandler { + id: sliderHover + } QQC2.ToolTip.visible: sliderHover.hovered && !enabled QQC2.ToolTip.text: i18n("Only enabled if the transparent chat page is enabled.") } @@ -280,7 +296,11 @@ FormCard.FormCardPage { } } - FormCard.FormDelegateSeparator { above: transparencyDelegate; below: showLocalMessagesOnRightDelegate; visible: transparencyDelegate.visible } + FormCard.FormDelegateSeparator { + above: transparencyDelegate + below: showLocalMessagesOnRightDelegate + visible: transparencyDelegate.visible + } FormCard.FormCheckDelegate { id: showLocalMessagesOnRightDelegate @@ -288,25 +308,27 @@ FormCard.FormCardPage { checked: Config.showLocalMessagesOnRight enabled: !Config.isShowLocalMessagesOnRightImmutable && !Config.compactLayout onToggled: { - Config.showLocalMessagesOnRight = checked - Config.save() + Config.showLocalMessagesOnRight = checked; + Config.save(); } } - FormCard.FormDelegateSeparator { above: showLocalMessagesOnRightDelegate; below: showLinkPreviewDelegate } + FormCard.FormDelegateSeparator { + above: showLocalMessagesOnRightDelegate + below: showLinkPreviewDelegate + } FormCard.FormCheckDelegate { id: showLinkPreviewDelegate text: i18n("Show links preview in the chat messages") checked: Config.showLinkPreview onToggled: { - Config.showLinkPreview = checked - Config.save() + Config.showLinkPreview = checked; + Config.save(); } } } - FormCard.FormHeader { title: i18n("Show Avatar") } @@ -315,8 +337,8 @@ FormCard.FormCardPage { text: i18n("In chat") checked: Config.showAvatarInTimeline onToggled: { - Config.showAvatarInTimeline = checked - Config.save() + Config.showAvatarInTimeline = checked; + Config.save(); } enabled: !Config.isShowAvatarInTimelineImmutable } @@ -326,8 +348,8 @@ FormCard.FormCardPage { checked: Config.showAvatarInRoomDrawer enabled: !Config.isShowAvatarInRoomDrawerImmutable onToggled: { - Config.showAvatarInRoomDrawer = checked - Config.save() + Config.showAvatarInRoomDrawer = checked; + Config.save(); } } } diff --git a/src/qml/AttachDialog.qml b/src/qml/AttachDialog.qml index 9011f3381..0e5cbb08e 100644 --- a/src/qml/AttachDialog.qml +++ b/src/qml/AttachDialog.qml @@ -27,11 +27,10 @@ QQC2.Popup { text: i18n("Choose local file") onClicked: { - root.close() - - var fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay) - fileDialog.chosen.connect(path => root.chosen(path)) - fileDialog.open() + root.close(); + var fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay); + fileDialog.chosen.connect(path => root.chosen(path)); + fileDialog.open(); } } @@ -46,11 +45,11 @@ QQC2.Popup { icon.name: 'insert-image' text: i18n("Clipboard image") onClicked: { - const path = StandardPaths.standardLocations(StandardPaths.CacheLocation)[0] + "/screenshots/" + (new Date()).getTime() + ".png" + const path = StandardPaths.standardLocations(StandardPaths.CacheLocation)[0] + "/screenshots/" + (new Date()).getTime() + ".png"; if (!Clipboard.saveImage(path)) { return; } - root.chosen(path) + root.chosen(path); root.close(); } } diff --git a/src/qml/AttachmentPane.qml b/src/qml/AttachmentPane.qml index da5137836..1ad8e92d1 100644 --- a/src/qml/AttachmentPane.qml +++ b/src/qml/AttachmentPane.qml @@ -13,7 +13,7 @@ import org.kde.neochat ColumnLayout { id: root - signal attachmentCancelled() + signal attachmentCancelled property string attachmentPath @@ -47,7 +47,7 @@ ColumnLayout { onClicked: { let imageEditor = applicationWindow().pageStack.layers.push(imageEditorPage); - imageEditor.newPathChanged.connect(function(newPath) { + imageEditor.newPathChanged.connect(function (newPath) { applicationWindow().pageStack.layers.pop(); root.attachmentPath = newPath; }); @@ -61,7 +61,7 @@ ColumnLayout { action: Kirigami.Action { text: i18n("Cancel sending attachment") icon.name: "dialog-close" - onTriggered: attachmentCancelled(); + onTriggered: attachmentCancelled() shortcut: "Escape" } QQC2.ToolTip.text: text @@ -81,14 +81,14 @@ ColumnLayout { onSourceChanged: { // Reset source size height, which affect implicitHeight - sourceSize.height = -1 + sourceSize.height = -1; } onSourceSizeChanged: { if (implicitHeight > Kirigami.Units.gridUnit * 8) { // This can save a lot of RAM when loading large images. // It also improves visual quality for large images. - sourceSize.height = Kirigami.Units.gridUnit * 8 + sourceSize.height = Kirigami.Units.gridUnit * 8; } } diff --git a/src/qml/AudioDelegate.qml b/src/qml/AudioDelegate.qml index 2bad3c874..792a76cf5 100644 --- a/src/qml/AudioDelegate.qml +++ b/src/qml/AudioDelegate.qml @@ -67,7 +67,7 @@ MessageDelegate { target: playButton icon.name: "media-playback-stop" onClicked: { - root.room.cancelFileTransfer(root.eventId) + root.room.cancelFileTransfer(root.eventId); } } }, @@ -78,7 +78,7 @@ MessageDelegate { target: playButton icon.name: "media-playback-start" onClicked: { - audio.play() + audio.play(); } } }, diff --git a/src/qml/AvatarTabButton.qml b/src/qml/AvatarTabButton.qml index 067714147..fe313d123 100644 --- a/src/qml/AvatarTabButton.qml +++ b/src/qml/AvatarTabButton.qml @@ -15,8 +15,8 @@ Delegates.RoundedItemDelegate { property url source - signal contextMenuRequested() - signal selected() + signal contextMenuRequested + signal selected padding: Kirigami.Units.largeSpacing @@ -24,9 +24,9 @@ Delegates.RoundedItemDelegate { QQC2.ToolTip.text: text QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay - Accessible.onPressAction: selected(); - Keys.onSpacePressed: selected(); - Keys.onEnterPressed: selected(); + Accessible.onPressAction: selected() + Keys.onSpacePressed: selected() + Keys.onEnterPressed: selected() onPressAndHold: root.contextMenuRequested() diff --git a/src/qml/BanSheet.qml b/src/qml/BanSheet.qml index 278a02444..2e7cab21b 100644 --- a/src/qml/BanSheet.qml +++ b/src/qml/BanSheet.qml @@ -44,8 +44,8 @@ Kirigami.Page { icon.name: "im-ban-user" QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole onClicked: { - root.room.ban(root.userId, reason.text) - root.closeDialog() + root.room.ban(root.userId, reason.text); + root.closeDialog(); } } QQC2.Button { diff --git a/src/qml/Bubble.qml b/src/qml/Bubble.qml index c5aa183ce..1087e1e73 100644 --- a/src/qml/Bubble.qml +++ b/src/qml/Bubble.qml @@ -183,7 +183,7 @@ QQC2.Control { Connections { target: replyLoader.item function onReplyClicked() { - replyClicked(root.replyId) + replyClicked(root.replyId); } } } @@ -202,20 +202,22 @@ QQC2.Control { Kirigami.Theme.colorSet: Kirigami.Theme.View Kirigami.Theme.inherit: false color: if (root.author.isLocalUser) { - return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15) + return Kirigami.ColorUtils.tintWithAlpha(Kirigami.Theme.backgroundColor, Kirigami.Theme.highlightColor, 0.15); } else if (root.showHighlight) { - return Kirigami.Theme.positiveBackgroundColor + return Kirigami.Theme.positiveBackgroundColor; } else { - return Kirigami.Theme.backgroundColor + return Kirigami.Theme.backgroundColor; } radius: Kirigami.Units.smallSpacing shadow { - size: Kirigami.Units.smallSpacing + size: Kirigami.Units.smallSpacing color: root.showHighlight ? Qt.rgba(0.0, 0.0, 0.0, 0.10) : Qt.rgba(Kirigami.Theme.textColor.r, Kirigami.Theme.textColor.g, Kirigami.Theme.textColor.b, 0.10) } Behavior on color { - ColorAnimation { duration: Kirigami.Units.shortDuration } + ColorAnimation { + duration: Kirigami.Units.shortDuration + } } } diff --git a/src/qml/Captcha.qml b/src/qml/Captcha.qml index f096f993f..8ebe48933 100644 --- a/src/qml/Captcha.qml +++ b/src/qml/Captcha.qml @@ -20,7 +20,7 @@ LoginStep { url: "http://localhost:20847" implicitHeight: 500 onLoadingChanged: { - webview.runJavaScript("document.body.style.background = '" + Kirigami.Theme.backgroundColor + "'") + webview.runJavaScript("document.body.style.background = '" + Kirigami.Theme.backgroundColor + "'"); } Timer { @@ -29,15 +29,15 @@ LoginStep { running: true interval: 300 onTriggered: { - if(!webview.visible) { - return + if (!webview.visible) { + return; } - webview.runJavaScript("!!grecaptcha ? grecaptcha.getResponse() : \"\"", function(response){ - if(!webview.visible || !response) - return + webview.runJavaScript("!!grecaptcha ? grecaptcha.getResponse() : \"\"", function (response) { + if (!webview.visible || !response) + return; timer.running = false; Registration.recaptchaResponse = response; - }) + }); } } } diff --git a/src/qml/Categories.qml b/src/qml/Categories.qml index fc50a3a35..6d15f2c3f 100644 --- a/src/qml/Categories.qml +++ b/src/qml/Categories.qml @@ -25,7 +25,7 @@ KirigamiSettings.CategorizedSettings { return { room: root.room, connection: root.connection - } + }; } }, KirigamiSettings.SettingAction { @@ -36,7 +36,7 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { room: root.room - } + }; } }, KirigamiSettings.SettingAction { @@ -47,7 +47,7 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { room: root.room - } + }; } }, KirigamiSettings.SettingAction { @@ -58,7 +58,7 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { room: root.room - } + }; } } ] diff --git a/src/qml/ChatBar.qml b/src/qml/ChatBar.qml index 43d245238..d07883646 100644 --- a/src/qml/ChatBar.qml +++ b/src/qml/ChatBar.qml @@ -57,15 +57,15 @@ QQC2.Control { property bool isBusy: root.currentRoom && root.currentRoom.hasFileUploading // Matrix does not allow sending attachments in replies - visible: _private.chatBarCache.replyId.length === 0 && _private.chatBarCache.attachmentPath.length === 0 + visible: _private.chatBarCache.replyId.length === 0 && _private.chatBarCache.attachmentPath.length === 0 icon.name: "mail-attachment" text: i18n("Attach an image or file") displayHint: Kirigami.DisplayHint.IconOnly onTriggered: { - let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(applicationWindow().overlay) - dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path) - dialog.open() + let dialog = (Clipboard.hasImage ? attachDialog : openFileDialog).createObject(applicationWindow().overlay); + dialog.chosen.connect(path => _private.chatBarCache.attachmentPath = path); + dialog.open(); } tooltip: text @@ -83,9 +83,9 @@ QQC2.Control { onTriggered: { if (emojiDialog.visible) { - emojiDialog.close() + emojiDialog.close(); } else { - emojiDialog.open() + emojiDialog.open(); } } tooltip: text @@ -98,7 +98,9 @@ QQC2.Control { displayHint: QQC2.AbstractButton.IconOnly onTriggered: { - locationChooser.createObject(QQC2.ApplicationWindow.overlay, {room: root.currentRoom}).open() + locationChooser.createObject(QQC2.ApplicationWindow.overlay, { + room: root.currentRoom + }).open(); } tooltip: text }, @@ -113,7 +115,7 @@ QQC2.Control { checkable: true onTriggered: { - _private.postMessage() + _private.postMessage(); } tooltip: text @@ -123,7 +125,7 @@ QQC2.Control { /** * @brief A message has been sent from the chat bar. */ - signal messageSent() + signal messageSent spacing: 0 @@ -134,7 +136,7 @@ QQC2.Control { color: Kirigami.Theme.backgroundColor Kirigami.Separator { anchors.left: parent.left - anchors.right:parent.right + anchors.right: parent.right anchors.top: parent.top } } @@ -146,7 +148,8 @@ QQC2.Control { contentItem: ColumnLayout { spacing: 0 - Item { // Required to adjust for the top separator + Item { + // Required to adjust for the top separator Layout.preferredHeight: 1 Layout.fillWidth: true } @@ -200,17 +203,17 @@ QQC2.Control { onTextChanged: { if (!repeatTimer.running && Config.typingNotifications) { - var textExists = text.length > 0 - root.currentRoom.sendTypingNotification(textExists) - textExists ? repeatTimer.start() : repeatTimer.stop() + var textExists = text.length > 0; + root.currentRoom.sendTypingNotification(textExists); + textExists ? repeatTimer.start() : repeatTimer.stop(); } - _private.chatBarCache.text = text + _private.chatBarCache.text = text; } onSelectedTextChanged: { if (selectedText.length > 0) { - quickFormatBar.selectionStart = selectionStart - quickFormatBar.selectionEnd = selectionEnd - quickFormatBar.open() + quickFormatBar.selectionStart = selectionStart; + quickFormatBar.selectionEnd = selectionEnd; + quickFormatBar.open(); } } @@ -225,42 +228,42 @@ QQC2.Control { Keys.onDeletePressed: { if (selectedText.length > 0) { - remove(selectionStart, selectionEnd) + remove(selectionStart, selectionEnd); } else { - remove(cursorPosition, cursorPosition + 1) + remove(cursorPosition, cursorPosition + 1); } if (textField.text == selectedText || textField.text.length <= 1) { - root.currentRoom.sendTypingNotification(false) - repeatTimer.stop() + root.currentRoom.sendTypingNotification(false); + repeatTimer.stop(); } if (quickFormatBar.visible) { - quickFormatBar.close() + quickFormatBar.close(); } } Keys.onEnterPressed: event => { if (completionMenu.visible) { - completionMenu.complete() + completionMenu.complete(); } else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) { - textField.insert(cursorPosition, "\n") + textField.insert(cursorPosition, "\n"); } else { _private.postMessage(); } } Keys.onReturnPressed: event => { if (completionMenu.visible) { - completionMenu.complete() + completionMenu.complete(); } else if (event.modifiers & Qt.ShiftModifier || Kirigami.Settings.isMobile) { - textField.insert(cursorPosition, "\n") + textField.insert(cursorPosition, "\n"); } else { _private.postMessage(); } } Keys.onTabPressed: { if (completionMenu.visible) { - completionMenu.complete() + completionMenu.complete(); } } - Keys.onPressed: (event) => { + Keys.onPressed: event => { if (event.key === Qt.Key_V && event.modifiers & Qt.ControlModifier) { event.accepted = _private.pasteImage(); } else if (event.key === Qt.Key_Up && event.modifiers & Qt.ControlModifier) { @@ -268,26 +271,26 @@ QQC2.Control { } else if (event.key === Qt.Key_Up && textField.text.length === 0) { root.currentRoom.editLastMessage(); } else if (event.key === Qt.Key_Up && completionMenu.visible) { - completionMenu.decrementIndex() + completionMenu.decrementIndex(); } else if (event.key === Qt.Key_Down && completionMenu.visible) { - completionMenu.incrementIndex() + completionMenu.incrementIndex(); } else if (event.key === Qt.Key_Backspace) { if (textField.text == selectedText || textField.text.length <= 1) { - root.currentRoom.sendTypingNotification(false) - repeatTimer.stop() + root.currentRoom.sendTypingNotification(false); + repeatTimer.stop(); } if (quickFormatBar.visible && selectedText.length > 0) { - quickFormatBar.close() + quickFormatBar.close(); } } } Keys.onShortcutOverride: event => { if (completionMenu.visible) { - completionMenu.close() + completionMenu.close(); } else if ((_private.chatBarCache.isReplying || _private.chatBarCache.attachmentPath.length > 0) && event.key === Qt.Key_Escape) { - _private.chatBarCache.attachmentPath = "" - _private.chatBarCache.replyId = "" - _private.chatBarCache.threadId = "" + _private.chatBarCache.attachmentPath = ""; + _private.chatBarCache.replyId = ""; + _private.chatBarCache.threadId = ""; event.accepted = true; } } @@ -358,7 +361,7 @@ QQC2.Control { onAttachmentCancelled: { _private.chatBarCache.attachmentPath = ""; - root.forceActiveFocus() + root.forceActiveFocus(); } } } @@ -370,11 +373,11 @@ QQC2.Control { function postMessage() { root.actionsHandler.handleMessageEvent(_private.chatBarCache); - repeatTimer.stop() + repeatTimer.stop(); root.currentRoom.markAllMessagesAsRead(); textField.clear(); _private.chatBarCache.replyId = ""; - messageSent() + messageSent(); } function formatText(format, selectionStart, selectionEnd) { @@ -386,21 +389,19 @@ QQC2.Control { */ let innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart); if (innerText.charAt(innerText.length - 1) === " ") { - let trimmedRightString = innerText.replace(/\s*$/,""); + let trimmedRightString = innerText.replace(/\s*$/, ""); let trimDifference = innerText.length - trimmedRightString.length; selectionEnd -= trimDifference; } if (innerText.charAt(0) === " ") { - let trimmedLeftString = innerText.replace(/^\s*/,""); + let trimmedLeftString = innerText.replace(/^\s*/, ""); let trimDifference = innerText.length - trimmedLeftString.length; selectionStart = selectionStart + trimDifference; } - let startText = textField.text.substr(0, selectionStart); // Needs updating with the new selectionStart and selectionEnd with white space trimmed. innerText = textField.text.substr(selectionStart, selectionEnd - selectionStart); let endText = textField.text.substr(selectionEnd); - textField.text = ""; textField.text = startText + format.start + innerText + format.end + format.extra + endText; @@ -495,13 +496,14 @@ QQC2.Control { currentRoom: root.currentRoom onChosen: emoji => insertText(emoji) - onClosed: if (emojiAction.checked) emojiAction.checked = false + onClosed: if (emojiAction.checked) { + emojiAction.checked = false; + } } function insertText(text) { let initialCursorPosition = textField.cursorPosition; - - textField.text = textField.text.substr(0, initialCursorPosition) + text + textField.text.substr(initialCursorPosition) - textField.cursorPosition = initialCursorPosition + text.length + textField.text = textField.text.substr(0, initialCursorPosition) + text + textField.text.substr(initialCursorPosition); + textField.cursorPosition = initialCursorPosition + text.length; } } diff --git a/src/qml/ChooseRoomDialog.qml b/src/qml/ChooseRoomDialog.qml index ee17240ee..f3b85a62d 100644 --- a/src/qml/ChooseRoomDialog.qml +++ b/src/qml/ChooseRoomDialog.qml @@ -32,7 +32,7 @@ Kirigami.ScrollablePage { id: roomDelegate filterText: "" onSelected: { - root.chosen(roomDelegate.currentRoom.id) + root.chosen(roomDelegate.currentRoom.id); } connection: root.connection } diff --git a/src/qml/ColorScheme.qml b/src/qml/ColorScheme.qml index f81315e68..83ad7d3df 100644 --- a/src/qml/ColorScheme.qml +++ b/src/qml/ColorScheme.qml @@ -16,7 +16,7 @@ FormCard.FormComboBoxDelegate { textRole: "display" valueRole: "display" model: ColorSchemer.model - Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(Config.colorScheme); + Component.onCompleted: currentIndex = ColorSchemer.indexForScheme(Config.colorScheme) onCurrentValueChanged: { ColorSchemer.apply(currentIndex); Config.colorScheme = ColorSchemer.nameForIndex(currentIndex); diff --git a/src/qml/CompletionMenu.qml b/src/qml/CompletionMenu.qml index 39b15b294..f15b4de1f 100644 --- a/src/qml/CompletionMenu.qml +++ b/src/qml/CompletionMenu.qml @@ -21,7 +21,9 @@ QQC2.Popup { visible: completions.count > 0 - onVisibleChanged: if (visible) root.open() + onVisibleChanged: if (visible) { + root.open(); + } RoomListModel { id: roomListModel @@ -33,15 +35,15 @@ QQC2.Popup { } function incrementIndex() { - completions.incrementCurrentIndex() + completions.incrementCurrentIndex(); } function decrementIndex() { - completions.decrementCurrentIndex() + completions.decrementCurrentIndex(); } function complete() { - root.chatDocumentHandler.complete(completions.currentIndex) + root.chatDocumentHandler.complete(completions.currentIndex); } leftPadding: 0 diff --git a/src/qml/ConfirmDeactivateAccountDialog.qml b/src/qml/ConfirmDeactivateAccountDialog.qml index 08d19306f..67d4fd4de 100644 --- a/src/qml/ConfirmDeactivateAccountDialog.qml +++ b/src/qml/ConfirmDeactivateAccountDialog.qml @@ -35,8 +35,8 @@ FormCard.FormCardPage { icon.name: "emblem-warning" enabled: passwordField.text.length > 0 onClicked: { - root.connection.deactivateAccount(passwordField.text) - root.closeDialog() + root.connection.deactivateAccount(passwordField.text); + root.closeDialog(); } } } diff --git a/src/qml/ConfirmEncryptionDialog.qml b/src/qml/ConfirmEncryptionDialog.qml index 82b2146f1..432769d33 100644 --- a/src/qml/ConfirmEncryptionDialog.qml +++ b/src/qml/ConfirmEncryptionDialog.qml @@ -38,7 +38,7 @@ QQC2.Dialog { text: i18n("Activate Encryption") QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole onClicked: { - root.room.activateEncryption() + root.room.activateEncryption(); root.close(); } } diff --git a/src/qml/ContextMenu.qml b/src/qml/ContextMenu.qml index 848f2c5fd..882753107 100644 --- a/src/qml/ContextMenu.qml +++ b/src/qml/ContextMenu.qml @@ -21,7 +21,7 @@ Loader { property NeoChatRoom room required property NeoChatConnection connection - signal closed() + signal closed Component { id: regularMenu @@ -30,7 +30,7 @@ Loader { id: newWindow text: i18n("Open in New Window") icon.name: "window-new" - onTriggered: RoomManager.openWindow(room); + onTriggered: RoomManager.openWindow(room) visible: !Kirigami.Settings.isMobile } @@ -60,11 +60,11 @@ Loader { text: room.isDirectChat() ? i18nc("@action:inmenu", "Copy user's Matrix ID to Clipboard") : i18nc("@action:inmenu", "Copy Address to Clipboard") icon.name: "edit-copy" onTriggered: if (room.isDirectChat()) { - Clipboard.saveText(room.directChatRemoteUser.id) + Clipboard.saveText(room.directChatRemoteUser.id); } else if (room.canonicalAlias.length === 0) { - Clipboard.saveText(room.id) + Clipboard.saveText(room.id); } else { - Clipboard.saveText(room.canonicalAlias) + Clipboard.saveText(room.canonicalAlias); } } @@ -80,40 +80,40 @@ Loader { checked: room.pushNotificationState === PushNotificationState.Default enabled: room.pushNotificationState != PushNotificationState.Unknown onTriggered: { - room.pushNotificationState = PushNotificationState.Default + room.pushNotificationState = PushNotificationState.Default; } } QQC2.MenuItem { - text: i18nc("As in 'notify for all messages'","All") + text: i18nc("As in 'notify for all messages'", "All") icon.name: "notifications" checkable: true autoExclusive: true checked: room.pushNotificationState === PushNotificationState.All enabled: room.pushNotificationState != PushNotificationState.Unknown onTriggered: { - room.pushNotificationState = PushNotificationState.All + room.pushNotificationState = PushNotificationState.All; } } QQC2.MenuItem { - text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'","@Mentions and Keywords") + text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'", "@Mentions and Keywords") icon.name: "im-user" checkable: true autoExclusive: true checked: room.pushNotificationState === PushNotificationState.MentionKeyword enabled: room.pushNotificationState != PushNotificationState.Unknown onTriggered: { - room.pushNotificationState = PushNotificationState.MentionKeyword + room.pushNotificationState = PushNotificationState.MentionKeyword; } } QQC2.MenuItem { - text: i18nc("As in 'do not notify for any messages'","Off") + text: i18nc("As in 'do not notify for any messages'", "Off") icon.name: "notifications-disabled" checkable: true autoExclusive: true checked: room.pushNotificationState === PushNotificationState.Mute enabled: room.pushNotificationState != PushNotificationState.Unknown onTriggered: { - room.pushNotificationState = PushNotificationState.Mute + room.pushNotificationState = PushNotificationState.Mute; } } } @@ -121,7 +121,12 @@ Loader { QQC2.MenuItem { text: i18n("Room Settings") icon.name: "configure" - onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Room Settings") }) + onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: room, + connection: connection + }, { + title: i18n("Room Settings") + }) } QQC2.MenuSeparator {} @@ -133,7 +138,7 @@ Loader { } onClosed: { - root.closed() + root.closed(); } } } @@ -190,8 +195,13 @@ Loader { QQC2.ToolButton { icon.name: 'settings-configure' onClicked: { - QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) - drawer.close() + QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: room, + connection: root.connection + }, { + title: i18n("Room Settings") + }); + drawer.close(); } } } @@ -214,8 +224,8 @@ Loader { text: i18n("Leave Room") icon.name: "go-previous" onClicked: { - RoomManager.leaveRoom(room) - drawer.close() + RoomManager.leaveRoom(room); + drawer.close(); } Layout.fillWidth: true } diff --git a/src/qml/CreateRoomDialog.qml b/src/qml/CreateRoomDialog.qml index e5b77ef48..7658e1966 100644 --- a/src/qml/CreateRoomDialog.qml +++ b/src/qml/CreateRoomDialog.qml @@ -49,22 +49,30 @@ FormCard.FormCardPage { valueRole: "isSpace" Component.onCompleted: { - currentIndex = indexOfValue(root.isSpace) - roomTypeModel.append({"text": i18n("Room"), "isSpace": false}); - roomTypeModel.append({"text": i18n("Space"), "isSpace": true}); - roomTypeCombo.currentIndex = 0 - roomTypeCombo.isInitialising = false + currentIndex = indexOfValue(root.isSpace); + roomTypeModel.append({ + "text": i18n("Room"), + "isSpace": false + }); + roomTypeModel.append({ + "text": i18n("Space"), + "isSpace": true + }); + roomTypeCombo.currentIndex = 0; + roomTypeCombo.isInitialising = false; } onCurrentValueChanged: { if (!isInitialising) { - root.isSpace = currentValue + root.isSpace = currentValue; } } } FormCard.FormTextFieldDelegate { id: roomNameField label: i18n("Name:") - onAccepted: if (roomNameField.text.length > 0) roomTopicField.forceActiveFocus(); + onAccepted: if (roomNameField.text.length > 0) { + roomTopicField.forceActiveFocus(); + } } FormCard.FormTextFieldDelegate { @@ -88,8 +96,8 @@ FormCard.FormCardPage { } else { root.connection.createRoom(roomNameField.text, roomTopicField.text, root.parentId, newOfficialCheck.checked); } - root.newChild(roomNameField.text) - root.closeDialog() + root.newChild(roomNameField.text); + root.closeDialog(); } } } @@ -103,7 +111,11 @@ FormCard.FormCardPage { visible: !chosenRoomDelegate.visible text: i18nc("@action:button", "Pick room") onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.displayName = displayName; @@ -113,7 +125,7 @@ FormCard.FormCardPage { chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.visible = true; - }) + }); } } FormCard.AbstractFormDelegate { @@ -158,7 +170,7 @@ FormCard.FormCardPage { QQC2.Label { Layout.fillWidth: true visible: text - text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm," ") : "" + text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm, " ") : "" textFormat: Text.PlainText elide: Text.ElideRight wrapMode: Text.NoWrap @@ -182,7 +194,11 @@ FormCard.FormCardPage { } onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.displayName = displayName; @@ -192,7 +208,7 @@ FormCard.FormCardPage { chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.visible = true; - }) + }); } } FormCard.FormCheckDelegate { diff --git a/src/qml/DeviceDelegate.qml b/src/qml/DeviceDelegate.qml index bfc5cbab3..001e399cc 100644 --- a/src/qml/DeviceDelegate.qml +++ b/src/qml/DeviceDelegate.qml @@ -68,7 +68,7 @@ FormCard.AbstractFormDelegate { text: i18n("Cancel editing display name") icon.name: "edit-delete-remove" onTriggered: { - root.editDeviceName = false + root.editDeviceName = false; } }, Kirigami.Action { @@ -76,7 +76,7 @@ FormCard.AbstractFormDelegate { icon.name: "checkmark" visible: nameField.text !== root.displayName onTriggered: { - devicesModel.setName(root.id, nameField.text) + devicesModel.setName(root.id, nameField.text); } } ] @@ -104,7 +104,7 @@ FormCard.AbstractFormDelegate { text: i18n("Verify device") icon.name: "security-low-symbolic" onTriggered: { - devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id) + devicesModel.connection.startKeyVerificationSession(devicesModel.connection.localUserId, root.id); } } QQC2.ToolTip { @@ -119,8 +119,8 @@ FormCard.AbstractFormDelegate { text: i18n("Logout device") icon.name: "edit-delete-remove" onTriggered: { - passwordSheet.deviceId = root.id - passwordSheet.open() + passwordSheet.deviceId = root.id; + passwordSheet.open(); } } QQC2.ToolTip { diff --git a/src/qml/DevicesCard.qml b/src/qml/DevicesCard.qml index 19ee1cf88..119f86a52 100644 --- a/src/qml/DevicesCard.qml +++ b/src/qml/DevicesCard.qml @@ -44,6 +44,3 @@ ColumnLayout { } } } - - - diff --git a/src/qml/DevicesPage.qml b/src/qml/DevicesPage.qml index 75a8131b7..9096d2ed7 100644 --- a/src/qml/DevicesPage.qml +++ b/src/qml/DevicesPage.qml @@ -53,7 +53,7 @@ FormCard.FormCardPage { FormCard.AbstractFormDelegate { Layout.fillWidth: true visible: root.connection && devicesModel.count === 0 // We can assume 0 means loading since there is at least one device - contentItem: Kirigami.LoadingPlaceholder { } + contentItem: Kirigami.LoadingPlaceholder {} } Kirigami.InlineMessage { @@ -87,9 +87,9 @@ FormCard.FormCardPage { text: i18nc("As in 'Remove this device'", "Remove") icon.name: "delete" onTriggered: { - devicesModel.logout(passwordSheet.deviceId, passwordField.text) - passwordField.text = "" - passwordSheet.close() + devicesModel.logout(passwordSheet.deviceId, passwordField.text); + passwordField.text = ""; + passwordSheet.close(); } } ] diff --git a/src/qml/DirectChatDrawerHeader.qml b/src/qml/DirectChatDrawerHeader.qml index 96d053c1b..38130c915 100644 --- a/src/qml/DirectChatDrawerHeader.qml +++ b/src/qml/DirectChatDrawerHeader.qml @@ -33,12 +33,12 @@ ColumnLayout { Layout.alignment: Qt.AlignHCenter onClicked: { - RoomManager.resolveResource(root.room.directChatRemoteUser.id, "mention") + RoomManager.resolveResource(root.room.directChatRemoteUser.id, "mention"); } contentItem: KirigamiComponents.Avatar { name: root.room ? root.room.displayName : "" - source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : "" + source: root.room ? ("image://mxc/" + root.room.avatarMediaId) : "" Rectangle { visible: root.room.usesEncryption diff --git a/src/qml/EditMenu.qml b/src/qml/EditMenu.qml index df9cd61e8..a63334898 100644 --- a/src/qml/EditMenu.qml +++ b/src/qml/EditMenu.qml @@ -15,8 +15,8 @@ Labs.Menu { text: i18nc("text editing menu action", "Undo") shortcut: StandardKey.Undo onTriggered: { - root.field.undo() - root.close() + root.field.undo(); + root.close(); } } @@ -25,21 +25,20 @@ Labs.Menu { text: i18nc("text editing menu action", "Redo") shortcut: StandardKey.Redo onTriggered: { - root.field.undo() - root.close() + root.field.undo(); + root.close(); } } - Labs.MenuSeparator { - } + Labs.MenuSeparator {} Labs.MenuItem { enabled: root.field !== null && root.field.selectedText text: i18nc("text editing menu action", "Cut") shortcut: StandardKey.Cut onTriggered: { - root.field.cut() - root.close() + root.field.cut(); + root.close(); } } @@ -48,8 +47,8 @@ Labs.Menu { text: i18nc("text editing menu action", "Copy") shortcut: StandardKey.Copy onTriggered: { - root.field.copy() - root.close() + root.field.copy(); + root.close(); } } @@ -58,8 +57,8 @@ Labs.Menu { text: i18nc("text editing menu action", "Paste") shortcut: StandardKey.Paste onTriggered: { - root.field.paste() - root.close() + root.field.paste(); + root.close(); } } @@ -68,21 +67,20 @@ Labs.Menu { text: i18nc("text editing menu action", "Delete") shortcut: "" onTriggered: { - root.field.remove(root.field.selectionStart, root.field.selectionEnd) - root.close() + root.field.remove(root.field.selectionStart, root.field.selectionEnd); + root.close(); } } - Labs.MenuSeparator { - } + Labs.MenuSeparator {} Labs.MenuItem { enabled: root.field !== null text: i18nc("text editing menu action", "Select All") shortcut: StandardKey.SelectAll onTriggered: { - root.field.selectAll() - root.close() + root.field.selectAll(); + root.close(); } } } diff --git a/src/qml/Email.qml b/src/qml/Email.qml index a1bc4f0c0..cbceb2fb5 100644 --- a/src/qml/Email.qml +++ b/src/qml/Email.qml @@ -12,7 +12,9 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) emailField.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) { + emailField.forceActiveFocus(); + } FormCard.FormTextFieldDelegate { id: emailField @@ -21,7 +23,7 @@ LoginStep { onTextChanged: Registration.email = text Keys.onReturnPressed: { if (root.nextAction.enabled) { - root.nextAction.trigger() + root.nextAction.trigger(); } } } @@ -44,11 +46,11 @@ LoginStep { enabled: emailField.text.length > 0 onTriggered: { if (confirmMessage.visible) { - Registration.registerAccount() + Registration.registerAccount(); } else { - Registration.registerEmail() - confirmMessage.visible = true - resendButton.visible = true + Registration.registerEmail(); + confirmMessage.visible = true; + resendButton.visible = true; } } } diff --git a/src/qml/EmojiDialog.qml b/src/qml/EmojiDialog.qml index c85fad4d3..ea731f0d3 100644 --- a/src/qml/EmojiDialog.qml +++ b/src/qml/EmojiDialog.qml @@ -25,16 +25,16 @@ QQC2.Popup { Connections { target: RoomManager function onCurrentRoomChanged() { - root.close() + root.close(); } } onVisibleChanged: { if (!visible) { - emojiPicker.clearSearchField() - return + emojiPicker.clearSearchField(); + return; } - emojiPicker.forceActiveFocus() + emojiPicker.forceActiveFocus(); } background: Kirigami.ShadowedRectangle { @@ -68,8 +68,10 @@ QQC2.Popup { includeCustom: root.includeCustom showQuickReaction: root.showQuickReaction onChosen: emoji => { - root.chosen(emoji) - if (root.closeOnChosen) root.close() + root.chosen(emoji); + if (root.closeOnChosen) { + root.close(); + } } } } diff --git a/src/qml/EmojiGrid.qml b/src/qml/EmojiGrid.qml index 593d33c84..dbda8a6f9 100644 --- a/src/qml/EmojiGrid.qml +++ b/src/qml/EmojiGrid.qml @@ -22,7 +22,7 @@ QQC2.ScrollView { signal stickerChosen(int index) onActiveFocusChanged: if (activeFocus) { - emojis.forceActiveFocus() + emojis.forceActiveFocus(); } GridView { @@ -34,9 +34,9 @@ QQC2.ScrollView { currentIndex: -1 keyNavigationEnabled: true onActiveFocusChanged: if (activeFocus && currentIndex === -1) { - currentIndex = 0 + currentIndex = 0; } else { - currentIndex = -1 + currentIndex = -1; } onModelChanged: currentIndex = -1 @@ -61,19 +61,23 @@ QQC2.ScrollView { Keys.onReturnPressed: clicked() onClicked: { if (root.stickers) { - root.stickerChosen(model.index) + root.stickerChosen(model.index); } - root.chosen(modelData.isCustom ? modelData.shortName : modelData.unicode) - EmojiModel.emojiUsed(modelData) + root.chosen(modelData.isCustom ? modelData.shortName : modelData.unicode); + EmojiModel.emojiUsed(modelData); } Keys.onSpacePressed: pressAndHold() onPressAndHold: { if (EmojiModel.tones(modelData.shortName).length === 0) { return; } - let tones = tonesPopupComponent.createObject(emojiDelegate, {shortName: modelData.shortName, unicode: modelData.unicode, categoryIconSize: root.targetIconSize}) - tones.open() - tones.forceActiveFocus() + let tones = tonesPopupComponent.createObject(emojiDelegate, { + shortName: modelData.shortName, + unicode: modelData.unicode, + categoryIconSize: root.targetIconSize + }); + tones.open(); + tones.forceActiveFocus(); } showTones: !!modelData && EmojiModel.tones(modelData.shortName).length > 0 } diff --git a/src/qml/EmojiPicker.qml b/src/qml/EmojiPicker.qml index ac6c18e89..1a169740e 100644 --- a/src/qml/EmojiPicker.qml +++ b/src/qml/EmojiPicker.qml @@ -20,9 +20,9 @@ ColumnLayout { readonly property var currentEmojiModel: { if (includeCustom) { - EmojiModel.categoriesWithCustom + EmojiModel.categoriesWithCustom; } else { - EmojiModel.categories + EmojiModel.categories; } } @@ -73,8 +73,12 @@ ColumnLayout { focus: true orientation: ListView.Horizontal - Keys.onReturnPressed: if (emojiGrid.count > 0) emojiGrid.focus = true - Keys.onEnterPressed: if (emojiGrid.count > 0) emojiGrid.focus = true + Keys.onReturnPressed: if (emojiGrid.count > 0) { + emojiGrid.focus = true; + } + Keys.onEnterPressed: if (emojiGrid.count > 0) { + emojiGrid.focus = true; + } KeyNavigation.down: emojiGrid.count > 0 ? emojiGrid : categories KeyNavigation.tab: emojiGrid.count > 0 ? emojiGrid : categories @@ -208,6 +212,6 @@ ColumnLayout { } function clearSearchField() { - searchField.text = "" + searchField.text = ""; } } diff --git a/src/qml/EmojiSas.qml b/src/qml/EmojiSas.qml index 454ed7a81..6f703131b 100644 --- a/src/qml/EmojiSas.qml +++ b/src/qml/EmojiSas.qml @@ -15,8 +15,8 @@ Column { required property var model - signal accept() - signal reject() + signal accept + signal reject visible: dialog.session.state === KeyVerificationSession.WAITINGFORVERIFICATION anchors.centerIn: parent @@ -46,7 +46,7 @@ Column { anchors.bottom: parent.bottom text: i18n("They don't match") icon.name: "dialog-cancel" - onClicked: root.reject() + onClicked: root.reject() } } } diff --git a/src/qml/EmojiTonesPicker.qml b/src/qml/EmojiTonesPicker.qml index ba846d86e..b7114a27d 100644 --- a/src/qml/EmojiTonesPicker.qml +++ b/src/qml/EmojiTonesPicker.qml @@ -63,9 +63,9 @@ QQC2.Popup { Keys.onEnterPressed: clicked() Keys.onReturnPressed: clicked() onClicked: { - root.chosen(modelData.unicode) - EmojiModel.emojiUsed(modelData) - root.close() + root.chosen(modelData.unicode); + EmojiModel.emojiUsed(modelData); + root.close(); } } } diff --git a/src/qml/EmoticonEditorPage.qml b/src/qml/EmoticonEditorPage.qml index 9360931ba..0f9cd793a 100644 --- a/src/qml/EmoticonEditorPage.qml +++ b/src/qml/EmoticonEditorPage.qml @@ -24,8 +24,7 @@ FormCard.FormCardPage { property bool newEmoticon: false required property var emoticonType - title: emoticonType === EmoticonFormCard.Stickers ? (newEmoticon ? i18nc("@title", "Add Sticker") : i18nc("@title", "Edit Sticker")) - : (newEmoticon ? i18nc("@title", "Add Emoji") : i18nc("@title", "Edit Emoji")) + title: emoticonType === EmoticonFormCard.Stickers ? (newEmoticon ? i18nc("@title", "Add Sticker") : i18nc("@title", "Edit Sticker")) : (newEmoticon ? i18nc("@title", "Add Emoji") : i18nc("@title", "Edit Emoji")) FormCard.FormHeader { title: emoticonType === EmoticonFormCard.Stickers ? i18n("Sticker") : i18n("Emoji") @@ -67,23 +66,22 @@ FormCard.FormCardPage { MouseArea { id: mouseArea anchors.fill: parent - property var fileDialog: null; + property var fileDialog: null cursorShape: Qt.PointingHandCursor onClicked: { if (fileDialog != null) { return; } - - fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.Overlay) - fileDialog.chosen.connect(function(receivedSource) { + fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.Overlay); + fileDialog.chosen.connect(function (receivedSource) { mouseArea.fileDialog = null; if (!receivedSource) { return; } parent.source = receivedSource; }); - fileDialog.onRejected.connect(function() { + fileDialog.onRejected.connect(function () { mouseArea.fileDialog = null; }); fileDialog.open(); @@ -112,19 +110,19 @@ FormCard.FormCardPage { enabled: !root.newEmoticon || (image.source.toString().length > 0 && shortcode.text && description.text) onClicked: { if (root.newEmoticon) { - model.addEmoticon(image.source, shortcode.text, description.text, emoticonType === EmoticonFormCard.Stickers ? "sticker" : "emoticon") + model.addEmoticon(image.source, shortcode.text, description.text, emoticonType === EmoticonFormCard.Stickers ? "sticker" : "emoticon"); } else { if (description.text !== root.description) { - root.model.setEmoticonBody(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, description.text) + root.model.setEmoticonBody(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, description.text); } if (shortcode.text !== root.shortcode) { - root.model.setEmoticonShortcode(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, shortcode.text) + root.model.setEmoticonShortcode(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, shortcode.text); } if (image.source + "" !== root.url) { - root.model.setEmoticonImage(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, image.source) + root.model.setEmoticonImage(proxyModel.mapToSource(proxyModel.index(model.index, 0)).row, image.source); } } - root.closeDialog() + root.closeDialog(); } } } diff --git a/src/qml/EmoticonFormCard.qml b/src/qml/EmoticonFormCard.qml index 248719268..c2636cfc7 100644 --- a/src/qml/EmoticonFormCard.qml +++ b/src/qml/EmoticonFormCard.qml @@ -51,7 +51,7 @@ FormCard.FormCard { emoticonType: root.emoticonType }, { title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Edit Emoji") : i18nc("@title", "Edit Sticker") - }); + }) contentItem: ColumnLayout { Image { @@ -101,7 +101,7 @@ FormCard.FormCard { emoticonType: root.emoticonType }, { title: root.emoticonType === EmoticonFormCard.Emojis ? i18nc("@title", "Add Emoji") : i18nc("@title", "Add Sticker") - }); + }) contentItem: ColumnLayout { spacing: 0 Kirigami.Icon { diff --git a/src/qml/EmoticonsPage.qml b/src/qml/EmoticonsPage.qml index caf7b59c9..8e89823c8 100644 --- a/src/qml/EmoticonsPage.qml +++ b/src/qml/EmoticonsPage.qml @@ -31,7 +31,6 @@ FormCard.FormCardPage { connection: root.connection } - property Component emoticonEditorPage: Component { id: emoticonEditorPage EmoticonEditorPage {} diff --git a/src/qml/ExploreComponent.qml b/src/qml/ExploreComponent.qml index 973b3c76d..fc0a74cca 100644 --- a/src/qml/ExploreComponent.qml +++ b/src/qml/ExploreComponent.qml @@ -21,22 +21,34 @@ RowLayout { text: i18n("Explore rooms") icon.name: "compass" onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { - RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") - }) + RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); + }); } } property Kirigami.Action chatAction: Kirigami.Action { text: i18n("Find your friends") icon.name: "list-add-user" - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Find your friends") + }) } property Kirigami.Action roomAction: Kirigami.Action { text: i18n("Create a Room") icon.name: "system-users-symbolic" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Room")}) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Create a Room") + }); } shortcut: StandardKey.New } @@ -44,7 +56,13 @@ RowLayout { text: i18n("Create a Space") icon.name: "list-add" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space")}, {title: i18nc("@title", "Create a Space")}) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + connection: root.connection, + isSpace: true, + title: i18nc("@title", "Create a Space") + }, { + title: i18nc("@title", "Create a Space") + }); } } @@ -72,7 +90,7 @@ RowLayout { menu.open(); } else { const menu = desktopMenu.createObject(menuButton); - menu.closed.connect(menuButton.toggle) + menu.closed.connect(menuButton.toggle); menu.open(); } } diff --git a/src/qml/ExploreComponentMobile.qml b/src/qml/ExploreComponentMobile.qml index fd5c213d4..023198b07 100644 --- a/src/qml/ExploreComponentMobile.qml +++ b/src/qml/ExploreComponentMobile.qml @@ -52,10 +52,14 @@ ColumnLayout { text: i18n("Explore rooms") icon.name: "compass" onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { - RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") - }) + RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); + }); exploreTabBar.currentIndex = -1; } }, @@ -63,7 +67,11 @@ ColumnLayout { text: i18n("Find your friends") icon.name: "list-add-user" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Find your friends") + }); exploreTabBar.currentIndex = -1; } }, @@ -132,8 +140,12 @@ ColumnLayout { text: i18n("Create a Room") icon.name: "system-users-symbolic" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection}, {title: i18nc("@title", "Create a Room")}) - explorePopup.close() + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Create a Room") + }); + explorePopup.close(); } shortcut: StandardKey.New } @@ -144,8 +156,14 @@ ColumnLayout { text: i18n("Create a Space") icon.name: "list-add" onTriggered: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space")}, {title: i18nc("@title", "Create a Space")}) - explorePopup.close() + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + connection: root.connection, + isSpace: true, + title: i18nc("@title", "Create a Space") + }, { + title: i18nc("@title", "Create a Space") + }); + explorePopup.close(); } } } diff --git a/src/qml/ExploreRoomsPage.qml b/src/qml/ExploreRoomsPage.qml index 4ea8efbd3..bc1539e83 100644 --- a/src/qml/ExploreRoomsPage.qml +++ b/src/qml/ExploreRoomsPage.qml @@ -41,13 +41,7 @@ SearchPage { * upon as required, e.g. joining or entering the room or adding the room as * the child of a space. */ - signal roomSelected(string roomId, - string displayName, - url avatarUrl, - string alias, - string topic, - int memberCount, - bool isJoined) + signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined) title: i18nc("@action:title", "Explore Rooms") @@ -101,7 +95,9 @@ SearchPage { QtObject { id: _private function openManualRoomDialog() { - let dialog = manualRoomDialog.createObject(applicationWindow().overlay, {connection: root.connection}); + let dialog = manualRoomDialog.createObject(applicationWindow().overlay, { + connection: root.connection + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { root.roomSelected(roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined); root.closeDialog(); diff --git a/src/qml/ExplorerDelegate.qml b/src/qml/ExplorerDelegate.qml index d27a02394..c097d7270 100644 --- a/src/qml/ExplorerDelegate.qml +++ b/src/qml/ExplorerDelegate.qml @@ -30,25 +30,13 @@ Delegates.RoundedItemDelegate { * upon as required, e.g. joining or entering the room or adding the room as * the child of a space. */ - signal roomSelected(string roomId, - string displayName, - url avatarUrl, - string alias, - string topic, - int memberCount, - bool isJoined) + signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined) onClicked: { if (!isJoined) { justJoined = true; } - root.roomSelected(root.roomId, - root.displayName, - root.avatarUrl, - root.alias, - root.topic, - root.memberCount, - root.isJoined) + root.roomSelected(root.roomId, root.displayName, root.avatarUrl, root.alias, root.topic, root.memberCount, root.isJoined); } contentItem: RowLayout { @@ -85,7 +73,7 @@ Delegates.RoundedItemDelegate { QQC2.Label { Layout.fillWidth: true visible: text - text: root.topic ? root.topic.replace(/(\r\n\t|\n|\r\t)/gm," ") : "" + text: root.topic ? root.topic.replace(/(\r\n\t|\n|\r\t)/gm, " ") : "" textFormat: Text.PlainText elide: Text.ElideRight wrapMode: Text.NoWrap diff --git a/src/qml/FancyEffectsContainer.qml b/src/qml/FancyEffectsContainer.qml index 477c37b69..90f845dbd 100644 --- a/src/qml/FancyEffectsContainer.qml +++ b/src/qml/FancyEffectsContainer.qml @@ -10,33 +10,33 @@ import org.kde.kirigami as Kirigami Item { id: root property bool enabled: false - property int effectInterval: Kirigami.Units.veryLongDuration*10; + property int effectInterval: Kirigami.Units.veryLongDuration * 10 property color darkSnowColor: "grey" property bool isThemeDark: Kirigami.Theme.backgroundColor.hslLightness <= darkSnowColor.hslLightness function showConfettiEffect() { - confettiTimer.start() + confettiTimer.start(); } function showSnowEffect() { - snowTimer.start() + snowTimer.start(); } function showFireworksEffect() { - fireworksTimer.start() + fireworksTimer.start(); } // Confetti Timer { id: confettiTimer - interval: root.effectInterval; - running: false; - repeat: false; - triggeredOnStart: true; + interval: root.effectInterval + running: false + repeat: false + triggeredOnStart: true onTriggered: { if (root.enabled) { - confettiSystem.running = !confettiSystem.running + confettiSystem.running = !confettiSystem.running; } } } @@ -48,15 +48,17 @@ Item { running: false onRunningChanged: { if (running) { - opacity = 1 + opacity = 1; } else { - opacity = 0 + opacity = 0; } } Behavior on opacity { SequentialAnimation { - NumberAnimation { duration: Kirigami.Units.longDuration } + NumberAnimation { + duration: Kirigami.Units.longDuration + } } } @@ -76,8 +78,8 @@ Item { top: parent.top } - sizeVariation: Kirigami.Units.iconSizes.small/2 - lifeSpan: Kirigami.Units.veryLongDuration*10 + sizeVariation: Kirigami.Units.iconSizes.small / 2 + lifeSpan: Kirigami.Units.veryLongDuration * 10 size: Kirigami.Units.iconSizes.small velocity: AngleDirection { @@ -92,13 +94,13 @@ Item { Timer { id: snowTimer - interval: root.effectInterval; - running: false; - repeat: false; - triggeredOnStart: true; + interval: root.effectInterval + running: false + repeat: false + triggeredOnStart: true onTriggered: { if (root.enabled) { - snowSystem.running = !snowSystem.running + snowSystem.running = !snowSystem.running; } } } @@ -110,15 +112,17 @@ Item { running: false onRunningChanged: { if (running) { - opacity = 1 + opacity = 1; } else { - opacity = 0 + opacity = 0; } } Behavior on opacity { SequentialAnimation { - NumberAnimation { duration: Kirigami.Units.longDuration } + NumberAnimation { + duration: Kirigami.Units.longDuration + } } } @@ -141,7 +145,7 @@ Item { } sizeVariation: Kirigami.Units.iconSizes.medium - lifeSpan: Kirigami.Units.veryLongDuration*10 + lifeSpan: Kirigami.Units.veryLongDuration * 10 size: Kirigami.Units.iconSizes.large emitRate: 42 @@ -157,13 +161,13 @@ Item { Timer { id: fireworksTimer - interval: root.effectInterval; - running: false; - repeat: false; - triggeredOnStart: true; + interval: root.effectInterval + running: false + repeat: false + triggeredOnStart: true onTriggered: { if (root.enabled) { - fireworksInternalTimer.running = !fireworksInternalTimer.running + fireworksInternalTimer.running = !fireworksInternalTimer.running; } } } @@ -175,11 +179,11 @@ Item { running: false repeat: true onTriggered: { - var x = Math.random() * parent.width - var y = Math.random() * parent.height - customEmit(x, y) - customEmit(x, y) - customEmit(x, y) + var x = Math.random() * parent.width; + var y = Math.random() * parent.height; + customEmit(x, y); + customEmit(x, y); + customEmit(x, y); } } @@ -189,15 +193,17 @@ Item { running: fireworksInternalTimer.running onRunningChanged: { if (running) { - opacity = 1 + opacity = 1; } else { - opacity = 0 + opacity = 0; } } Behavior on opacity { SequentialAnimation { - NumberAnimation { duration: Kirigami.Units.longDuration } + NumberAnimation { + duration: Kirigami.Units.longDuration + } } } } @@ -256,39 +262,42 @@ Item { running: true onTriggered: { container.destroy(); - var randomHue = Math.random() - var lightness = root.isThemeDark ? 0.8 : 0.7 - fireworksParticleA.color = Qt.hsla(randomHue, 0.8, lightness, 1) - fireworksParticleB.color = Qt.hsla(1-randomHue, 0.8, lightness, 1) + var randomHue = Math.random(); + var lightness = root.isThemeDark ? 0.8 : 0.7; + fireworksParticleA.color = Qt.hsla(randomHue, 0.8, lightness, 1); + fireworksParticleB.color = Qt.hsla(1 - randomHue, 0.8, lightness, 1); } } - velocity: AngleDirection {angleVariation:360; magnitude: 200} + velocity: AngleDirection { + angleVariation: 360 + magnitude: 200 + } } } - function customEmit(x,y) { - var currentSize = Math.round(Math.random() * 200) + 40 - var currentLifeSpan = Math.round(Math.random() * 1000) + 100 - for (var i=0; i<8; i++) { + function customEmit(x, y) { + var currentSize = Math.round(Math.random() * 200) + 40; + var currentLifeSpan = Math.round(Math.random() * 1000) + 100; + for (var i = 0; i < 8; i++) { var obj = emitterComp.createObject(parent); - obj.x = x - obj.y = y - obj.targetX = Math.random() * currentSize - currentSize/2 + obj.x - obj.targetY = Math.random() * currentSize - currentSize/2 + obj.y - obj.life = Math.round(Math.random() * 23) + 150 - obj.emitRate = Math.round(Math.random() * 32) + 5 - obj.lifeSpan = currentLifeSpan + obj.x = x; + obj.y = y; + obj.targetX = Math.random() * currentSize - currentSize / 2 + obj.x; + obj.targetY = Math.random() * currentSize - currentSize / 2 + obj.y; + obj.life = Math.round(Math.random() * 23) + 150; + obj.emitRate = Math.round(Math.random() * 32) + 5; + obj.lifeSpan = currentLifeSpan; const group = Math.round(Math.random() * 3); switch (group) { - case 0: - obj.group = "light"; - break; - case 1: - obj.group = "a"; - break; - case 2: - obj.group = "b"; - break; + case 0: + obj.group = "light"; + break; + case 1: + obj.group = "a"; + break; + case 2: + obj.group = "b"; + break; } } } diff --git a/src/qml/FileDelegate.qml b/src/qml/FileDelegate.qml index cdb25a881..79d569d83 100644 --- a/src/qml/FileDelegate.qml +++ b/src/qml/FileDelegate.qml @@ -43,7 +43,7 @@ MessageDelegate { property bool autoOpenFile: false onDownloadedChanged: { - itineraryModel.path = root.progressInfo.localPath + itineraryModel.path = root.progressInfo.localPath; if (autoOpenFile) { openSavedFile(); } @@ -52,9 +52,9 @@ MessageDelegate { onOpenContextMenu: RoomManager.viewEventMenu(eventId, author, delegateType, plainText, "", "", mediaInfo.mimeType, progressInfo) function saveFileAs() { - const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay) - dialog.open() - dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId) + const dialog = fileDialog.createObject(QQC2.ApplicationWindow.overlay); + dialog.open(); + dialog.currentFile = dialog.folder + "/" + root.room.fileNameToDownload(root.eventId); } function openSavedFile() { @@ -183,10 +183,10 @@ MessageDelegate { fileMode: FileDialog.SaveFile folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) onAccepted: { - Config.lastSaveDirectory = folder - Config.save() + Config.lastSaveDirectory = folder; + Config.save(); if (autoOpenFile) { - UrlHelper.copyTo(root.progressInfo.localPath, file) + UrlHelper.copyTo(root.progressInfo.localPath, file); } else { root.room.download(root.eventId, file); } @@ -213,9 +213,9 @@ MessageDelegate { text: model.name } QQC2.Label { - text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : "" - visible: model.coach - opacity: 0.7 + text: model.coach ? i18n("Coach: %1, Seat: %2", model.coach, model.seat) : "" + visible: model.coach + opacity: 0.7 } } RowLayout { @@ -234,7 +234,7 @@ MessageDelegate { } ColumnLayout { QQC2.Label { - text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "") + text: model.arrivalStation + (model.arrivalPlatform ? (" [" + model.arrivalPlatform + "]") : "") } QQC2.Label { text: model.arrivalTime diff --git a/src/qml/FileDelegateContextMenu.qml b/src/qml/FileDelegateContextMenu.qml index 76bbbf5df..b0fed700a 100644 --- a/src/qml/FileDelegateContextMenu.qml +++ b/src/qml/FileDelegateContextMenu.qml @@ -43,16 +43,16 @@ MessageDelegateContextMenu { text: i18n("Open Externally") icon.name: "document-open" onTriggered: { - currentRoom.openEventMediaExternally(root.eventId) + currentRoom.openEventMediaExternally(root.eventId); } }, Kirigami.Action { text: i18n("Save As") icon.name: "document-save" onTriggered: { - var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay) - dialog.open() - dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(eventId) + var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay); + dialog.open(); + dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(eventId); } }, Kirigami.Action { @@ -61,14 +61,14 @@ MessageDelegateContextMenu { onTriggered: { currentRoom.mainCache.replyId = eventId; currentRoom.editCache.editId = ""; - RoomManager.requestFullScreenClose() + RoomManager.requestFullScreenClose(); } }, Kirigami.Action { text: i18n("Copy") icon.name: "edit-copy" onTriggered: { - currentRoom.copyEventMedia(root.eventId) + currentRoom.copyEventMedia(root.eventId); } }, Kirigami.Action { @@ -76,7 +76,10 @@ MessageDelegateContextMenu { text: i18n("Remove") icon.name: "edit-delete-remove" icon.color: "red" - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", { + room: currentRoom, + eventId: eventId + }, { title: i18nc("@title", "Remove Message"), width: Kirigami.Units.gridUnit * 25 }) @@ -85,7 +88,10 @@ MessageDelegateContextMenu { text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") icon.name: "dialog-warning-symbolic" visible: author.id !== currentRoom.localUser.id - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", { + room: currentRoom, + eventId: eventId + }, { title: i18nc("@title", "Report Message"), width: Kirigami.Units.gridUnit * 25 }) @@ -109,10 +115,10 @@ MessageDelegateContextMenu { 'urls': [], 'mimeType': [root.mimeType] } - property string filename: StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(eventId); + property string filename: StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + eventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(eventId) doBeforeSharing: () => { - currentRoom.downloadFile(eventId, filename) + currentRoom.downloadFile(eventId, filename); } Component.onCompleted: { shareAction.inputData = { @@ -132,9 +138,9 @@ MessageDelegateContextMenu { if (!currentFile) { return; } - Config.lastSaveDirectory = folder - Config.save() - currentRoom.downloadFile(eventId, currentFile) + Config.lastSaveDirectory = folder; + Config.save(); + currentRoom.downloadFile(eventId, currentFile); } } } diff --git a/src/qml/FullScreenMap.qml b/src/qml/FullScreenMap.qml index 3d84b4017..c89911b40 100644 --- a/src/qml/FullScreenMap.qml +++ b/src/qml/FullScreenMap.qml @@ -36,8 +36,7 @@ ApplicationWindow { MapView { id: mapView anchors.fill: parent - map.center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) - : QtPositioning.coordinate(root.latitude, root.longitude) + map.center: root.liveLocationModel ? QtPositioning.coordinate(root.liveLocationModel.boundingBox.y, root.liveLocationModel.boundingBox.x) : QtPositioning.coordinate(root.latitude, root.longitude) map.zoomLevel: 15 map.plugin: OsmLocationPlugin.plugin LocationMapItem { @@ -57,7 +56,7 @@ ApplicationWindow { Connections { target: mapView.map function onCopyrightLinkActivated() { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } } } diff --git a/src/qml/General.qml b/src/qml/General.qml index 762e28bc8..bb72635f8 100644 --- a/src/qml/General.qml +++ b/src/qml/General.qml @@ -48,15 +48,13 @@ FormCard.FormCardPage { display: QQC2.AbstractButton.IconOnly onClicked: { - const fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay) - - fileDialog.chosen.connect(function(path) { - if (!path) return - - room.changeAvatar(path) - }) - - fileDialog.open() + const fileDialog = openFileDialog.createObject(QQC2.ApplicationWindow.overlay); + fileDialog.chosen.connect(function (path) { + if (!path) + return; + room.changeAvatar(path); + }); + fileDialog.open(); } QQC2.ToolTip.text: text @@ -107,11 +105,10 @@ FormCard.FormCardPage { text: i18n("Save") onClicked: { if (room.name != roomNameField.text) { - room.setName(roomNameField.text) + room.setName(roomNameField.text); } - if (room.topic != roomTopicField.text) { - room.setTopic(roomTopicField.text) + room.setTopic(roomTopicField.text); } } } @@ -129,7 +126,7 @@ FormCard.FormCardPage { display: QQC2.AbstractButton.IconOnly onClicked: { - Clipboard.saveText(room.id) + Clipboard.saveText(room.id); } QQC2.ToolTip.text: text @@ -149,8 +146,8 @@ FormCard.FormCardPage { onClicked: { if (room.canSwitchVersions()) { - roomUpgradeSheet.currentRoomVersion = room.version - roomUpgradeSheet.open() + roomUpgradeSheet.currentRoomVersion = room.version; + roomUpgradeSheet.open(); } } @@ -186,7 +183,7 @@ FormCard.FormCardPage { display: QQC2.AbstractButton.IconOnly onClicked: { - room.setCanonicalAlias(modelData) + room.setCanonicalAlias(modelData); } QQC2.ToolTip { text: setCanonicalAliasButton.text @@ -201,7 +198,7 @@ FormCard.FormCardPage { display: QQC2.AbstractButton.IconOnly onClicked: { - room.unmapAlias(modelData) + room.unmapAlias(modelData); } QQC2.ToolTip { text: deleteButton.text @@ -209,13 +206,12 @@ FormCard.FormCardPage { } } ] - } } FormCard.AbstractFormDelegate { visible: room.canSendState("m.room.canonical_alias") - contentItem : RowLayout { + contentItem: RowLayout { Kirigami.ActionTextField { id: aliasAddField @@ -227,12 +223,12 @@ FormCard.FormCardPage { icon.name: "edit-clear" visible: aliasAddField.text.length > 0 onTriggered: { - aliasAddField.text = "" + aliasAddField.text = ""; } } onAccepted: { - room.mapAlias(aliasAddField.text) + room.mapAlias(aliasAddField.text); } } QQC2.Button { @@ -245,7 +241,7 @@ FormCard.FormCardPage { enabled: aliasAddField.text.length > 0 onClicked: { - room.mapAlias(aliasAddField.text) + room.mapAlias(aliasAddField.text); } QQC2.ToolTip { @@ -266,7 +262,7 @@ FormCard.FormCardPage { checked: room.defaultUrlPreviewState visible: room.canSendState("org.matrix.room.preview_urls") onToggled: { - room.defaultUrlPreviewState = checked + room.defaultUrlPreviewState = checked; } } FormCard.FormCheckDelegate { @@ -275,7 +271,7 @@ FormCard.FormCardPage { description: room.defaultUrlPreviewState ? i18n("URL previews are enabled by default in this room") : i18n("URL previews are disabled by default in this room") checked: room.urlPreviewEnabled onToggled: { - room.urlPreviewEnabled = checked + room.urlPreviewEnabled = checked; } } } @@ -353,7 +349,7 @@ FormCard.FormCardPage { FormCard.FormButtonDelegate { visible: root.room.canSendState("m.space.parent") text: i18nc("@action:button", "Add new official parent") - onClicked: selectParentDialog.createObject(applicationWindow().overlay).open(); + onClicked: selectParentDialog.createObject(applicationWindow().overlay).open() Component { id: selectParentDialog @@ -418,11 +414,10 @@ FormCard.FormCardPage { QQC2.Button { text: i18n("Confirm") onClicked: { - room.switchVersion(spinBox.value) - roomUpgradeSheet.close() + room.switchVersion(spinBox.value); + roomUpgradeSheet.close(); } } } } } - diff --git a/src/qml/GeneralSettingsPage.qml b/src/qml/GeneralSettingsPage.qml index 87d4f614a..879e18630 100644 --- a/src/qml/GeneralSettingsPage.qml +++ b/src/qml/GeneralSettingsPage.qml @@ -26,12 +26,15 @@ FormCard.FormCardPage { visible: Controller.supportSystemTray enabled: !Config.isSystemTrayImmutable onToggled: { - Config.systemTray = checked - Config.save() + Config.systemTray = checked; + Config.save(); } } - FormCard.FormDelegateSeparator { above: closeDelegate; below: minimizeDelegate } + FormCard.FormDelegateSeparator { + above: closeDelegate + below: minimizeDelegate + } FormCard.FormCheckDelegate { id: minimizeDelegate @@ -40,12 +43,15 @@ FormCard.FormCardPage { visible: Controller.supportSystemTray && !Kirigami.Settings.isMobile enabled: Config.systemTray && !Config.isMinimizeToSystemTrayOnStartupImmutable onToggled: { - Config.minimizeToSystemTrayOnStartup = checked - Config.save() + Config.minimizeToSystemTrayOnStartup = checked; + Config.save(); } } - FormCard.FormDelegateSeparator { above: minimizeDelegate; below: automaticallyDelegate } + FormCard.FormDelegateSeparator { + above: minimizeDelegate + below: automaticallyDelegate + } FormCard.FormCheckDelegate { id: automaticallyDelegate @@ -54,8 +60,8 @@ FormCard.FormCardPage { enabled: !Config.isAutoRoomInfoDrawerImmutable visible: Qt.platform.os !== "android" onToggled: { - Config.autoRoomInfoDrawer = checked - Config.save() + Config.autoRoomInfoDrawer = checked; + Config.save(); } } } @@ -69,12 +75,15 @@ FormCard.FormCardPage { checked: Config.showDeletedMessages enabled: !Config.isShowDeletedMessagesImmutable onToggled: { - Config.showDeletedMessages = checked - Config.save() + Config.showDeletedMessages = checked; + Config.save(); } } - FormCard.FormDelegateSeparator { above: showDeletedMessages; below: showStateEvents } + FormCard.FormDelegateSeparator { + above: showDeletedMessages + below: showStateEvents + } FormCard.FormCheckDelegate { id: showStateEvents @@ -82,15 +91,16 @@ FormCard.FormCardPage { checked: Config.showStateEvent enabled: !Config.isShowStateEventImmutable onToggled: { - Config.showStateEvent = checked - Config.save() + Config.showStateEvent = checked; + Config.save(); } } FormCard.FormDelegateSeparator { visible: Config.showStateEvent above: showStateEvents - below: showLeaveJoinEventDelegate } + below: showLeaveJoinEventDelegate + } FormCard.FormCheckDelegate { id: showLeaveJoinEventDelegate @@ -99,8 +109,8 @@ FormCard.FormCardPage { checked: Config.showLeaveJoinEvent enabled: !Config.isShowLeaveJoinEventImmutable onToggled: { - Config.showLeaveJoinEvent = checked - Config.save() + Config.showLeaveJoinEvent = checked; + Config.save(); } } @@ -117,8 +127,8 @@ FormCard.FormCardPage { checked: Config.showRename enabled: !Config.isShowRenameImmutable onToggled: { - Config.showRename = checked - Config.save() + Config.showRename = checked; + Config.save(); } } @@ -135,8 +145,8 @@ FormCard.FormCardPage { checked: Config.showAvatarUpdate enabled: !Config.isShowAvatarUpdateImmutable onToggled: { - Config.showAvatarUpdate = checked - Config.save() + Config.showAvatarUpdate = checked; + Config.save(); } } } @@ -150,19 +160,22 @@ FormCard.FormCardPage { checked: Config.allowQuickEdit enabled: !Config.isAllowQuickEditImmutable onToggled: { - Config.allowQuickEdit = checked - Config.save() + Config.allowQuickEdit = checked; + Config.save(); } } - FormCard.FormDelegateSeparator { above: quickEditCheckbox; below: typingNotificationsDelegate } + FormCard.FormDelegateSeparator { + above: quickEditCheckbox + below: typingNotificationsDelegate + } FormCard.FormCheckDelegate { id: typingNotificationsDelegate text: i18n("Send typing notifications") checked: Config.typingNotifications enabled: !Config.isTypingNotificationsImmutable onToggled: { - Config.typingNotifications = checked - Config.save() + Config.typingNotifications = checked; + Config.save(); } } } @@ -175,8 +188,8 @@ FormCard.FormCardPage { checked: Config.developerTools enabled: !Config.isDeveloperToolsImmutable onToggled: { - Config.developerTools = checked - Config.save() + Config.developerTools = checked; + Config.save(); } } } diff --git a/src/qml/GlobalMenu.qml b/src/qml/GlobalMenu.qml index 1966582bc..5b1ee2d0b 100644 --- a/src/qml/GlobalMenu.qml +++ b/src/qml/GlobalMenu.qml @@ -47,24 +47,32 @@ Labs.MenuBar { Labs.MenuItem { text: i18nc("menu", "Find your friends") enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 - onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) + onTriggered: pushReplaceLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Find your friends") + }) } Labs.MenuItem { text: i18nc("menu", "New Group…") enabled: pageStack.layers.currentItem.title !== i18n("Find your friends") && AccountRegistry.accountCount > 0 shortcut: StandardKey.New onTriggered: { - const dialog = createRoomDialog.createObject(root.overlay) - dialog.open() + const dialog = createRoomDialog.createObject(root.overlay); + dialog.open(); } } Labs.MenuItem { text: i18nc("menu", "Browse Chats…") onTriggered: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.connection}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Explore Rooms") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { - RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") - }) + RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); + }); } } } diff --git a/src/qml/GlobalNotificationsPage.qml b/src/qml/GlobalNotificationsPage.qml index d7576fa0c..d338c5041 100644 --- a/src/qml/GlobalNotificationsPage.qml +++ b/src/qml/GlobalNotificationsPage.qml @@ -30,7 +30,7 @@ FormCard.FormCardPage { checked: root.pushRuleModel.globalNotificationsEnabled enabled: root.pushRuleModel.globalNotificationsSet onToggled: { - root.pushRuleModel.globalNotificationsEnabled = checked + root.pushRuleModel.globalNotificationsEnabled = checked; } } } @@ -42,8 +42,8 @@ FormCard.FormCardPage { Repeater { model: KSortFilterProxyModel { sourceModel: root.pushRuleModel - filterRowCallback: function(source_row, source_parent) { - let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) + filterRowCallback: function (source_row, source_parent) { + let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole); return sectionRole == PushRuleSection.Room; } } @@ -59,8 +59,8 @@ FormCard.FormCardPage { Repeater { model: KSortFilterProxyModel { sourceModel: root.pushRuleModel - filterRowCallback: function(source_row, source_parent) { - let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) + filterRowCallback: function (source_row, source_parent) { + let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole); return sectionRole == PushRuleSection.Mentions; } } @@ -77,8 +77,8 @@ FormCard.FormCardPage { model: KSortFilterProxyModel { sourceModel: root.pushRuleModel - filterRowCallback: function(source_row, source_parent) { - let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) + filterRowCallback: function (source_row, source_parent) { + let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole); return sectionRole == PushRuleSection.Keywords; } } @@ -88,7 +88,7 @@ FormCard.FormCardPage { FormCard.AbstractFormDelegate { Layout.fillWidth: true - contentItem : RowLayout { + contentItem: RowLayout { Kirigami.ActionTextField { id: keywordAddField @@ -101,13 +101,13 @@ FormCard.FormCardPage { icon.name: "edit-clear" visible: keywordAddField.text.length > 0 onTriggered: { - keywordAddField.text = "" + keywordAddField.text = ""; } } onAccepted: { - root.pushRuleModel.addKeyword(keywordAddField.text) - keywordAddField.text = "" + root.pushRuleModel.addKeyword(keywordAddField.text); + keywordAddField.text = ""; } } QQC2.Button { @@ -120,8 +120,8 @@ FormCard.FormCardPage { enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown onClicked: { - root.pushRuleModel.addKeyword(keywordAddField.text) - keywordAddField.text = "" + root.pushRuleModel.addKeyword(keywordAddField.text); + keywordAddField.text = ""; } QQC2.ToolTip { @@ -140,8 +140,8 @@ FormCard.FormCardPage { Repeater { model: KSortFilterProxyModel { sourceModel: root.pushRuleModel - filterRowCallback: function(source_row, source_parent) { - let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) + filterRowCallback: function (source_row, source_parent) { + let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole); return sectionRole == PushRuleSection.Invites; } } @@ -161,8 +161,8 @@ FormCard.FormCardPage { model: KSortFilterProxyModel { id: unknownModel sourceModel: root.pushRuleModel - filterRowCallback: function(source_row, source_parent) { - let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) + filterRowCallback: function (source_row, source_parent) { + let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole); return sectionRole == PushRuleSection.Unknown; } } @@ -175,9 +175,9 @@ FormCard.FormCardPage { id: ruleDelegate NotificationRuleItem { onDeleteRule: { - root.pushRuleModel.removeKeyword(id) + root.pushRuleModel.removeKeyword(id); } - onActionChanged: (action) => root.pushRuleModel.setPushRuleAction(id, action) + onActionChanged: action => root.pushRuleModel.setPushRuleAction(id, action) } } } diff --git a/src/qml/GroupChatDrawerHeader.qml b/src/qml/GroupChatDrawerHeader.qml index 830943eaa..b4c6428bd 100644 --- a/src/qml/GroupChatDrawerHeader.qml +++ b/src/qml/GroupChatDrawerHeader.qml @@ -31,7 +31,7 @@ ColumnLayout { Layout.preferredHeight: Kirigami.Units.iconSizes.large name: root.room ? root.room.displayName : "" - source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : "" + source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : "" Rectangle { visible: room.usesEncryption @@ -54,7 +54,6 @@ ColumnLayout { } } - ColumnLayout { Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter diff --git a/src/qml/Homeserver.qml b/src/qml/Homeserver.qml index baec25375..e74b0baf1 100644 --- a/src/qml/Homeserver.qml +++ b/src/qml/Homeserver.qml @@ -12,7 +12,9 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) urlField.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) { + urlField.forceActiveFocus(); + } FormCard.FormTextFieldDelegate { id: urlField @@ -24,7 +26,7 @@ LoginStep { statusMessage: Registration.status === Registration.ServerNoRegistration ? i18n("Registration is disabled on this server.") : "" Keys.onReturnPressed: { if (root.nextAction.enabled) { - root.nextAction.trigger() + root.nextAction.trigger(); } } } @@ -38,7 +40,7 @@ LoginStep { nextAction: Kirigami.Action { text: Registration.testing ? i18n("Loading") : null enabled: Registration.status > Registration.ServerNoRegistration - onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml"); + onTriggered: root.processed("qrc:/org/kde/neochat/qml/Username.qml") } previousAction: Kirigami.Action { onTriggered: root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") diff --git a/src/qml/HoverActions.qml b/src/qml/HoverActions.qml index e6c3d7269..bc309c6d8 100644 --- a/src/qml/HoverActions.qml +++ b/src/qml/HoverActions.qml @@ -35,7 +35,7 @@ QQC2.Control { /** * @brief Request that the chat bar be focussed. */ - signal focusChatBar() + signal focusChatBar topPadding: 0 bottomPadding: 0 @@ -51,7 +51,7 @@ QQC2.Control { if (visible) { // HACK: delay disapearing by 200ms, otherwise this can create some glitches // See https://invent.kde.org/network/neochat/-/issues/333 - showActionsTimer.restart() + showActionsTimer.restart(); } } Timer { @@ -124,7 +124,7 @@ QQC2.Control { id: emojiDialog currentRoom: root.currentRoom showQuickReaction: true - onChosen: (emoji) => { + onChosen: emoji => { root.currentRoom.toggleReaction(root.delegate.eventId, emoji); if (!Kirigami.Settings.isMobile) { root.focusChatBar(); diff --git a/src/qml/ImageDelegate.qml b/src/qml/ImageDelegate.qml index bcef15f58..e218a0997 100644 --- a/src/qml/ImageDelegate.qml +++ b/src/qml/ImageDelegate.qml @@ -129,32 +129,34 @@ MessageDelegate { acceptedButtons: Qt.LeftButton gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds onTapped: { - imageContainer.QQC2.ToolTip.hide() + imageContainer.QQC2.ToolTip.hide(); if (root.mediaInfo.animated) { - imageContainer.imageItem.paused = true + imageContainer.imageItem.paused = true; } - root.ListView.view.interactive = false + root.ListView.view.interactive = false; // We need to make sure the index is that of the MediaMessageFilterModel. if (root.ListView.view.model instanceof MessageFilterModel) { - RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)) + RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)); } else { - RoomManager.maximizeMedia(root.index) + RoomManager.maximizeMedia(root.index); } } } function downloadAndOpen() { if (downloaded) { - openSavedFile() + openSavedFile(); } else { - openOnFinished = true - root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)) + openOnFinished = true; + root.room.downloadFile(root.eventId, StandardPaths.writableLocation(StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)); } } function openSavedFile() { - if (UrlHelper.openUrl(root.progressInfo.localPath)) return; - if (UrlHelper.openUrl(root.progressInfo.localDir)) return; + if (UrlHelper.openUrl(root.progressInfo.localPath)) + return; + if (UrlHelper.openUrl(root.progressInfo.localDir)) + return; } MediaSizeHelper { diff --git a/src/qml/ImageEditorPage.qml b/src/qml/ImageEditorPage.qml index 8b5804c6f..02236b74f 100644 --- a/src/qml/ImageEditorPage.qml +++ b/src/qml/ImageEditorPage.qml @@ -13,10 +13,10 @@ import org.kde.kquickimageeditor as KQuickImageEditor Kirigami.Page { id: rootEditorView - property bool resizing: false; + property bool resizing: false required property string imagePath - signal newPathChanged(string newPath); + signal newPathChanged(string newPath) title: i18n("Edit") leftPadding: 0 @@ -27,7 +27,7 @@ Kirigami.Page { function crop() { const ratioX = editImage.paintedWidth / editImage.nativeWidth; const ratioY = editImage.paintedHeight / editImage.nativeHeight; - rootEditorView.resizing = false + rootEditorView.resizing = false; imageDoc.crop(selectionTool.selectionX / ratioX, selectionTool.selectionY / ratioY, selectionTool.selectionWidth / ratioX, selectionTool.selectionHeight / ratioY); } @@ -36,7 +36,7 @@ Kirigami.Page { id: undoAction text: i18nc("@action:button Undo modification", "Undo") icon.name: "edit-undo" - onTriggered: imageDoc.undo(); + onTriggered: imageDoc.undo() visible: imageDoc.edited }, Kirigami.Action { @@ -45,19 +45,17 @@ Kirigami.Page { icon.name: "dialog-ok" onTriggered: { let newPath = Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + (new Date()).getTime() + "." + imagePath.split('.').pop(); - if (imageDoc.saveAs(newPath)) {; + if (imageDoc.saveAs(newPath)) { newPathChanged(newPath); } else { - msg.type = Kirigami.MessageType.Error - msg.text = i18n("Unable to save file. Check if you have the correct permission to edit the cache directory.") + msg.type = Kirigami.MessageType.Error; + msg.text = i18n("Unable to save file. Check if you have the correct permission to edit the cache directory."); msg.visible = true; } } } ] - - KQuickImageEditor.ImageItem { id: editImage // Assigning this to the contentItem and setting the padding causes weird positioning issues @@ -68,17 +66,17 @@ Kirigami.Page { Shortcut { sequence: StandardKey.Undo - onActivated: undoAction.trigger(); + onActivated: undoAction.trigger() } Shortcut { sequences: [StandardKey.Save, "Enter"] - onActivated: saveAction.trigger(); + onActivated: saveAction.trigger() } Shortcut { sequence: StandardKey.SaveAs - onActivated: saveAsAction.trigger(); + onActivated: saveAsAction.trigger() } KQuickImageEditor.ImageDocument { @@ -104,15 +102,15 @@ Kirigami.Page { Connections { target: selectionTool.selectionArea function onDoubleClicked() { - rootEditorView.crop() + rootEditorView.crop(); } } } onImageChanged: { - selectionTool.selectionX = 0 - selectionTool.selectionY = 0 - selectionTool.selectionWidth = Qt.binding(() => selectionTool.width) - selectionTool.selectionHeight = Qt.binding(() => selectionTool.height) + selectionTool.selectionX = 0; + selectionTool.selectionY = 0; + selectionTool.selectionWidth = Qt.binding(() => selectionTool.width); + selectionTool.selectionHeight = Qt.binding(() => selectionTool.height); } } @@ -123,48 +121,47 @@ Kirigami.Page { actions: [ Kirigami.Action { icon.name: rootEditorView.resizing ? "dialog-cancel" : "transform-crop" - text: rootEditorView.resizing ? i18n("Cancel") : i18nc("@action:button Crop an image", "Crop"); + text: rootEditorView.resizing ? i18n("Cancel") : i18nc("@action:button Crop an image", "Crop") onTriggered: { - resizeRectangle.width = editImage.paintedWidth - resizeRectangle.height = editImage.paintedHeight - resizeRectangle.x = editImage.horizontalPadding - resizeRectangle.y = editImage.verticalPadding - resizeRectangle.insideX = 100 - resizeRectangle.insideY = 100 - resizeRectangle.insideWidth = 100 - resizeRectangle.insideHeight = 100 - + resizeRectangle.width = editImage.paintedWidth; + resizeRectangle.height = editImage.paintedHeight; + resizeRectangle.x = editImage.horizontalPadding; + resizeRectangle.y = editImage.verticalPadding; + resizeRectangle.insideX = 100; + resizeRectangle.insideY = 100; + resizeRectangle.insideWidth = 100; + resizeRectangle.insideHeight = 100; rootEditorView.resizing = !rootEditorView.resizing; } }, Kirigami.Action { icon.name: "dialog-ok" visible: rootEditorView.resizing - text: i18nc("@action:button Crop an image", "Crop"); - onTriggered: rootEditorView.crop(); + text: i18nc("@action:button Crop an image", "Crop") + onTriggered: rootEditorView.crop() }, Kirigami.Action { icon.name: "object-rotate-left" - text: i18nc("@action:button Rotate an image to the left", "Rotate left"); - onTriggered: imageDoc.rotate(-90); + text: i18nc("@action:button Rotate an image to the left", "Rotate left") + onTriggered: imageDoc.rotate(-90) visible: !rootEditorView.resizing }, Kirigami.Action { icon.name: "object-rotate-right" - text: i18nc("@action:button Rotate an image to the right", "Rotate right"); - onTriggered: imageDoc.rotate(90); + text: i18nc("@action:button Rotate an image to the right", "Rotate right") + onTriggered: imageDoc.rotate(90) visible: !rootEditorView.resizing }, Kirigami.Action { icon.name: "object-flip-vertical" - text: i18nc("@action:button Mirror an image vertically", "Flip"); - onTriggered: imageDoc.mirror(false, true); + text: i18nc("@action:button Mirror an image vertically", "Flip") + onTriggered: imageDoc.mirror(false, true) visible: !rootEditorView.resizing }, Kirigami.Action { icon.name: "object-flip-horizontal" - text: i18nc("@action:button Mirror an image horizontally", "Mirror"); - onTriggered: imageDoc.mirror(true, false); + text: i18nc("@action:button Mirror an image horizontally", "Mirror") + onTriggered: imageDoc.mirror(true, false) visible: !rootEditorView.resizing } ] diff --git a/src/qml/InvitationView.qml b/src/qml/InvitationView.qml index 1cf174d8e..410882fc3 100644 --- a/src/qml/InvitationView.qml +++ b/src/qml/InvitationView.qml @@ -26,14 +26,14 @@ Kirigami.PlaceholderMessage { } } QQC2.Button { - Layout.alignment : Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter text: i18n("Reject") - onClicked: RoomManager.leaveRoom(root.currentRoom); + onClicked: RoomManager.leaveRoom(root.currentRoom) } QQC2.Button { - Layout.alignment : Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter text: i18n("Accept") onClicked: { diff --git a/src/qml/InviteUserPage.qml b/src/qml/InviteUserPage.qml index c87e033fc..f857d1566 100644 --- a/src/qml/InviteUserPage.qml +++ b/src/qml/InviteUserPage.qml @@ -45,7 +45,7 @@ Kirigami.ScrollablePage { highlighted: true onClicked: { - room.inviteToRoom(identifierField.text) + room.inviteToRoom(identifierField.text); } } } @@ -105,7 +105,7 @@ Kirigami.ScrollablePage { onToggled: { if (inRoom) { - checked = true + checked = true; } else { room.inviteToRoom(delegate.userId); applicationWindow().pageStack.layers.pop(); diff --git a/src/qml/KeyVerificationDialog.qml b/src/qml/KeyVerificationDialog.qml index 55b77e2d1..4c72dfe17 100644 --- a/src/qml/KeyVerificationDialog.qml +++ b/src/qml/KeyVerificationDialog.qml @@ -74,7 +74,9 @@ Kirigami.Page { visible: root.session.state === KeyVerificationSession.INCOMING QQC2.DialogButtonBox { anchors.fill: parent - Item { Layout.fillWidth: true } + Item { + Layout.fillWidth: true + } QQC2.Button { text: i18n("Accept") icon.name: "dialog-ok" diff --git a/src/qml/LinkPreviewDelegate.qml b/src/qml/LinkPreviewDelegate.qml index 29a8bd114..52845cdee 100644 --- a/src/qml/LinkPreviewDelegate.qml +++ b/src/qml/LinkPreviewDelegate.qml @@ -31,7 +31,7 @@ Loader { * When the content of the link preview is larger than this it will be * elided/hidden until maximized. */ - property var defaultHeight : Kirigami.Units.gridUnit * 3 + Kirigami.Units.smallSpacing * 2 + property var defaultHeight: Kirigami.Units.gridUnit * 3 + Kirigami.Units.smallSpacing * 2 /** * @brief Whether the loading indicator should animate if visible. @@ -146,4 +146,3 @@ Loader { } } } - diff --git a/src/qml/LiveLocationDelegate.qml b/src/qml/LiveLocationDelegate.qml index 8d29154f8..0e5557831 100644 --- a/src/qml/LiveLocationDelegate.qml +++ b/src/qml/LiveLocationDelegate.qml @@ -42,8 +42,10 @@ MessageDelegate { TapHandler { acceptedButtons: Qt.LeftButton onTapped: { - let map = fullScreenMap.createObject(parent, {liveLocationModel: liveLocationModel}); - map.open() + let map = fullScreenMap.createObject(parent, { + liveLocationModel: liveLocationModel + }); + map.open(); } onLongPressed: openMessageContext("") } @@ -54,7 +56,7 @@ MessageDelegate { Connections { target: mapView.map function onCopyrightLinkActivated() { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } } } diff --git a/src/qml/Loading.qml b/src/qml/Loading.qml index 948615f90..da211fd4a 100644 --- a/src/qml/Loading.qml +++ b/src/qml/Loading.qml @@ -23,7 +23,7 @@ LoginStep { Connections { target: Controller function onConnectionAdded(connection) { - connection.syncDone.connect(() => root.closeDialog()) + connection.syncDone.connect(() => root.closeDialog()); } } } diff --git a/src/qml/LocationChooser.qml b/src/qml/LocationChooser.qml index ea46b1776..5804132d5 100644 --- a/src/qml/LocationChooser.qml +++ b/src/qml/LocationChooser.qml @@ -50,7 +50,7 @@ Components.AbstractMaximizeComponent { MouseArea { anchors.fill: parent onClicked: { - root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false) + root.location = mapView.map.toCoordinate(Qt.point(mouseX, mouseY), false); } } @@ -84,7 +84,7 @@ Components.AbstractMaximizeComponent { Connections { target: mapView.map function onCopyrightLinkActivated() { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } } } diff --git a/src/qml/LocationDelegate.qml b/src/qml/LocationDelegate.qml index 5bf04aaa0..207f0caf2 100644 --- a/src/qml/LocationDelegate.qml +++ b/src/qml/LocationDelegate.qml @@ -58,8 +58,13 @@ MessageDelegate { TapHandler { acceptedButtons: Qt.LeftButton onTapped: { - let map = fullScreenMap.createObject(parent, {latitude: root.latitude, longitude: root.longitude, asset: root.asset, author: root.author}); - map.open() + let map = fullScreenMap.createObject(parent, { + latitude: root.latitude, + longitude: root.longitude, + asset: root.asset, + author: root.author + }); + map.open(); } onLongPressed: openMessageContext("") } @@ -70,13 +75,13 @@ MessageDelegate { Connections { target: mapView.map function onCopyrightLinkActivated() { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } } } Component { id: fullScreenMap - FullScreenMap { } + FullScreenMap {} } RichLabel { diff --git a/src/qml/LocationMapItem.qml b/src/qml/LocationMapItem.qml index f704e8b60..9b536ef62 100644 --- a/src/qml/LocationMapItem.qml +++ b/src/qml/LocationMapItem.qml @@ -67,8 +67,8 @@ MapQuickItem { anchors.bottom: mainIcon.top anchors.horizontalCenter: mainIcon.horizontalCenter transform: Rotation { - origin.x: headingIcon.width/2 - origin.y: headingIcon.height + mainIcon.height/2 + origin.x: headingIcon.width / 2 + origin.y: headingIcon.height + mainIcon.height / 2 angle: root.heading } } diff --git a/src/qml/LocationsPage.qml b/src/qml/LocationsPage.qml index e8cf04311..2ec892bf4 100644 --- a/src/qml/LocationsPage.qml +++ b/src/qml/LocationsPage.qml @@ -55,7 +55,7 @@ Kirigami.Page { Connections { target: mapView.map function onCopyrightLinkActivated() { - Qt.openUrlExternally(link) + Qt.openUrlExternally(link); } } } diff --git a/src/qml/Login.qml b/src/qml/Login.qml index a4d49a634..0b2b972e5 100644 --- a/src/qml/Login.qml +++ b/src/qml/Login.qml @@ -13,10 +13,11 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) matrixIdField.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) + matrixIdField.forceActiveFocus() Component.onCompleted: { - LoginHelper.matrixId = "" + LoginHelper.matrixId = ""; } FormCard.FormTextFieldDelegate { @@ -25,16 +26,16 @@ LoginStep { placeholderText: "@user:example.org" Accessible.name: i18n("Matrix ID") onTextChanged: { - LoginHelper.matrixId = text + LoginHelper.matrixId = text; } Keys.onReturnPressed: { - root.nextAction.trigger() + root.nextAction.trigger(); } } nextAction: Kirigami.Action { - text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue") + text: LoginHelper.isLoggedIn ? i18n("Already logged in") : (LoginHelper.testing && matrixIdField.acceptableInput) ? i18n("Loading…") : i18nc("@action:button", "Continue") onTriggered: { if (LoginHelper.supportsSso && LoginHelper.supportsPassword) { processed("qrc:/org/kde/neochat/qml/LoginMethod.qml"); @@ -48,7 +49,7 @@ LoginStep { } previousAction: Kirigami.Action { onTriggered: { - root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml") + root.processed("qrc:/org/kde/neochat/qml/LoginRegister.qml"); } } } diff --git a/src/qml/LoginMethod.qml b/src/qml/LoginMethod.qml index df1aaf32b..b85775566 100644 --- a/src/qml/LoginMethod.qml +++ b/src/qml/LoginMethod.qml @@ -11,7 +11,9 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) loginPasswordButton.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) { + loginPasswordButton.forceActiveFocus(); + } FormCard.FormButtonDelegate { id: loginPasswordButton diff --git a/src/qml/LoginRegister.qml b/src/qml/LoginRegister.qml index a3a8d2387..e8b8120e0 100644 --- a/src/qml/LoginRegister.qml +++ b/src/qml/LoginRegister.qml @@ -11,7 +11,9 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) loginButton.forceActiveFocus(Qt.TabFocusReason) + onActiveFocusChanged: if (activeFocus) { + loginButton.forceActiveFocus(Qt.TabFocusReason); + } Layout.fillWidth: true diff --git a/src/qml/LoginStep.qml b/src/qml/LoginStep.qml index 28a44bf8f..24f3c220a 100644 --- a/src/qml/LoginStep.qml +++ b/src/qml/LoginStep.qml @@ -27,8 +27,8 @@ ColumnLayout { signal showMessage(string message) /// Clears any error messages currently being shown - signal clearError() + signal clearError /// Closes the login dialog - signal closeDialog() + signal closeDialog } diff --git a/src/qml/ManualRoomDialog.qml b/src/qml/ManualRoomDialog.qml index 654583927..28d0e6ce5 100644 --- a/src/qml/ManualRoomDialog.qml +++ b/src/qml/ManualRoomDialog.qml @@ -20,13 +20,7 @@ Kirigami.Dialog { /** * @brief Signal emitted when a valid room id or alias is entered. */ - signal roomSelected(string roomId, - string displayName, - url avatarUrl, - string alias, - string topic, - int memberCount, - bool isJoined) + signal roomSelected(string roomId, string displayName, url avatarUrl, string alias, string topic, int memberCount, bool isJoined) title: i18nc("@title", "Room ID or Alias") @@ -54,7 +48,7 @@ Kirigami.Dialog { if (roomIdAliasText.room) { roomId = roomIdAliasText.room.id; displayName = roomIdAliasText.room.displayName; - avatarUrl = roomIdAliasText.room.avatarUrl.toString().length > 0 ? connection.makeMediaUrl(roomIdAliasText.room.avatarUrl) : "" + avatarUrl = roomIdAliasText.room.avatarUrl.toString().length > 0 ? connection.makeMediaUrl(roomIdAliasText.room.avatarUrl) : ""; alias = roomIdAliasText.room.canonicalAlias; topic = roomIdAliasText.room.topic; memberCount = roomIdAliasText.room.joinedCount; @@ -112,7 +106,7 @@ Kirigami.Dialog { } onVisibleChanged: { - roomIdAliasText.forceActiveFocus() - timer.restart() + roomIdAliasText.forceActiveFocus(); + timer.restart(); } } diff --git a/src/qml/ManualUserDialog.qml b/src/qml/ManualUserDialog.qml index 9a5a85218..18e6b9e64 100644 --- a/src/qml/ManualUserDialog.qml +++ b/src/qml/ManualUserDialog.qml @@ -20,7 +20,7 @@ Kirigami.Dialog { /** * @brief Thrown when a user is selected. */ - signal userSelected() + signal userSelected title: i18nc("@title", "User ID") @@ -37,7 +37,7 @@ Kirigami.Dialog { text: i18n("OK") icon.name: "dialog-ok" onTriggered: { - root.connection.openOrCreateDirectChat(userIdText.text) + root.connection.openOrCreateDirectChat(userIdText.text); root.accept(); } } @@ -75,7 +75,7 @@ Kirigami.Dialog { } onVisibleChanged: { - userIdText.forceActiveFocus() - timer.restart() + userIdText.forceActiveFocus(); + timer.restart(); } } diff --git a/src/qml/MessageDelegate.qml b/src/qml/MessageDelegate.qml index b3e370314..b790808ab 100644 --- a/src/qml/MessageDelegate.qml +++ b/src/qml/MessageDelegate.qml @@ -257,7 +257,7 @@ TimelineDelegate { /** * @brief Open the any message media externally. */ - signal openExternally() + signal openExternally /** * @brief The reply has been clicked. @@ -293,7 +293,9 @@ TimelineDelegate { */ property bool isTemporaryHighlighted: false - onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) temporaryHighlightTimer.start() + onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) { + temporaryHighlightTimer.start(); + } Timer { id: temporaryHighlightTimer @@ -329,20 +331,20 @@ TimelineDelegate { Component.onCompleted: { if (root.isReply && root.replyDelegateType === DelegateType.Other) { - root.room.loadReply(root.eventId, root.replyId) + root.room.loadReply(root.eventId, root.replyId); } } // show hover actions onHoveredChanged: { if (hovered && !Kirigami.Settings.isMobile) { - root.setHoverActionsToDelegate() + root.setHoverActionsToDelegate(); } } KirigamiComponents.AvatarButton { id: avatar - width: visible || Config.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2: 0 + width: visible || Config.showAvatarInTimeline ? Kirigami.Units.gridUnit + Kirigami.Units.largeSpacing * 2 : 0 height: width anchors { left: parent.left @@ -351,9 +353,7 @@ TimelineDelegate { topMargin: Kirigami.Units.smallSpacing } - visible: (root.showAuthor || root.alwaysShowAuthor) && - Config.showAvatarInTimeline && - (Config.compactLayout || !_private.showUserMessageOnRight) + visible: (root.showAuthor || root.alwaysShowAuthor) && Config.showAvatarInTimeline && (Config.compactLayout || !_private.showUserMessageOnRight) name: root.author.displayName source: root.author.avatarSource color: root.author.color @@ -409,7 +409,9 @@ TimelineDelegate { replyDisplay: root.replyDisplay replyMediaInfo: root.replyMediaInfo - onReplyClicked: (eventId) => {root.replyClicked(eventId)} + onReplyClicked: eventId => { + root.replyClicked(eventId); + } showBackground: root.cardBackground && !Config.compactLayout } @@ -440,7 +442,7 @@ TimelineDelegate { visible: root.showReactions model: root.reaction - onReactionClicked: (reaction) => root.room.toggleReaction(root.eventId, reaction) + onReactionClicked: reaction => root.room.toggleReaction(root.eventId, reaction) } AvatarFlow { Layout.alignment: Qt.AlignRight @@ -463,13 +465,13 @@ TimelineDelegate { } function isVisibleInTimeline() { - let yoff = Math.round(y - ListView.view.contentY); - return (yoff + height > 0 && yoff < ListView.view.height) + let yoff = Math.round(y - ListView.view.contentY); + return (yoff + height > 0 && yoff < ListView.view.height); } function setHoverActionsToDelegate() { if (ListView.view.setHoverActionsToDelegate) { - ListView.view.setHoverActionsToDelegate(root) + ListView.view.setHoverActionsToDelegate(root); } } diff --git a/src/qml/MessageDelegateContextMenu.qml b/src/qml/MessageDelegateContextMenu.qml index 374ee4e7d..2fc40d3a7 100644 --- a/src/qml/MessageDelegateContextMenu.qml +++ b/src/qml/MessageDelegateContextMenu.qml @@ -115,11 +115,11 @@ Loader { }, { title: i18nc("@title", "Forward Message"), width: Kirigami.Units.gridUnit * 25 - }) - page.chosen.connect(function(targetRoomId) { - root.connection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText.length > 0 ? root.htmlText : root.plainText) - page.closeDialog() - }) + }); + page.chosen.connect(function (targetRoomId) { + root.connection.room(targetRoomId).postHtmlMessage(root.plainText, root.htmlText.length > 0 ? root.htmlText : root.plainText); + page.closeDialog(); + }); } }, Kirigami.Action { @@ -127,7 +127,10 @@ Loader { text: i18n("Remove") icon.name: "edit-delete-remove" icon.color: "red" - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", { + room: currentRoom, + eventId: eventId + }, { title: i18nc("@title", "Remove Message"), width: Kirigami.Units.gridUnit * 25 }) @@ -141,7 +144,10 @@ Loader { text: i18nc("@action:button 'Report' as in 'Report this event to the administrators'", "Report") icon.name: "dialog-warning-symbolic" visible: !author.isLocalUser - onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", {room: currentRoom, eventId: eventId}, { + onTriggered: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ReportSheet.qml", { + room: currentRoom, + eventId: eventId + }, { title: i18nc("@title", "Report Message"), width: Kirigami.Units.gridUnit * 25 }) @@ -156,7 +162,7 @@ Loader { text: i18n("Copy Link") icon.name: "edit-copy" onTriggered: { - Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + root.eventId) + Clipboard.saveText("https://matrix.to/#/" + currentRoom.id + "/" + root.eventId); } } ] @@ -180,12 +186,14 @@ Loader { icon.name: modelData.icon.name onTriggered: modelData.trigger() } - onObjectAdded: (index, object) => {menuItem.insertItem(0, object)} + onObjectAdded: (index, object) => { + menuItem.insertItem(0, object); + } } } onObjectAdded: (index, object) => { object.visible = false; - menu.addMenu(object) + menu.addMenu(object); } } @@ -194,7 +202,7 @@ Loader { QQC2.MenuItem { visible: modelData.visible action: modelData - onClicked: root.item.close(); + onClicked: root.item.close() } } QQC2.Menu { @@ -202,7 +210,7 @@ Loader { title: i18n("Search for '%1'", webshortcutmodel.trunkatedSearchText) property bool isVisible: webshortcutmodel.enabled Component.onCompleted: { - webshortcutmenu.parent.visible = isVisible + webshortcutmenu.parent.visible = isVisible; } onIsVisibleChanged: webshortcutmenu.parent.visible = isVisible Instantiator { @@ -279,7 +287,7 @@ Loader { visible: modelData.visible text: modelData.text onClicked: { - modelData.triggered() + modelData.triggered(); root.item.close(); } } @@ -315,7 +323,7 @@ Loader { Layout.fillWidth: true wrapMode: Text.WordWrap - onLinkActivated: RoomManager.resolveResource(link, "join"); + onLinkActivated: RoomManager.resolveResource(link, "join") } } } @@ -361,7 +369,7 @@ Loader { visible: modelData.visible text: modelData.text onClicked: { - modelData.triggered() + modelData.triggered(); root.item.close(); } } @@ -401,4 +409,3 @@ Loader { } } } - diff --git a/src/qml/MessageEditComponent.qml b/src/qml/MessageEditComponent.qml index 5388223f9..9cbd8d60e 100644 --- a/src/qml/MessageEditComponent.qml +++ b/src/qml/MessageEditComponent.qml @@ -14,8 +14,8 @@ QQC2.TextArea { required property NeoChatRoom room onRoomChanged: { - _private.chatBarCache = room.editCache - _private.chatBarCache.relationIdChanged.connect(_private.updateEditText) + _private.chatBarCache = room.editCache; + _private.chatBarCache.relationIdChanged.connect(_private.updateEditText); } /** @@ -37,37 +37,37 @@ QQC2.TextArea { wrapMode: TextEdit.Wrap onTextChanged: { - _private.chatBarCache.text = text + _private.chatBarCache.text = text; } Keys.onEnterPressed: { if (completionMenu.visible) { - completionMenu.complete() + completionMenu.complete(); } else if (event.modifiers & Qt.ShiftModifier) { - root.insert(cursorPosition, "\n") + root.insert(cursorPosition, "\n"); } else { root.postEdit(); } } Keys.onReturnPressed: { if (completionMenu.visible) { - completionMenu.complete() + completionMenu.complete(); } else if (event.modifiers & Qt.ShiftModifier) { - root.insert(cursorPosition, "\n") + root.insert(cursorPosition, "\n"); } else { root.postEdit(); } } Keys.onTabPressed: { if (completionMenu.visible) { - completionMenu.complete() + completionMenu.complete(); } } Keys.onPressed: event => { if (event.key === Qt.Key_Up && completionMenu.visible) { - completionMenu.decrementIndex() + completionMenu.decrementIndex(); } else if (event.key === Qt.Key_Down && completionMenu.visible) { - completionMenu.incrementIndex() + completionMenu.incrementIndex(); } } @@ -156,12 +156,10 @@ QQC2.TextArea { function updateEditText() { if (chatBarCache?.isEditing && chatBarCache.relationMessage.length > 0) { - root.text = chatBarCache.relationMessage + root.text = chatBarCache.relationMessage; root.forceActiveFocus(); root.cursorPosition = root.length; } } } } - - diff --git a/src/qml/MessageSourceSheet.qml b/src/qml/MessageSourceSheet.qml index 4fbbc3fc2..27d3977af 100644 --- a/src/qml/MessageSourceSheet.qml +++ b/src/qml/MessageSourceSheet.qml @@ -100,4 +100,3 @@ Kirigami.Page { } } } - diff --git a/src/qml/NeochatMaximizeComponent.qml b/src/qml/NeochatMaximizeComponent.qml index f72dfffe0..d60714fed 100644 --- a/src/qml/NeochatMaximizeComponent.qml +++ b/src/qml/NeochatMaximizeComponent.qml @@ -37,7 +37,7 @@ Components.AlbumMaximizeComponent { downloadAction: Components.DownloadAction { id: downloadAction onTriggered: { - currentRoom.downloadFile(root.currentEventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.currentEventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(root.currentEventId)) + currentRoom.downloadFile(root.currentEventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.currentEventId.replace(":", "_").replace("/", "_").replace("+", "_") + currentRoom.fileNameToDownload(root.currentEventId)); } } @@ -46,7 +46,7 @@ Components.AlbumMaximizeComponent { function onFileTransferProgress(id, progress, total) { if (id == root.currentEventId) { - downloadAction.progress = progress / total * 100.0 + downloadAction.progress = progress / total * 100.0; } } } @@ -55,7 +55,7 @@ Components.AlbumMaximizeComponent { target: content function onCurrentIndexChanged() { - downloadAction.progress = currentProgressInfo.progress / currentProgressInfo.total * 100.0 + downloadAction.progress = currentProgressInfo.progress / currentProgressInfo.total * 100.0; } } @@ -87,25 +87,18 @@ Components.AlbumMaximizeComponent { } } } - onItemRightClicked: RoomManager.viewEventMenu(root.currentEventId, - root.currentAuthor, - root.currentDelegateType, - root.currentPlainText, - "", - "", - root.currentMimeType, - root.currentProgressInfo) + onItemRightClicked: RoomManager.viewEventMenu(root.currentEventId, root.currentAuthor, root.currentDelegateType, root.currentPlainText, "", "", root.currentMimeType, root.currentProgressInfo) onSaveItem: { - var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay) - dialog.open() - dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(root.currentEventId) + var dialog = saveAsDialog.createObject(QQC2.ApplicationWindow.overlay); + dialog.open(); + dialog.currentFile = dialog.folder + "/" + currentRoom.fileNameToDownload(root.currentEventId); } Connections { target: RoomManager function onCloseFullScreen() { - root.close() + root.close(); } } @@ -115,12 +108,12 @@ Components.AlbumMaximizeComponent { fileMode: FileDialog.SaveFile folder: root.saveFolder onAccepted: { - Config.lastSaveDirectory = folder - Config.save() + Config.lastSaveDirectory = folder; + Config.save(); if (!currentFile) { return; } - currentRoom.downloadFile(rooteventId, currentFile) + currentRoom.downloadFile(rooteventId, currentFile); } } } diff --git a/src/qml/NetworkProxyPage.qml b/src/qml/NetworkProxyPage.qml index e2dd48459..e9a024472 100644 --- a/src/qml/NetworkProxyPage.qml +++ b/src/qml/NetworkProxyPage.qml @@ -27,7 +27,7 @@ FormCard.FormCardPage { checked: currentType === 0 enabled: !Config.isProxyTypeImmutable onToggled: { - currentType = 0 + currentType = 0; } } FormCard.FormRadioDelegate { @@ -35,7 +35,7 @@ FormCard.FormCardPage { checked: currentType === 1 enabled: !Config.isProxyTypeImmutable onToggled: { - currentType = 1 + currentType = 1; } } FormCard.FormRadioDelegate { @@ -43,7 +43,7 @@ FormCard.FormCardPage { checked: currentType === 2 enabled: !Config.isProxyTypeImmutable onToggled: { - currentType = 2 + currentType = 2; } } } @@ -58,7 +58,7 @@ FormCard.FormCardPage { text: Config.proxyHost inputMethodHints: Qt.ImhUrlCharactersOnly onEditingFinished: { - proxyConfigChanged = true + proxyConfigChanged = true; } } FormCard.FormSpinBoxDelegate { @@ -67,11 +67,11 @@ FormCard.FormCardPage { value: Config.proxyPort from: 0 to: 65536 - textFromValue: function(value, locale) { - return value // it will add a thousands separator if we don't do this, not sure why + textFromValue: function (value, locale) { + return value; // it will add a thousands separator if we don't do this, not sure why } onValueChanged: { - proxyConfigChanged = true + proxyConfigChanged = true; } } FormCard.FormTextFieldDelegate { @@ -80,7 +80,7 @@ FormCard.FormCardPage { text: Config.proxyUser inputMethodHints: Qt.ImhUrlCharactersOnly onEditingFinished: { - proxyConfigChanged = true + proxyConfigChanged = true; } } FormCard.FormTextFieldDelegate { @@ -90,7 +90,7 @@ FormCard.FormCardPage { echoMode: TextInput.Password inputMethodHints: Qt.ImhUrlCharactersOnly onEditingFinished: { - proxyConfigChanged = true + proxyConfigChanged = true; } } } @@ -102,24 +102,24 @@ FormCard.FormCardPage { Layout.fillWidth: true } - QQC2.Button { + QQC2.Button { text: i18n("Apply") enabled: currentType !== Config.proxyType || proxyConfigChanged onClicked: { - Config.proxyType = currentType - Config.proxyHost = hostField.text - Config.proxyPort = portField.value - Config.proxyUser = userField.text - Config.proxyPassword = passwordField.text - Config.save() - proxyConfigChanged = false - ProxyController.setApplicationProxy() + Config.proxyType = currentType; + Config.proxyHost = hostField.text; + Config.proxyPort = portField.value; + Config.proxyUser = userField.text; + Config.proxyPassword = passwordField.text; + Config.save(); + proxyConfigChanged = false; + ProxyController.setApplicationProxy(); } } } } Component.onCompleted: { - currentType = Config.proxyType + currentType = Config.proxyType; } } diff --git a/src/qml/NotificationRuleItem.qml b/src/qml/NotificationRuleItem.qml index ee79921ee..62309066f 100644 --- a/src/qml/NotificationRuleItem.qml +++ b/src/qml/NotificationRuleItem.qml @@ -24,17 +24,17 @@ FormCard.AbstractFormDelegate { readonly property bool highlightOn: isNotificationRuleHighlight(ruleAction) signal actionChanged(int action) - signal deleteRule() + signal deleteRule enabled: ruleAction !== PushRuleAction.Unknown text: name onClicked: { - notificationAction = nextNotificationRuleAction(notificationAction) + notificationAction = nextNotificationRuleAction(notificationAction); } - contentItem : RowLayout { + contentItem: RowLayout { spacing: Kirigami.Units.largeSpacing QQC2.Label { @@ -78,7 +78,7 @@ FormCard.AbstractFormDelegate { enabled: root.enabled down: checked onToggled: { - root.actionChanged(root.notifcationRuleAction()) + root.actionChanged(root.notifcationRuleAction()); } QQC2.ToolTip { @@ -99,7 +99,7 @@ FormCard.AbstractFormDelegate { enabled: (onButton.checked || !root.notificationsOnModifiable) && root.enabled down: checked onToggled: { - root.actionChanged(root.notifcationRuleAction()) + root.actionChanged(root.notifcationRuleAction()); } QQC2.ToolTip { @@ -121,7 +121,7 @@ FormCard.AbstractFormDelegate { enabled: (onButton.checked || !root.notificationsOnModifiable) && root.enabled down: checked onToggled: { - root.actionChanged(root.notifcationRuleAction()) + root.actionChanged(root.notifcationRuleAction()); } QQC2.ToolTip { @@ -138,7 +138,7 @@ FormCard.AbstractFormDelegate { visible: root.deletable onClicked: { - root.deleteRule() + root.deleteRule(); } } } @@ -147,57 +147,49 @@ FormCard.AbstractFormDelegate { function notifcationRuleAction() { if (onButton.checked) { if (noisyButton.checked && highlightButton.checked && root.highlightable) { - return PushRuleAction.NoisyHighlight + return PushRuleAction.NoisyHighlight; } else if (noisyButton.checked) { - return PushRuleAction.Noisy + return PushRuleAction.Noisy; } else if (highlightButton.checked && root.highlightable) { - return PushRuleAction.Highlight + return PushRuleAction.Highlight; } else { - return PushRuleAction.On + return PushRuleAction.On; } } else { - return PushRuleAction.Off + return PushRuleAction.Off; } } function nextNotificationRuleAction(action) { - let finished = false - + let finished = false; if (action == PushRuleAction.NoisyHighlight) { - action = PushRuleAction.Off + action = PushRuleAction.Off; } else { - action += 1 + action += 1; } - while (!finished) { if (action == PushRuleAction.Off && !root.notificationsOnModifiable) { - action = PushRuleAction.On + action = PushRuleAction.On; } else if (action == PushRuleAction.Noisy) { - action = PushRuleAction.Highlight + action = PushRuleAction.Highlight; } else if (action == PushRuleAction.Highlight && !root.highlightable) { - action = PushRuleAction.Off + action = PushRuleAction.Off; } else { - finished = true + finished = true; } } - - actionChanged(action) + actionChanged(action); } function isNotificationRuleOn(action) { - return action == PushRuleAction.On || - action == PushRuleAction.Noisy || - action == PushRuleAction.Highlight || - action == PushRuleAction.NoisyHighlight + return action == PushRuleAction.On || action == PushRuleAction.Noisy || action == PushRuleAction.Highlight || action == PushRuleAction.NoisyHighlight; } function isNotificationRuleNoisy(action) { - return action == PushRuleAction.Noisy || - action == PushRuleAction.NoisyHighlight + return action == PushRuleAction.Noisy || action == PushRuleAction.NoisyHighlight; } function isNotificationRuleHighlight(action) { - return action == PushRuleAction.Highlight || - action == PushRuleAction.NoisyHighlight + return action == PushRuleAction.Highlight || action == PushRuleAction.NoisyHighlight; } } diff --git a/src/qml/Password.qml b/src/qml/Password.qml index 204d9cda2..feb34c373 100644 --- a/src/qml/Password.qml +++ b/src/qml/Password.qml @@ -15,11 +15,12 @@ LoginStep { Connections { target: LoginHelper function onConnected() { - processed("qrc:/org/kde/neochat/qml/Loading.qml") + processed("qrc:/org/kde/neochat/qml/Loading.qml"); } } - onActiveFocusChanged: if(activeFocus) passwordField.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) + passwordField.forceActiveFocus() FormCard.FormTextFieldDelegate { id: passwordField @@ -32,7 +33,7 @@ LoginStep { statusMessage: LoginHelper.isInvalidPassword ? i18n("Invalid username or password") : "" Keys.onReturnPressed: { - root.nextAction.trigger() + root.nextAction.trigger(); } } @@ -40,7 +41,7 @@ LoginStep { text: i18nc("@action:button", "Login") enabled: passwordField.text.length > 0 && !LoginHelper.isLoggingIn onTriggered: { - root.clearError() + root.clearError(); LoginHelper.login(); } } diff --git a/src/qml/Permissions.qml b/src/qml/Permissions.qml index d35d2a8c8..3825150b7 100644 --- a/src/qml/Permissions.qml +++ b/src/qml/Permissions.qml @@ -38,8 +38,8 @@ FormCard.FormCardPage { sourceModel: userListModel sortRoleName: "powerLevel" sortOrder: Qt.DescendingOrder - filterRowCallback: function(source_row, source_parent) { - let powerLevelRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), UserListModel.PowerLevelRole) + filterRowCallback: function (source_row, source_parent) { + let powerLevelRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), UserListModel.PowerLevelRole); return powerLevelRole > 0; } } @@ -68,20 +68,31 @@ FormCard.FormCardPage { * before the first delegate sets it's current index. */ if (powerLevelModel.count == 0) { - powerLevelModel.append({"text": i18n("Member (0)"), "powerLevel": 0}); - powerLevelModel.append({"text": i18n("Moderator (50)"), "powerLevel": 50}); - powerLevelModel.append({"text": i18n("Admin (100)"), "powerLevel": 100}); + powerLevelModel.append({ + "text": i18n("Member (0)"), + "powerLevel": 0 + }); + powerLevelModel.append({ + "text": i18n("Moderator (50)"), + "powerLevel": 50 + }); + powerLevelModel.append({ + "text": i18n("Admin (100)"), + "powerLevel": 100 + }); } - currentIndex = indexOfValue(powerLevel) + currentIndex = indexOfValue(powerLevel); } onActivated: { - room.setUserPowerLevel(userId, currentValue) + room.setUserPowerLevel(userId, currentValue); } } } } } - FormCard.FormDelegateSeparator { below: userListSearchCard } + FormCard.FormDelegateSeparator { + below: userListSearchCard + } FormCard.AbstractFormDelegate { id: userListSearchCard visible: room.canSendState("m.room.power_levels") @@ -111,7 +122,6 @@ FormCard.FormCardPage { let maxHeight = userListSearchField.mapToGlobal(userListSearchField.x, userListSearchField.y).y - Kirigami.Units.largeSpacing * 3; let minHeight = Kirigami.Units.gridUnit * 2 + userListSearchPopup.padding * 2; let filterContentHeight = userListView.contentHeight + userListSearchPopup.padding * 2; - return Math.max(Math.min(filterContentHeight, maxHeight), minHeight); } padding: Kirigami.Units.smallSpacing @@ -157,9 +167,9 @@ FormCard.FormCardPage { onFilterTextChanged: { if (filterText.length > 0 && !userListSearchPopup.visible) { - userListSearchPopup.open() + userListSearchPopup.open(); } else if (filterText.length <= 0 && userListSearchPopup.visible) { - userListSearchPopup.close() + userListSearchPopup.close(); } } } @@ -204,7 +214,7 @@ FormCard.FormCardPage { action: Kirigami.Action { id: editPowerLevelAction onTriggered: { - userListSearchPopup.close() + userListSearchPopup.close(); let dialog = powerLevelDialog.createObject(applicationWindow().overlay, { room: root.room, userId: userListItem.userId, @@ -240,7 +250,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.defaultUserPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultUserPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.defaultUserPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Default power level to set the room state") @@ -249,7 +261,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.statePowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.statePowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.statePowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Default power level to send messages") @@ -258,7 +272,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.defaultEventPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.defaultEventPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.defaultEventPowerLevel = currentValue; + } } } @@ -274,7 +290,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.invitePowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.invitePowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.invitePowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Kick users") @@ -282,7 +300,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.kickPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.kickPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.kickPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Ban users") @@ -290,7 +310,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.banPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.banPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.banPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Remove message sent by other users") @@ -298,7 +320,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.redactPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.redactPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.redactPowerLevel = currentValue; + } } } @@ -315,7 +339,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.powerLevelPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.powerLevelPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.powerLevelPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Change the room name") @@ -324,7 +350,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.namePowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.namePowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.namePowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Change the room avatar") @@ -333,7 +361,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.avatarPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.avatarPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.avatarPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Change the room canonical alias") @@ -342,7 +372,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.canonicalAliasPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.canonicalAliasPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.canonicalAliasPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Change the room topic") @@ -351,7 +383,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.topicPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.topicPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.topicPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Enable encryption for the room") @@ -360,7 +394,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.encryptionPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.encryptionPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.encryptionPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Change the room history visibility") @@ -369,7 +405,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.historyVisibilityPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.historyVisibilityPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.historyVisibilityPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Set pinned events") @@ -378,7 +416,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.pinnedEventsPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.pinnedEventsPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.pinnedEventsPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Upgrade the room") @@ -387,7 +427,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.tombstonePowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.tombstonePowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.tombstonePowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Set the room server access control list (ACL)") @@ -396,7 +438,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.serverAclPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.serverAclPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.serverAclPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { visible: room.isSpace @@ -406,7 +450,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceChildPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.spaceChildPowerLevel = currentValue; + } } FormCard.FormComboBoxDelegate { text: i18n("Set the parent space of this room") @@ -415,7 +461,9 @@ FormCard.FormCardPage { valueRole: "powerLevel" model: powerLevelModel Component.onCompleted: currentIndex = indexOfValue(room.spaceChildPowerLevel) - onCurrentValueChanged: if(room.canSendState("m.room.power_levels")) room.spaceParentPowerLevel = currentValue + onCurrentValueChanged: if (room.canSendState("m.room.power_levels")) { + room.spaceParentPowerLevel = currentValue; + } } } } diff --git a/src/qml/PollDelegate.qml b/src/qml/PollDelegate.qml index a5178b700..84a8a3f50 100644 --- a/src/qml/PollDelegate.qml +++ b/src/qml/PollDelegate.qml @@ -53,7 +53,7 @@ MessageDelegate { } } Label { - visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded + visible: root.pollHandler.kind == "org.matrix.msc3381.poll.disclosed" || root.pollHandler.hasEnded text: i18np("Based on votes by %1 user", "Based on votes by %1 users", root.pollHandler.answerCount) + (root.pollHandler.hasEnded ? (" " + i18nc("as in 'this vote has ended'", "(Ended)")) : "") font.pointSize: questionLabel.font.pointSize * 0.8 } diff --git a/src/qml/PowerLevelDialog.qml b/src/qml/PowerLevelDialog.qml index c25be7702..67792e10d 100644 --- a/src/qml/PowerLevelDialog.qml +++ b/src/qml/PowerLevelDialog.qml @@ -24,7 +24,7 @@ Kirigami.Dialog { onOpened: { if (root.opened) { - powerLevelComboBox.currentIndex = powerLevelComboBox.indexOfValue(root.powerLevel) + powerLevelComboBox.currentIndex = powerLevelComboBox.indexOfValue(root.powerLevel); } } @@ -41,9 +41,18 @@ Kirigami.Dialog { // Done this way so we can have translated strings. Component.onCompleted: { - powerLevelModel.append({"text": i18n("Member (0)"), "powerLevel": 0}); - powerLevelModel.append({"text": i18n("Moderator (50)"), "powerLevel": 50}); - powerLevelModel.append({"text": i18n("Admin (100)"), "powerLevel": 100}); + powerLevelModel.append({ + "text": i18n("Member (0)"), + "powerLevel": 0 + }); + powerLevelModel.append({ + "text": i18n("Moderator (50)"), + "powerLevel": 50 + }); + powerLevelModel.append({ + "text": i18n("Admin (100)"), + "powerLevel": 100 + }); } } } @@ -52,9 +61,9 @@ Kirigami.Dialog { text: i18n("Confirm") icon.name: "dialog-ok" onTriggered: { - root.room.setUserPowerLevel(root.userId, powerLevelComboBox.currentValue) - root.close() - root.destroy() + root.room.setUserPowerLevel(root.userId, powerLevelComboBox.currentValue); + root.close(); + root.destroy(); } } ] diff --git a/src/qml/PushNotification.qml b/src/qml/PushNotification.qml index 5a3842dcc..355088a1e 100644 --- a/src/qml/PushNotification.qml +++ b/src/qml/PushNotification.qml @@ -32,31 +32,31 @@ FormCard.FormCardPage { checked: room.pushNotificationState === PushNotificationState.Default enabled: room.pushNotificationState !== PushNotificationState.Unknown onToggled: { - room.pushNotificationState = PushNotificationState.Default + room.pushNotificationState = PushNotificationState.Default; } } FormCard.FormRadioDelegate { - text: i18nc("As in 'notify for all messages'","All") + text: i18nc("As in 'notify for all messages'", "All") checked: room.pushNotificationState === PushNotificationState.All enabled: room.pushNotificationState !== PushNotificationState.Unknown onToggled: { - room.pushNotificationState = PushNotificationState.All + room.pushNotificationState = PushNotificationState.All; } } FormCard.FormRadioDelegate { - text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'","@Mentions and Keywords") + text: i18nc("As in 'notify when the user is mentioned or the message contains a set keyword'", "@Mentions and Keywords") checked: room.pushNotificationState === PushNotificationState.MentionKeyword enabled: room.pushNotificationState !== PushNotificationState.Unknown onToggled: { - room.pushNotificationState = PushNotificationState.MentionKeyword + room.pushNotificationState = PushNotificationState.MentionKeyword; } } FormCard.FormRadioDelegate { - text: i18nc("As in 'do not notify for any messages'","Off") + text: i18nc("As in 'do not notify for any messages'", "Off") checked: room.pushNotificationState === PushNotificationState.Mute enabled: room.pushNotificationState !== PushNotificationState.Unknown onToggled: { - room.pushNotificationState = PushNotificationState.Mute + room.pushNotificationState = PushNotificationState.Mute; } } } @@ -69,9 +69,9 @@ FormCard.FormCardPage { model: KSortFilterProxyModel { sourceModel: root.pushRuleModel - filterRowCallback: function(source_row, source_parent) { - let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole) - let roomIdRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.RoomIdRole) + filterRowCallback: function (source_row, source_parent) { + let sectionRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.SectionRole); + let roomIdRole = sourceModel.data(sourceModel.index(source_row, 0, source_parent), PushRuleModel.RoomIdRole); return sectionRole == PushRuleSection.RoomKeywords && roomIdRole == root.room.id; } } @@ -82,16 +82,16 @@ FormCard.FormCardPage { id: ruleDelegate NotificationRuleItem { onDeleteRule: { - root.pushRuleModel.removeKeyword(id) + root.pushRuleModel.removeKeyword(id); } - onActionChanged: (action) => root.pushRuleModel.setPushRuleAction(id, action) + onActionChanged: action => root.pushRuleModel.setPushRuleAction(id, action) } } } FormCard.AbstractFormDelegate { Layout.fillWidth: true - contentItem : RowLayout { + contentItem: RowLayout { Kirigami.ActionTextField { id: keywordAddField @@ -104,13 +104,13 @@ FormCard.FormCardPage { icon.name: "edit-clear" visible: keywordAddField.text.length > 0 onTriggered: { - keywordAddField.text = "" + keywordAddField.text = ""; } } onAccepted: { - root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id) - keywordAddField.text = "" + root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id); + keywordAddField.text = ""; } } QQC2.Button { @@ -123,8 +123,8 @@ FormCard.FormCardPage { enabled: NotificationsManager.keywordNotificationAction !== PushRuleAction.Unknown && keywordAddField.text.length > 0 onClicked: { - root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id) - keywordAddField.text = "" + root.pushRuleModel.addKeyword(keywordAddField.text, root.room.id); + keywordAddField.text = ""; } QQC2.ToolTip { diff --git a/src/qml/QuickFormatBar.qml b/src/qml/QuickFormatBar.qml index 9266e8f29..115ea70ab 100644 --- a/src/qml/QuickFormatBar.qml +++ b/src/qml/QuickFormatBar.qml @@ -27,10 +27,10 @@ QQC2.Popup { const format = { start: "**", end: "**", - extra: "", - } - formattingSelected(format, selectionStart, selectionEnd) - root.close() + extra: "" + }; + formattingSelected(format, selectionStart, selectionEnd); + root.close(); } QQC2.ToolTip.text: text @@ -46,10 +46,10 @@ QQC2.Popup { const format = { start: "*", end: "*", - extra: "", - } - formattingSelected(format, selectionStart, selectionEnd) - root.close() + extra: "" + }; + formattingSelected(format, selectionStart, selectionEnd); + root.close(); } QQC2.ToolTip.text: text @@ -65,10 +65,10 @@ QQC2.Popup { const format = { start: "", end: "", - extra: "", - } - formattingSelected(format, selectionStart, selectionEnd) - root.close() + extra: "" + }; + formattingSelected(format, selectionStart, selectionEnd); + root.close(); } QQC2.ToolTip.text: text @@ -84,10 +84,10 @@ QQC2.Popup { const format = { start: "`", end: "`", - extra: "", - } - formattingSelected(format, selectionStart, selectionEnd) - root.close() + extra: "" + }; + formattingSelected(format, selectionStart, selectionEnd); + root.close(); } QQC2.ToolTip.text: text @@ -103,10 +103,10 @@ QQC2.Popup { const format = { start: selectionStart == 0 ? ">" : "\n>", end: "\n\n", - extra: "", - } - formattingSelected(format, selectionStart, selectionEnd) - root.close() + extra: "" + }; + formattingSelected(format, selectionStart, selectionEnd); + root.close(); } QQC2.ToolTip.text: text @@ -122,10 +122,10 @@ QQC2.Popup { const format = { start: "[", end: "](", - extra: ")", - } - formattingSelected(format, selectionStart, selectionEnd) - root.close() + extra: ")" + }; + formattingSelected(format, selectionStart, selectionEnd); + root.close(); } QQC2.ToolTip.text: text diff --git a/src/qml/QuickSwitcher.qml b/src/qml/QuickSwitcher.qml index 8e2a666bc..2426022ff 100644 --- a/src/qml/QuickSwitcher.qml +++ b/src/qml/QuickSwitcher.qml @@ -26,7 +26,6 @@ QQC2.Dialog { anchors.centerIn: applicationWindow().overlay - Shortcut { sequence: "Ctrl+K" onActivated: root.open() @@ -34,28 +33,28 @@ QQC2.Dialog { onVisibleChanged: { if (!visible) { - return + return; } - searchField.forceActiveFocus() - searchField.text = "" - roomList.currentIndex = 0 + searchField.forceActiveFocus(); + searchField.text = ""; + roomList.currentIndex = 0; } header: Kirigami.SearchField { id: searchField Keys.onDownPressed: { - roomList.forceActiveFocus() + roomList.forceActiveFocus(); if (roomList.currentIndex < roomList.count - 1) { - roomList.currentIndex++ + roomList.currentIndex++; } else { - roomList.currentIndex = 0 + roomList.currentIndex = 0; } } Keys.onUpPressed: { if (roomList.currentIndex === 0) { - roomList.currentIndex = roomList.count - 1 + roomList.currentIndex = roomList.count - 1; } else { - roomList.currentIndex-- + roomList.currentIndex--; } } Keys.onEnterPressed: { diff --git a/src/qml/ReactionDelegate.qml b/src/qml/ReactionDelegate.qml index 293fc18fe..fed59dd68 100644 --- a/src/qml/ReactionDelegate.qml +++ b/src/qml/ReactionDelegate.qml @@ -71,4 +71,3 @@ Flow { } } } - diff --git a/src/qml/ReadMarkerDelegate.qml b/src/qml/ReadMarkerDelegate.qml index 726d43fe7..26c88bf96 100644 --- a/src/qml/ReadMarkerDelegate.qml +++ b/src/qml/ReadMarkerDelegate.qml @@ -19,7 +19,9 @@ TimelineDelegate { property bool isTemporaryHighlighted: false - onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) temporaryHighlightTimer.start() + onIsTemporaryHighlightedChanged: if (isTemporaryHighlighted) { + temporaryHighlightTimer.start(); + } Timer { id: temporaryHighlightTimer @@ -36,9 +38,9 @@ TimelineDelegate { id: readMarkerBackground color: { if (root.isTemporaryHighlighted) { - return Kirigami.Theme.positiveBackgroundColor + return Kirigami.Theme.positiveBackgroundColor; } else { - return Kirigami.Theme.backgroundColor + return Kirigami.Theme.backgroundColor; } } Kirigami.Theme.inherit: false @@ -51,7 +53,11 @@ TimelineDelegate { border.width: 1 Behavior on color { - ColorAnimation {target: readMarkerBackground; duration: Kirigami.Units.veryLongDuration; easing.type: Easing.InOutCubic} + ColorAnimation { + target: readMarkerBackground + duration: Kirigami.Units.veryLongDuration + easing.type: Easing.InOutCubic + } } } } diff --git a/src/qml/RegisterPassword.qml b/src/qml/RegisterPassword.qml index e223f5770..771e62ad5 100644 --- a/src/qml/RegisterPassword.qml +++ b/src/qml/RegisterPassword.qml @@ -11,7 +11,9 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) passwordField.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) { + passwordField.forceActiveFocus(); + } FormCard.FormTextFieldDelegate { id: passwordField @@ -19,7 +21,7 @@ LoginStep { echoMode: TextInput.Password onTextChanged: Registration.password = text Keys.onReturnPressed: { - confirmPasswordField.forceActiveFocus() + confirmPasswordField.forceActiveFocus(); } } @@ -31,15 +33,15 @@ LoginStep { statusMessage: passwordField.text.length === confirmPasswordField.text.length && passwordField.text !== confirmPasswordField.text ? i18n("The passwords do not match.") : "" Keys.onReturnPressed: { if (root.nextAction.enabled) { - root.nextAction.trigger() + root.nextAction.trigger(); } } } nextAction: Kirigami.Action { onTriggered: { - passwordField.enabled = false - Registration.registerAccount() + passwordField.enabled = false; + Registration.registerAccount(); } enabled: passwordField.text === confirmPasswordField.text } diff --git a/src/qml/RemoveSheet.qml b/src/qml/RemoveSheet.qml index 19c3b4015..e2dcef296 100644 --- a/src/qml/RemoveSheet.qml +++ b/src/qml/RemoveSheet.qml @@ -46,11 +46,11 @@ Kirigami.Page { QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole onClicked: { if (root.userId.length > 0) { - root.room.deleteMessagesByUser(root.userId, reason.text) + root.room.deleteMessagesByUser(root.userId, reason.text); } else { root.room.redactEvent(root.eventId, reason.text); } - root.closeDialog() + root.closeDialog(); } } QQC2.Button { diff --git a/src/qml/ReplyComponent.qml b/src/qml/ReplyComponent.qml index 15bbb2a37..bd948a881 100644 --- a/src/qml/ReplyComponent.qml +++ b/src/qml/ReplyComponent.qml @@ -73,7 +73,7 @@ RowLayout { /** * @brief The reply has been clicked. */ - signal replyClicked() + signal replyClicked spacing: Kirigami.Units.largeSpacing @@ -118,20 +118,20 @@ RowLayout { sourceComponent: { switch (root.type) { - case DelegateType.Image: - case DelegateType.Sticker: - return imageComponent; - case DelegateType.Message: - case DelegateType.Notice: - return textComponent; - case DelegateType.File: - case DelegateType.Video: - case DelegateType.Audio: - return mimeComponent; - case DelegateType.Encrypted: - return encryptedComponent; - default: - return textComponent; + case DelegateType.Image: + case DelegateType.Sticker: + return imageComponent; + case DelegateType.Message: + case DelegateType.Notice: + return textComponent; + case DelegateType.File: + case DelegateType.Video: + case DelegateType.Audio: + return mimeComponent; + case DelegateType.Encrypted: + return encryptedComponent; + default: + return textComponent; } } } diff --git a/src/qml/ReplyPane.qml b/src/qml/ReplyPane.qml index 61e97e802..36673b272 100644 --- a/src/qml/ReplyPane.qml +++ b/src/qml/ReplyPane.qml @@ -89,7 +89,7 @@ RowLayout { text: i18nc("@action:button", "Cancel reply") icon.name: "dialog-close" onClicked: { - root.cancel() + root.cancel(); } QQC2.ToolTip.text: text QQC2.ToolTip.visible: hovered diff --git a/src/qml/ReportSheet.qml b/src/qml/ReportSheet.qml index b006948a5..ff69100c0 100644 --- a/src/qml/ReportSheet.qml +++ b/src/qml/ReportSheet.qml @@ -44,8 +44,8 @@ Kirigami.Page { icon.name: "dialog-warning-symbolic" QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole onClicked: { - root.room.reportEvent(eventId, reason.text) - root.closeDialog() + root.room.reportEvent(eventId, reason.text); + root.closeDialog(); } } QQC2.Button { diff --git a/src/qml/RichLabel.qml b/src/qml/RichLabel.qml index ba34c6f7b..54b1f02e0 100644 --- a/src/qml/RichLabel.qml +++ b/src/qml/RichLabel.qml @@ -106,8 +106,8 @@ a{ textFormat: Text.RichText onLinkActivated: link => { - spoilerRevealed = true - RoomManager.resolveResource(link, "join") + spoilerRevealed = true; + RoomManager.resolveResource(link, "join"); } onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") { applicationWindow().hoverLinkIndicator.text = hoveredLink; diff --git a/src/qml/RoomData.qml b/src/qml/RoomData.qml index e882bfbda..10fe4b88e 100644 --- a/src/qml/RoomData.qml +++ b/src/qml/RoomData.qml @@ -94,7 +94,7 @@ ColumnLayout { }, { title: i18n("Event Source"), width: Kirigami.Units.gridUnit * 25 - }); + }) } } } diff --git a/src/qml/RoomDelegate.qml b/src/qml/RoomDelegate.qml index d9ce88f89..cb0dfa279 100644 --- a/src/qml/RoomDelegate.qml +++ b/src/qml/RoomDelegate.qml @@ -31,7 +31,7 @@ Delegates.RoundedItemDelegate { readonly property bool hasNotifications: currentRoom.pushNotificationState === PushNotificationState.MentionKeyword || currentRoom.isLowPriority ? highlightCount > 0 : notificationCount > 0 - signal selected() + signal selected Accessible.name: root.displayName Accessible.onPressAction: select() @@ -48,7 +48,7 @@ Delegates.RoundedItemDelegate { if (button === Qt.RightButton) { root.createRoomListContextMenu(); } else { - select() + select(); } } } @@ -57,7 +57,7 @@ Delegates.RoundedItemDelegate { spacing: Kirigami.Units.largeSpacing Components.Avatar { - source: root.avatar ? "image://mxc/" + root.avatar : "" + source: root.avatar ? "image://mxc/" + root.avatar : "" name: root.displayName visible: Config.showAvatarInRoomDrawer implicitHeight: Kirigami.Units.gridUnit + (Config.compactRoomList ? 0 : Kirigami.Units.largeSpacing * 2) @@ -149,11 +149,11 @@ Delegates.RoundedItemDelegate { function select() { RoomManager.resolveResource(currentRoom.id); - root.selected() + root.selected(); } function createRoomListContextMenu() { - const component = Qt.createComponent("qrc:/org/kde/neochat/qml/ContextMenu.qml") + const component = Qt.createComponent("qrc:/org/kde/neochat/qml/ContextMenu.qml"); if (component.status === Component.Error) { console.error(component.errorString()); } @@ -165,13 +165,12 @@ Delegates.RoundedItemDelegate { configButton.visible = true; configButton.down = true; } - menu.closed.connect(function() { + menu.closed.connect(function () { configButton.down = undefined; configButton.visible = Qt.binding(() => { - return root.hovered && !Kirigami.Settings.isMobile - && !Config.compactRoomList; + return root.hovered && !Kirigami.Settings.isMobile && !Config.compactRoomList; }); - }) - menu.open() + }); + menu.open(); } } diff --git a/src/qml/RoomDrawer.qml b/src/qml/RoomDrawer.qml index ae347689b..e3a507996 100644 --- a/src/qml/RoomDrawer.qml +++ b/src/qml/RoomDrawer.qml @@ -27,7 +27,7 @@ Kirigami.OverlayDrawer { if (Config.roomDrawerWidth === -1) { return Kirigami.Units.gridUnit * 20; } else { - return Config.roomDrawerWidth + return Config.roomDrawerWidth; } } @@ -53,9 +53,9 @@ Kirigami.OverlayDrawer { return; } if (Qt.application.layoutDirection === Qt.RightToLeft) { - root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x)) + root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth - _lastX + mapToGlobal(mouseX, mouseY).x)); } else { - root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x)) + root.actualWidth = Math.min(root.maxWidth, Math.max(root.minWidth, Config.roomDrawerWidth + _lastX - mapToGlobal(mouseX, mouseY).x)); } } } @@ -65,7 +65,8 @@ Kirigami.OverlayDrawer { // If modal has been changed and the drawer is closed automatically then dim on popup open will have been switched off in main.qml so switch it back on after the animation completes. // This is to avoid dim being active for a split second when the drawer is switched to modal which looks terrible. - onAnimatingChanged: if (dim === false) dim = undefined + onAnimatingChanged: if (dim === false) + dim = undefined topPadding: 0 bottomPadding: 0 @@ -101,7 +102,12 @@ Kirigami.OverlayDrawer { text: i18n("Room settings") display: QQC2.AbstractButton.IconOnly - onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: root.connection}, { title: i18n("Room Settings") }) + onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: room, + connection: root.connection + }, { + title: i18n("Room Settings") + }) QQC2.ToolTip.text: text QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay diff --git a/src/qml/RoomDrawerPage.qml b/src/qml/RoomDrawerPage.qml index f0381d52b..3b50e066c 100644 --- a/src/qml/RoomDrawerPage.qml +++ b/src/qml/RoomDrawerPage.qml @@ -44,7 +44,12 @@ Kirigami.Page { displayHint: Kirigami.DisplayHint.IconOnly text: i18n("Settings") icon.name: "settings-configure" - onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: root.room, connection: root.connection}, { title: i18n("Room Settings") }) + onTriggered: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: root.room, + connection: root.connection + }, { + title: i18n("Room Settings") + }) } ] @@ -96,14 +101,14 @@ Kirigami.Page { target: applicationWindow().pageStack onWideModeChanged: { if (applicationWindow().pageStack.wideMode) { - console.log("widemode pop") - applicationWindow().pageStack.pop() + console.log("widemode pop"); + applicationWindow().pageStack.pop(); } } } onBackRequested: event => { event.accepted = true; - applicationWindow().pageStack.pop() + applicationWindow().pageStack.pop(); } } diff --git a/src/qml/RoomInformation.qml b/src/qml/RoomInformation.qml index 9458440b5..4b75c0822 100644 --- a/src/qml/RoomInformation.qml +++ b/src/qml/RoomInformation.qml @@ -82,7 +82,12 @@ QQC2.ScrollView { Layout.fillWidth: true onClicked: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/DevtoolsPage.qml", {room: root.room, connection: root.connection}, {title: i18n("Developer Tools")}) + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/DevtoolsPage.qml", { + room: root.room, + connection: root.connection + }, { + title: i18n("Developer Tools") + }); } } @@ -99,7 +104,7 @@ QQC2.ScrollView { room: root.room }, { title: i18nc("@action:title", "Search") - }) + }); } } @@ -142,7 +147,11 @@ QQC2.ScrollView { icon.name: "list-add-user" onClicked: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", {room: root.room}, {title: i18nc("@title", "Invite a User")}) + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", { + room: root.room + }, { + title: i18nc("@title", "Invite a User") + }); } QQC2.ToolTip.text: i18n("Invite user to room") @@ -160,7 +169,9 @@ QQC2.ScrollView { id: userListSearchField visible: !root.room.isDirectChat() - onVisibleChanged: if (visible) forceActiveFocus() + onVisibleChanged: if (visible) { + forceActiveFocus(); + } Layout.fillWidth: true Layout.leftMargin: Kirigami.Units.largeSpacing Layout.rightMargin: Kirigami.Units.largeSpacing @@ -168,7 +179,7 @@ QQC2.ScrollView { focusSequence: "Ctrl+Shift+F" - onAccepted: sortedMessageEventModel.filterString = text; + onAccepted: sortedMessageEventModel.filterString = text } } @@ -205,7 +216,7 @@ QQC2.ScrollView { onClicked: { userDelegate.highlighted = true; - RoomManager.resolveResource(userDelegate.userId, "mention") + RoomManager.resolveResource(userDelegate.userId, "mention"); } contentItem: RowLayout { @@ -258,6 +269,6 @@ QQC2.ScrollView { if (root.headerItem) { root.headerItem.userListSearchField.text = ""; } - userList.currentIndex = -1 + userList.currentIndex = -1; } } diff --git a/src/qml/RoomListPage.qml b/src/qml/RoomListPage.qml index 64545f5a2..0f8d90e21 100644 --- a/src/qml/RoomListPage.qml +++ b/src/qml/RoomListPage.qml @@ -47,7 +47,7 @@ Kirigami.Page { Connections { target: RoomManager function onCurrentRoomChanged() { - itemSelection.setCurrentIndex(roomListModel.index(roomListModel.rowForRoom(RoomManager.currentRoom), 0), ItemSelectionModel.SelectCurrent) + itemSelection.setCurrentIndex(roomListModel.index(roomListModel.rowForRoom(RoomManager.currentRoom), 0), ItemSelectionModel.SelectCurrent); } } @@ -74,24 +74,24 @@ Kirigami.Page { } function goToNextRoom() { - goToNextRoomFiltered((item) => item.visible); + goToNextRoomFiltered(item => item.visible); } function goToPreviousRoom() { - goToPreviousRoomFiltered((item) => item.visible); + goToPreviousRoomFiltered(item => item.visible); } function goToNextUnreadRoom() { - goToNextRoomFiltered((item) => (item.visible && item.hasUnread)); + goToNextRoomFiltered(item => (item.visible && item.hasUnread)); } function goToPreviousUnreadRoom() { - goToPreviousRoomFiltered((item) => (item.visible && item.hasUnread)); + goToPreviousRoomFiltered(item => (item.visible && item.hasUnread)); } titleDelegate: Loader { Layout.fillWidth: true - sourceComponent: Kirigami.Settings.isMobile ? userInfo : exploreComponent + sourceComponent: Kirigami.Settings.isMobile ? userInfo : exploreComponent } padding: 0 @@ -107,7 +107,7 @@ Kirigami.Page { connection: root.connection - onSelectionChanged: root.spaceChanging = true; + onSelectionChanged: root.spaceChanging = true onSpacesUpdated: sortFilterRoomListModel.invalidate() } @@ -145,7 +145,7 @@ Kirigami.Page { rightPadding: Kirigami.Units.largeSpacing bottomPadding: Kirigami.Units.largeSpacing - onClicked: quickView.item.open(); + onClicked: quickView.item.open() Kirigami.Icon { anchors.centerIn: parent @@ -181,10 +181,10 @@ Kirigami.Page { keyword: sortFilterRoomListModel.filterText }, { title: i18nc("@title", "Explore Rooms") - }) + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { - RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join") - }) + RoomManager.resolveResource(roomId.length > 0 ? roomId : alias, isJoined ? "" : "join"); + }); } } @@ -192,7 +192,11 @@ Kirigami.Page { id: userSearchAction icon.name: sortFilterRoomListModel.filterText.length > 0 ? "search" : "list-add" text: sortFilterRoomListModel.filterText.length > 0 ? i18n("Search in friend directory") : i18n("Find your friends") - onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) + onTriggered: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Find your friends") + }) } } @@ -208,8 +212,8 @@ Kirigami.Page { sourceModel: root.roomListModel roomSortOrder: SortFilterRoomListModel.Categories onLayoutChanged: { - layoutTimer.restart() - listView.currentIndex = sortFilterRoomListModel.mapFromSource(itemSelection.currentIndex).row + layoutTimer.restart(); + listView.currentIndex = sortFilterRoomListModel.mapFromSource(itemSelection.currentIndex).row; } activeSpaceId: spaceDrawer.selectedSpaceId mode: spaceDrawer.showDirectChats ? SortFilterRoomListModel.DirectChats : SortFilterRoomListModel.Rooms @@ -317,7 +321,11 @@ Kirigami.Page { icon.width: Kirigami.Units.gridUnit * 2 icon.height: Kirigami.Units.gridUnit * 2 - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", {connection: root.connection}, {title: i18nc("@title", "Find your friends")}) + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/UserSearchPage.qml", { + connection: root.connection + }, { + title: i18nc("@title", "Find your friends") + }) } } } @@ -402,8 +410,8 @@ Kirigami.Page { ExploreComponentMobile { connection: root.connection - onTextChanged: (newText) => { - sortFilterRoomListModel.filterText = newText + onTextChanged: newText => { + sortFilterRoomListModel.filterText = newText; } } } diff --git a/src/qml/RoomPage.qml b/src/qml/RoomPage.qml index c0e64e8fb..1231f462a 100644 --- a/src/qml/RoomPage.qml +++ b/src/qml/RoomPage.qml @@ -125,7 +125,7 @@ Kirigami.Page { actionsHandler: root.actionsHandler onFocusChatBar: { if (chatBarLoader.item) { - chatBarLoader.item.forceActiveFocus() + chatBarLoader.item.forceActiveFocus(); } } } @@ -175,9 +175,9 @@ Kirigami.Page { Connections { target: RoomManager function onCurrentRoomChanged() { - if(!RoomManager.currentRoom) { - if(pageStack.lastItem === root) { - pageStack.pop() + if (!RoomManager.currentRoom) { + if (pageStack.lastItem === root) { + pageStack.pop(); } } else if (root.currentRoom.isInvite) { root.currentRoom.clearInvitationNotification(); @@ -205,7 +205,7 @@ Kirigami.Page { Connections { target: root.connection function onJoinedRoom(room, invited) { - if(root.currentRoom.id === invited.id) { + if (root.currentRoom.id === invited.id) { RoomManager.resolveResource(room.id); } } @@ -219,10 +219,10 @@ Kirigami.Page { return; } else if (event.key === Qt.Key_PageUp) { event.accepted = true; - timelineViewLoader.item.pageUp() + timelineViewLoader.item.pageUp(); } else if (event.key === Qt.Key_PageDown) { event.accepted = true; - timelineViewLoader.item.pageDown() + timelineViewLoader.item.pageDown(); } } @@ -237,14 +237,14 @@ Kirigami.Page { function warning(title, message) { banner.text = `${title}
${message}`; - banner.type = Kirigami.MessageType.Warning; + banner.type = Kirigami.MessageType.Warning; banner.visible = true; } Connections { target: RoomManager function onShowUserDetail(user) { - root.showUserDetail(user) + root.showUserDetail(user); } function onShowEventSource(eventId) { @@ -283,19 +283,19 @@ Kirigami.Page { function onShowMaximizedMedia(index) { var popup = maximizeComponent.createObject(QQC2.Overlay.overlay, { initialIndex: index - }) + }); popup.closed.connect(() => { - timelineViewLoader.item.interactive = true - popup.destroy() - }) - popup.open() + timelineViewLoader.item.interactive = true; + popup.destroy(); + }); + popup.open(); } } function showUserDetail(user) { userDetailDialog.createObject(QQC2.ApplicationWindow.overlay, { room: root.currentRoom, - user: root.currentRoom.getUser(user.id), + user: root.currentRoom.getUser(user.id) }).open(); } diff --git a/src/qml/RoomSecurity.qml b/src/qml/RoomSecurity.qml index 5eb2718d5..e8fcbebe6 100644 --- a/src/qml/RoomSecurity.qml +++ b/src/qml/RoomSecurity.qml @@ -30,7 +30,9 @@ FormCard.FormCardPage { enabled: room.canEncryptRoom checked: room.usesEncryption onToggled: if (checked) { - let dialog = confirmEncryptionDialog.createObject(applicationWindow().overlay, {room: room}); + let dialog = confirmEncryptionDialog.createObject(applicationWindow().overlay, { + room: room + }); dialog.open(); } } @@ -51,8 +53,7 @@ FormCard.FormCardPage { } FormCard.FormRadioDelegate { text: i18nc("@option:check", "Space members") - description: i18n("Anyone in the selected spaces can find and join.") + - (!["8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "") + description: i18n("Anyone in the selected spaces can find and join.") + (!["8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "") checked: room.joinRule === "restricted" enabled: room.canSendState("m.room.join_rules") && ["8", "9", "10"].includes(room.version) onCheckedChanged: if (checked && room.joinRule != "restricted") { @@ -64,7 +65,7 @@ FormCard.FormCardPage { text: i18n("Select spaces") icon.name: "list-add" - onClicked: selectSpacesDialog.createObject(applicationWindow().overlay).open(); + onClicked: selectSpacesDialog.createObject(applicationWindow().overlay).open() QQC2.ToolTip.text: text QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay @@ -80,8 +81,7 @@ FormCard.FormCardPage { } FormCard.FormRadioDelegate { text: i18nc("@option:check", "Knock") - description: i18n("People not in the room need to request an invite to join the room.") + - (!["7", "8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "") + description: i18n("People not in the room need to request an invite to join the room.") + (!["7", "8", "9", "10"].includes(room.version) ? `\n${needUpgradeRoom}` : "") checked: room.joinRule === "knock" // https://spec.matrix.org/v1.4/rooms/#feature-matrix enabled: room.canSendState("m.room.join_rules") && ["7", "8", "9", "10"].includes(room.version) @@ -110,7 +110,7 @@ FormCard.FormCardPage { checked: room.historyVisibility === "world_readable" enabled: room.canSendState("m.room.history_visibility") onCheckedChanged: if (checked) { - room.historyVisibility = "world_readable" + room.historyVisibility = "world_readable"; } } FormCard.FormRadioDelegate { @@ -119,7 +119,7 @@ FormCard.FormCardPage { checked: room.historyVisibility === "shared" enabled: room.canSendState("m.room.history_visibility") onCheckedChanged: if (checked) { - room.historyVisibility = "shared" + room.historyVisibility = "shared"; } } FormCard.FormRadioDelegate { @@ -128,7 +128,7 @@ FormCard.FormCardPage { checked: room.historyVisibility === "invited" enabled: room.canSendState("m.room.history_visibility") onCheckedChanged: if (checked) { - room.historyVisibility = "invited" + room.historyVisibility = "invited"; } } FormCard.FormRadioDelegate { @@ -137,7 +137,7 @@ FormCard.FormCardPage { checked: room.historyVisibility === "joined" enabled: room.canSendState("m.room.history_visibility") onCheckedChanged: if (checked) { - room.historyVisibility = "joined" + room.historyVisibility = "joined"; } } } @@ -150,7 +150,7 @@ FormCard.FormCardPage { // At the point this is executed, the state in the room is not yet changed. // The value will be updated when room.onEncryption() emitted. // This is in case if user simply closed the dialog. - enableEncryptionSwitch.checked = false + enableEncryptionSwitch.checked = false; } } } @@ -158,8 +158,7 @@ FormCard.FormCardPage { property Connections connections: Connections { target: room onEncryption: { - enableEncryptionSwitch.checked = room.usesEncryption + enableEncryptionSwitch.checked = room.usesEncryption; } } } - diff --git a/src/qml/RoomWindow.qml b/src/qml/RoomWindow.qml index ab880fb5b..7e07a5c00 100644 --- a/src/qml/RoomWindow.qml +++ b/src/qml/RoomWindow.qml @@ -41,7 +41,7 @@ Kirigami.ApplicationWindow { } onCurrentRoomChanged: if (!currentRoom) { - root.close() + root.close(); } property Item hoverLinkIndicator: QQC2.Control { @@ -58,7 +58,7 @@ Kirigami.ApplicationWindow { } Kirigami.Theme.colorSet: Kirigami.Theme.View background: Rectangle { - color: Kirigami.Theme.backgroundColor + color: Kirigami.Theme.backgroundColor } } } diff --git a/src/qml/SearchPage.qml b/src/qml/SearchPage.qml index a908f3151..87a4cf7ed 100644 --- a/src/qml/SearchPage.qml +++ b/src/qml/SearchPage.qml @@ -110,7 +110,7 @@ Kirigami.ScrollablePage { Keys.onEnterPressed: searchButton.clicked() Keys.onReturnPressed: searchButton.clicked() onTextChanged: { - searchTimer.restart() + searchTimer.restart(); if (model) { model.searchText = text; } @@ -121,7 +121,7 @@ Kirigami.ScrollablePage { icon.name: "search" onClicked: { if (typeof model.search === 'function') { - model.search() + model.search(); } } } @@ -130,7 +130,7 @@ Kirigami.ScrollablePage { interval: 500 running: true onTriggered: if (typeof model.search === 'function') { - model.search() + model.search(); } } } @@ -162,4 +162,3 @@ Kirigami.ScrollablePage { } } } - diff --git a/src/qml/SelectParentDialog.qml b/src/qml/SelectParentDialog.qml index b6cfa8abe..f2ea1566b 100644 --- a/src/qml/SelectParentDialog.qml +++ b/src/qml/SelectParentDialog.qml @@ -37,7 +37,7 @@ Kirigami.Dialog { text: i18n("OK") icon.name: "dialog-ok" onTriggered: { - root.room.addParent(chosenRoomDelegate.roomId, makeCanonicalCheck.checked, existingOfficialCheck.checked) + root.room.addParent(chosenRoomDelegate.roomId, makeCanonicalCheck.checked, existingOfficialCheck.checked); root.close(); } } @@ -49,7 +49,12 @@ Kirigami.Dialog { visible: !chosenRoomDelegate.visible text: i18nc("@action:button", "Pick room") onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.room.connection, showOnlySpaces: true}, {title: i18nc("@title", "Choose Parent Space")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.room.connection, + showOnlySpaces: true + }, { + title: i18nc("@title", "Choose Parent Space") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.displayName = displayName; @@ -59,7 +64,7 @@ Kirigami.Dialog { chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.visible = true; - }) + }); } } FormCard.AbstractFormDelegate { @@ -104,7 +109,7 @@ Kirigami.Dialog { QQC2.Label { Layout.fillWidth: true visible: text - text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm," ") : "" + text: chosenRoomDelegate.topic ? chosenRoomDelegate.topic.replace(/(\r\n\t|\n|\r\t)/gm, " ") : "" textFormat: Text.PlainText elide: Text.ElideRight wrapMode: Text.NoWrap @@ -128,7 +133,12 @@ Kirigami.Dialog { } onClicked: { - let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", {connection: root.room.connection, showOnlySpaces: true}, {title: i18nc("@title", "Explore Rooms")}) + let dialog = pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/ExploreRoomsPage.qml", { + connection: root.room.connection, + showOnlySpaces: true + }, { + title: i18nc("@title", "Explore Rooms") + }); dialog.roomSelected.connect((roomId, displayName, avatarUrl, alias, topic, memberCount, isJoined) => { chosenRoomDelegate.roomId = roomId; chosenRoomDelegate.displayName = displayName; @@ -138,7 +148,7 @@ Kirigami.Dialog { chosenRoomDelegate.memberCount = memberCount; chosenRoomDelegate.isJoined = isJoined; chosenRoomDelegate.visible = true; - }) + }); } } FormCard.FormCheckDelegate { diff --git a/src/qml/SelectSpacesDialog.qml b/src/qml/SelectSpacesDialog.qml index eac9dc535..40872ec6a 100644 --- a/src/qml/SelectSpacesDialog.qml +++ b/src/qml/SelectSpacesDialog.qml @@ -42,8 +42,8 @@ Kirigami.Dialog { ids.push(spaceGroup.buttons[i].modelData.id); } } - root.room.setJoinRule("restricted", ids) - console.warn(ids) + root.room.setJoinRule("restricted", ids); + console.warn(ids); } QQC2.ButtonGroup { diff --git a/src/qml/ServerComboBox.qml b/src/qml/ServerComboBox.qml index 54342ca85..cba66da87 100644 --- a/src/qml/ServerComboBox.qml +++ b/src/qml/ServerComboBox.qml @@ -49,7 +49,7 @@ QQC2.ComboBox { bottomInset: index === ListView.view.count - 1 ? Kirigami.Units.smallSpacing : Math.round(Kirigami.Units.smallSpacing / 2) onClicked: if (isAddServerDelegate) { - addServerSheet.open() + addServerSheet.open(); } contentItem: RowLayout { @@ -71,7 +71,7 @@ QQC2.ComboBox { onClicked: { if (root.currentIndex === serverItem.index && serverItem.isDeletable) { root.currentIndex = 0; - root.server = root.currentValue + root.server = root.currentValue; root.popup.close(); } if (serverItem.isAddServerDelegate) { @@ -87,7 +87,7 @@ QQC2.ComboBox { onActivated: { if (currentIndex !== count - 1) { - root.server = root.currentValue + root.server = root.currentValue; } } @@ -99,14 +99,14 @@ QQC2.ComboBox { title: i18nc("@title:window", "Add server") onOpened: if (!serverUrlField.isValidServer && !addServerSheet.opened) { - root.currentIndex = 0 - root.server = root.currentValue + root.currentIndex = 0; + root.server = root.currentValue; } else if (addServerSheet.opened) { - serverUrlField.forceActiveFocus() + serverUrlField.forceActiveFocus(); } onClosed: if (serverUrlField.length <= 0) { - root.currentIndex = root.indexOfValue(root.server) + root.currentIndex = root.indexOfValue(root.server); } contentItem: Kirigami.FormLayout { @@ -123,8 +123,8 @@ QQC2.ComboBox { Kirigami.FormData.label: i18n("Server URL") onTextChanged: { - if(acceptableInput) { - serverListModel.checkServer(text) + if (acceptableInput) { + serverListModel.checkServer(text); } } @@ -136,7 +136,7 @@ QQC2.ComboBox { target: serverListModel function onServerCheckComplete(url, valid) { if (url == serverUrlField.text && valid) { - serverUrlField.isValidServer = true + serverUrlField.isValidServer = true; } } } @@ -148,14 +148,13 @@ QQC2.ComboBox { text: i18nc("@action:button", "Ok") enabled: serverUrlField.acceptableInput && serverUrlField.isValidServer onClicked: { - serverListModel.addServer(serverUrlField.text) - root.currentIndex = root.indexOfValue(serverUrlField.text) - root.server = root.currentValue - serverUrlField.text = "" + serverListModel.addServer(serverUrlField.text); + root.currentIndex = root.indexOfValue(serverUrlField.text); + root.server = root.currentValue; + serverUrlField.text = ""; addServerSheet.close(); } } } } - } diff --git a/src/qml/SettingsPage.qml b/src/qml/SettingsPage.qml index 650f69f8d..3871c1b9a 100644 --- a/src/qml/SettingsPage.qml +++ b/src/qml/SettingsPage.qml @@ -35,7 +35,7 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { connection: root.connection - } + }; } }, KirigamiSettings.SettingAction { @@ -46,7 +46,7 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { connection: root.connection - } + }; } }, KirigamiSettings.SettingAction { @@ -63,10 +63,9 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { connection: root.connection - } + }; } }, - KirigamiSettings.SettingAction { actionName: "spellChecking" text: i18n("Spell Checking") @@ -88,7 +87,7 @@ KirigamiSettings.CategorizedSettings { initialProperties: { return { connection: root.connection - } + }; } }, KirigamiSettings.SettingAction { diff --git a/src/qml/ShareAction.qml b/src/qml/ShareAction.qml index 72dc29e53..c5d77eec2 100644 --- a/src/qml/ShareAction.qml +++ b/src/qml/ShareAction.qml @@ -42,7 +42,7 @@ Kirigami.Action { Purpose.PurposeAlternativesModel { pluginType: "Export" }', root._instantiator); - purposeModel.inputData = Qt.binding(function() { + purposeModel.inputData = Qt.binding(function () { return root.inputData; }); _instantiator.model = purposeModel; @@ -59,12 +59,12 @@ Purpose.PurposeAlternativesModel { title: root.tooltip, index: index, model: root._instantiator.model - }) + }); } } onObjectAdded: (index, object) => { object.index = index; - root.children.push(object) + root.children.push(object); } onObjectRemoved: (index, object) => root.children = Array.from(root.children).filter(obj => obj.pluginId !== object.pluginId) } diff --git a/src/qml/ShareDialog.qml b/src/qml/ShareDialog.qml index b8991386e..e08986911 100644 --- a/src/qml/ShareDialog.qml +++ b/src/qml/ShareDialog.qml @@ -54,15 +54,14 @@ Kirigami.Page { sharingSuccess.sendEvent(); Clipboard.saveText(jobView.output.url); } - root.closeDialog() + root.closeDialog(); } else if (state === Purpose.PurposeJobController.Error) { // Show failure notification sharingFailed.sendEvent(); - - root.closeDialog() + root.closeDialog(); } else if (state === Purpose.PurposeJobController.Cancelled) { // Do nothing - root.closeDialog() + root.closeDialog(); } } } diff --git a/src/qml/SonnetConfigPage.qml b/src/qml/SonnetConfigPage.qml index 87684b5f0..f1c5e7f64 100644 --- a/src/qml/SonnetConfigPage.qml +++ b/src/qml/SonnetConfigPage.qml @@ -31,7 +31,10 @@ Kirigami.ScrollablePage { } } - FormCard.FormDelegateSeparator { below: enable; above: skipUppercase } + FormCard.FormDelegateSeparator { + below: enable + above: skipUppercase + } FormCard.FormCheckDelegate { id: skipUppercase @@ -43,7 +46,10 @@ Kirigami.ScrollablePage { } } - FormCard.FormDelegateSeparator { below: skipUppercase; above: skipRunTogether } + FormCard.FormDelegateSeparator { + below: skipUppercase + above: skipRunTogether + } FormCard.FormCheckDelegate { id: skipRunTogether @@ -55,7 +61,10 @@ Kirigami.ScrollablePage { } } - FormCard.FormDelegateSeparator { below: skipRunTogether; above: autodetectLanguageCheckbox } + FormCard.FormDelegateSeparator { + below: skipRunTogether + above: autodetectLanguageCheckbox + } FormCard.FormCheckDelegate { id: autodetectLanguageCheckbox @@ -67,12 +76,19 @@ Kirigami.ScrollablePage { } } - FormCard.FormDelegateSeparator { below: autodetectLanguageCheckbox; above: selectedDefaultLanguage } + FormCard.FormDelegateSeparator { + below: autodetectLanguageCheckbox + above: selectedDefaultLanguage + } FormCard.FormComboBoxDelegate { id: selectedDefaultLanguage text: i18n("Selected default language:") - model: isEmpty ? [{"display": i18n("None")}] : settings.dictionaryModel + model: isEmpty ? [ + { + "display": i18n("None") + } + ] : settings.dictionaryModel textRole: "display" displayMode: Kirigami.Settings.isMobile ? FormCard.FormComboBoxDelegate.Dialog : FormCard.FormComboBoxDelegate.Page valueRole: "languageCode" @@ -84,10 +100,13 @@ Kirigami.ScrollablePage { currentIndex = indexOfValue(settings.defaultLanguage); } } - onActivated: settings.defaultLanguage = currentValue; + onActivated: settings.defaultLanguage = currentValue } - FormCard.FormDelegateSeparator { below: selectedDefaultLanguage; above: spellCheckingLanguage } + FormCard.FormDelegateSeparator { + below: selectedDefaultLanguage + above: spellCheckingLanguage + } FormCard.FormButtonDelegate { id: spellCheckingLanguage @@ -96,18 +115,21 @@ Kirigami.ScrollablePage { enabled: autodetectLanguageCheckbox.checked onClicked: pageStack.pushDialogLayer(spellCheckingLanguageList, {}, { width: pageStack.width - Kirigami.Units.gridUnit * 5, - height: pageStack.height - Kirigami.Units.gridUnit * 5, + height: pageStack.height - Kirigami.Units.gridUnit * 5 }) } - FormCard.FormDelegateSeparator { below: spellCheckingLanguageList; above: personalDictionary } + FormCard.FormDelegateSeparator { + below: spellCheckingLanguageList + above: personalDictionary + } FormCard.FormButtonDelegate { id: personalDictionary text: i18n("Open Personal Dictionary") onClicked: pageStack.pushDialogLayer(dictionaryPage, {}, { width: pageStack.width - Kirigami.Units.gridUnit * 5, - height: pageStack.height - Kirigami.Units.gridUnit * 5, + height: pageStack.height - Kirigami.Units.gridUnit * 5 }) } @@ -126,8 +148,8 @@ Kirigami.ScrollablePage { width: scroll.width contentItem: RowLayout { QQC2.Label { - Layout.fillWidth: true id: label + Layout.fillWidth: true text: model.display } Kirigami.Icon { diff --git a/src/qml/SpaceDrawer.qml b/src/qml/SpaceDrawer.qml index 8f044db57..bfa084280 100644 --- a/src/qml/SpaceDrawer.qml +++ b/src/qml/SpaceDrawer.qml @@ -25,8 +25,8 @@ QQC2.Control { property bool showDirectChats: false - signal selectionChanged() - signal spacesUpdated() + signal selectionChanged + signal spacesUpdated contentItem: Loader { id: sidebarColumn @@ -67,9 +67,11 @@ QQC2.Control { source: "notifications" } - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/NotificationsView.qml", {connection: root.connection}, { + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/NotificationsView.qml", { + connection: root.connection + }, { title: i18nc("@title", "Notifications") - }); + }) } Kirigami.Separator { @@ -93,9 +95,9 @@ QQC2.Control { checked: root.selectedSpaceId === "" && root.showDirectChats === false onClicked: { - root.showDirectChats = false - root.selectedSpaceId = "" - root.selectionChanged() + root.showDirectChats = false; + root.selectedSpaceId = ""; + root.selectionChanged(); } } AvatarTabButton { @@ -113,9 +115,9 @@ QQC2.Control { checked: root.showDirectChats === true onClicked: { - root.showDirectChats = true - root.selectedSpaceId = "" - root.selectionChanged() + root.showDirectChats = true; + root.selectedSpaceId = ""; + root.selectionChanged(); } QQC2.Label { @@ -154,7 +156,7 @@ QQC2.Control { } onCountChanged: { if (!root.connection.room(root.selectedSpaceId)) { - root.selectedSpaceId = "" + root.selectedSpaceId = ""; } } @@ -174,12 +176,12 @@ QQC2.Control { source: avatar ? ("image://mxc/" + avatar) : "" onSelected: { - root.showDirectChats = false + root.showDirectChats = false; if (!SpaceHierarchyCache.isSpaceChild(roomId, RoomManager.currentRoom.id) || root.selectedSpaceId == roomId) { - RoomManager.resolveResource(currentRoom.id) + RoomManager.resolveResource(currentRoom.id); } - root.selectedSpaceId = roomId - root.selectionChanged() + root.selectedSpaceId = roomId; + root.selectionChanged(); } checked: root.selectedSpaceId === roomId onContextMenuRequested: root.createContextMenu(currentRoom) @@ -203,8 +205,13 @@ QQC2.Control { contentItem: Kirigami.Icon { source: "list-add" } - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", {connection: root.connection, isSpace: true, title: i18nc("@title", "Create a Space")}, {title: i18nc("@title", "Create a Space")}) - + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { + connection: root.connection, + isSpace: true, + title: i18nc("@title", "Create a Space") + }, { + title: i18nc("@title", "Create a Space") + }) } } } @@ -216,7 +223,7 @@ QQC2.Control { room: room, connection: root.connection }); - context.open() + context.open(); } Component { id: spaceListContextMenu diff --git a/src/qml/SpaceHierarchyDelegate.qml b/src/qml/SpaceHierarchyDelegate.qml index 32f756024..6bd9385b2 100644 --- a/src/qml/SpaceHierarchyDelegate.qml +++ b/src/qml/SpaceHierarchyDelegate.qml @@ -33,7 +33,7 @@ Item { required property bool canRemove required property NeoChatRoom parentRoom - signal createRoom() + signal createRoom Delegates.RoundedItemDelegate { anchors.centerIn: root @@ -143,9 +143,9 @@ Item { TapHandler { onTapped: { if (root.isSpace) { - root.treeView.toggleExpanded(row) + root.treeView.toggleExpanded(row); } else { - RoomManager.resolveResource(root.roomId, root.isJoined ? "" : "join") + RoomManager.resolveResource(root.roomId, root.isJoined ? "" : "join"); } } } diff --git a/src/qml/SpaceHomePage.qml b/src/qml/SpaceHomePage.qml index 346e81099..7cb83deda 100644 --- a/src/qml/SpaceHomePage.qml +++ b/src/qml/SpaceHomePage.qml @@ -46,7 +46,11 @@ Kirigami.Page { visible: root.currentRoom.canSendState("invite") text: i18nc("@button", "Invite user to space") icon.name: "list-add-user" - onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", {room: root.currentRoom}, {title: i18nc("@title", "Invite a User")}) + onClicked: applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/InviteUserPage.qml", { + room: root.currentRoom + }, { + title: i18nc("@title", "Invite a User") + }) } QQC2.Button { visible: root.currentRoom.canSendState("m.space.child") @@ -66,7 +70,12 @@ Kirigami.Page { text: i18nc("@button", "Space settings") icon.name: "settings-configure" display: QQC2.AbstractButton.IconOnly - onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: root.currentRoom, connection: root.currentRoom.connection}, { title: i18n("Room Settings") }) + onClicked: applicationWindow().pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: root.currentRoom, + connection: root.currentRoom.connection + }, { + title: i18n("Room Settings") + }) QQC2.ToolTip.text: text QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay @@ -103,7 +112,9 @@ Kirigami.Page { TreeView { id: spaceTree - columnWidthProvider: function (column) { return spaceTree.width } + columnWidthProvider: function (column) { + return spaceTree.width; + } clip: true @@ -150,21 +161,23 @@ Kirigami.Page { let dialog = applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/CreateRoomDialog.qml", { title: i18nc("@title", "Create a Child"), connection: root.currentRoom.connection, - parentId : parentId, + parentId: parentId, showChildType: true, showCreateChoice: true }, { title: i18nc("@title", "Create a Child") - }) + }); dialog.addChild.connect((childId, setChildParent, canonical) => { // We have to get a room object from the connection as we may not // be adding to the top level parent. - let parent = root.currentRoom.connection.room(parentId) + let parent = root.currentRoom.connection.room(parentId); if (parent) { - parent.addChild(childId, setChildParent, canonical) + parent.addChild(childId, setChildParent, canonical); } - }) - dialog.newChild.connect(childName => {spaceChildrenModel.addPendingChild(childName)}) + }); + dialog.newChild.connect(childName => { + spaceChildrenModel.addPendingChild(childName); + }); } } } diff --git a/src/qml/SpaceListContextMenu.qml b/src/qml/SpaceListContextMenu.qml index c08dc561c..f7f535428 100644 --- a/src/qml/SpaceListContextMenu.qml +++ b/src/qml/SpaceListContextMenu.qml @@ -21,7 +21,7 @@ Loader { property NeoChatRoom room required property NeoChatConnection connection - signal closed() + signal closed Component { id: regularMenu @@ -29,23 +29,28 @@ Loader { QQC2.MenuItem { text: i18nc("'Space' is a matrix space", "View Space") icon.name: "view-list-details" - onTriggered: RoomManager.resolveResource(room.id); + onTriggered: RoomManager.resolveResource(room.id) } QQC2.MenuItem { text: i18nc("@action:inmenu", "Copy Address to Clipboard") icon.name: "edit-copy" onTriggered: if (room.canonicalAlias.length === 0) { - Clipboard.saveText(room.id) + Clipboard.saveText(room.id); } else { - Clipboard.saveText(room.canonicalAlias) + Clipboard.saveText(room.canonicalAlias); } } QQC2.MenuItem { text: i18nc("'Space' is a matrix space", "Space Settings") icon.name: 'settings-configure' - onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") }) + onTriggered: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: room, + connection: connection + }, { + title: i18n("Space Settings") + }) } QQC2.MenuSeparator {} @@ -57,8 +62,8 @@ Loader { } onClosed: { - root.closed() - regularMenu.destroy() + root.closed(); + regularMenu.destroy(); } } } @@ -109,7 +114,7 @@ Loader { FormCard.FormButtonDelegate { text: i18nc("'Space' is a matrix space", "View Space") icon.name: "view-list-details" - onClicked: RoomManager.resolveResource(root.room.id); + onClicked: RoomManager.resolveResource(root.room.id) } FormCard.FormButtonDelegate { @@ -125,7 +130,12 @@ Loader { FormCard.FormButtonDelegate { text: i18nc("'Space' is a matrix space", "Space Settings") icon.name: 'settings-configure' - onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', {room: room, connection: connection}, { title: i18n("Space Settings") }) + onClicked: QQC2.ApplicationWindow.window.pageStack.pushDialogLayer('qrc:/org/kde/neochat/qml/Categories.qml', { + room: room, + connection: connection + }, { + title: i18n("Space Settings") + }) } FormCard.FormButtonDelegate { diff --git a/src/qml/Sso.qml b/src/qml/Sso.qml index f972949fc..68b56ad42 100644 --- a/src/qml/Sso.qml +++ b/src/qml/Sso.qml @@ -19,10 +19,10 @@ LoginStep { Connections { target: LoginHelper function onSsoUrlChanged() { - UrlHelper.openUrl(LoginHelper.ssoUrl) + UrlHelper.openUrl(LoginHelper.ssoUrl); } function onConnected() { - processed("qrc:/org/kde/neochat/qml/Loading.qml") + processed("qrc:/org/kde/neochat/qml/Loading.qml"); } } @@ -39,4 +39,3 @@ LoginStep { onTriggered: UrlHelper.openUrl(LoginHelper.ssoUrl) } } - diff --git a/src/qml/StateDelegate.qml b/src/qml/StateDelegate.qml index c9683b236..4d7e37df4 100644 --- a/src/qml/StateDelegate.qml +++ b/src/qml/StateDelegate.qml @@ -199,7 +199,7 @@ TimelineDelegate { } function toggleFolded() { - folded = !folded - foldedChanged() + folded = !folded; + foldedChanged(); } } diff --git a/src/qml/Terms.qml b/src/qml/Terms.qml index 6bae206b9..488ca70b0 100644 --- a/src/qml/Terms.qml +++ b/src/qml/Terms.qml @@ -29,7 +29,7 @@ LoginStep { nextAction: Kirigami.Action { onTriggered: { - Registration.registerAccount() + Registration.registerAccount(); } } previousAction: Kirigami.Action { diff --git a/src/qml/ThemeRadioButton.qml b/src/qml/ThemeRadioButton.qml index 9956b140c..5d22a1671 100644 --- a/src/qml/ThemeRadioButton.qml +++ b/src/qml/ThemeRadioButton.qml @@ -35,10 +35,7 @@ QQC2.RadioButton { return Kirigami.Theme.highlightColor; } else if (root.hovered) { // Match appearance of hovered list items - return Qt.rgba(Kirigami.Theme.highlightColor.r, - Kirigami.Theme.highlightColor.g, - Kirigami.Theme.highlightColor.b, - 0.5); + return Qt.rgba(Kirigami.Theme.highlightColor.r, Kirigami.Theme.highlightColor.g, Kirigami.Theme.highlightColor.b, 0.5); } else { return Kirigami.Theme.backgroundColor; } @@ -62,5 +59,3 @@ QQC2.RadioButton { indicator: Item {} background: Item {} } - - diff --git a/src/qml/TimelineDelegate.qml b/src/qml/TimelineDelegate.qml index fcc1c05f5..bb99eef24 100644 --- a/src/qml/TimelineDelegate.qml +++ b/src/qml/TimelineDelegate.qml @@ -97,7 +97,6 @@ Item { if (!contentItem) { return; } - contentItem.parent = contentItemParent; contentItem.anchors.fill = contentItem.parent; } diff --git a/src/qml/TimelineEndDelegate.qml b/src/qml/TimelineEndDelegate.qml index 82e98873f..89ee07b9e 100644 --- a/src/qml/TimelineEndDelegate.qml +++ b/src/qml/TimelineEndDelegate.qml @@ -30,7 +30,7 @@ TimelineDelegate { Layout.preferredHeight: Kirigami.Units.iconSizes.large name: root.room ? root.room.displayName : "" - source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : "" + source: root.room && root.room.avatarMediaId ? ("image://mxc/" + root.room.avatarMediaId) : "" Rectangle { visible: room.usesEncryption @@ -53,7 +53,6 @@ TimelineDelegate { } } - ColumnLayout { Layout.fillWidth: true Layout.alignment: Qt.AlignVCenter diff --git a/src/qml/TimelineView.qml b/src/qml/TimelineView.qml index 3b9087d61..4ca75083e 100644 --- a/src/qml/TimelineView.qml +++ b/src/qml/TimelineView.qml @@ -19,7 +19,7 @@ QQC2.ScrollView { required property NeoChatRoom currentRoom onCurrentRoomChanged: { roomChanging = true; - roomChangingTimer.restart() + roomChangingTimer.restart(); applicationWindow().hoverLinkIndicator.text = ""; messageListView.positionViewAtBeginning(); hasScrolledUpBefore = false; @@ -54,9 +54,9 @@ QQC2.ScrollView { property alias interactive: messageListView.interactive /// Used to determine if scrolling to the bottom should mark the message as unread - property bool hasScrolledUpBefore: false; + property bool hasScrolledUpBefore: false - signal focusChatBar() + signal focusChatBar QQC2.ScrollBar.vertical.interactive: false @@ -100,8 +100,8 @@ QQC2.ScrollView { id: roomChangingTimer interval: 1000 onTriggered: { - root.roomChanging = false - markReadIfVisibleTimer.reset() + root.roomChanging = false; + markReadIfVisibleTimer.reset(); } } onAtYEndChanged: if (!root.roomChanging) { @@ -169,7 +169,7 @@ QQC2.ScrollView { if (!Kirigami.Settings.isMobile) { root.focusChatBar(); } - messageListView.goToEvent(root.currentRoom.readMarkerEventId) + messageListView.goToEvent(root.currentRoom.readMarkerEventId); } icon.name: "go-up" shortcut: "Shift+PgUp" @@ -231,12 +231,7 @@ QQC2.ScrollView { TypingPane { id: typingPane visible: root.currentRoom && root.currentRoom.usersTyping.length > 0 - labelText: visible ? i18ncp( - "Message displayed when some users are typing", "%2 is typing", "%2 are typing", - root.currentRoom.usersTyping.length, - root.currentRoom.usersTyping.map(user => user.displayName).join(", ") - ) : - "" + labelText: visible ? i18ncp("Message displayed when some users are typing", "%2 is typing", "%2 are typing", root.currentRoom.usersTyping.length, root.currentRoom.usersTyping.map(user => user.displayName).join(", ")) : "" anchors.left: parent.left anchors.bottom: parent.bottom height: visible ? implicitHeight : 0 @@ -251,9 +246,9 @@ QQC2.ScrollView { } function goToEvent(eventID) { - const index = eventToIndex(eventID) - messageListView.positionViewAtIndex(index, ListView.Center) - itemAtIndex(index).isTemporaryHighlighted = true + const index = eventToIndex(eventID); + messageListView.positionViewAtIndex(index, ListView.Center); + itemAtIndex(index).isTemporaryHighlighted = true; } HoverActions { @@ -272,7 +267,7 @@ QQC2.ScrollView { target: root.timelineModel function onRowsInserted() { - markReadIfVisibleTimer.reset() + markReadIfVisibleTimer.reset(); } } @@ -283,8 +278,10 @@ QQC2.ScrollView { onTriggered: root.currentRoom.markAllMessagesAsRead() function reset() { - restart() - running = Qt.binding(function() { return messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded) }) + restart(); + running = Qt.binding(function () { + return messageListView.allUnreadVisible() && applicationWindow().active && (root.currentRoom.timelineSize > 0 || root.currentRoom.allHistoryLoaded); + }); } } @@ -298,13 +295,13 @@ QQC2.ScrollView { function processFancyEffectsReason(fancyEffect) { if (fancyEffect === "snowflake") { - fancyEffectsContainer.showSnowEffect() + fancyEffectsContainer.showSnowEffect(); } if (fancyEffect === "fireworks") { - fancyEffectsContainer.showFireworksEffect() + fancyEffectsContainer.showFireworksEffect(); } if (fancyEffect === "confetti") { - fancyEffectsContainer.showConfettiEffect() + fancyEffectsContainer.showConfettiEffect(); } } @@ -313,7 +310,7 @@ QQC2.ScrollView { target: root.timelineModel.messageEventModel function onFancyEffectsReasonFound(fancyEffect) { - fancyEffectsContainer.processFancyEffectsReason(fancyEffect) + fancyEffectsContainer.processFancyEffectsReason(fancyEffect); } } @@ -322,62 +319,62 @@ QQC2.ScrollView { target: actionsHandler function onShowEffect(fancyEffect) { - fancyEffectsContainer.processFancyEffectsReason(fancyEffect) + fancyEffectsContainer.processFancyEffectsReason(fancyEffect); } } } } function goToLastMessage() { - root.currentRoom.markAllMessagesAsRead() + root.currentRoom.markAllMessagesAsRead(); // scroll to the very end, i.e to messageListView.YEnd - messageListView.positionViewAtIndex(0, ListView.End) + messageListView.positionViewAtIndex(0, ListView.End); } function eventToIndex(eventID) { - const index = root.timelineModel.messageEventModel.eventIdToRow(eventID) + const index = root.timelineModel.messageEventModel.eventIdToRow(eventID); if (index === -1) - return -1 - return root.messageFilterModel.mapFromSource(root.timelineModel.index(index, 0)).row + return -1; + return root.messageFilterModel.mapFromSource(root.timelineModel.index(index, 0)).row; } function firstVisibleIndex() { let center = messageListView.x + messageListView.width / 2; - let index = -1 - let i = 0 + let index = -1; + let i = 0; while (index === -1 && i < 100) { index = messageListView.indexAt(center, messageListView.y + messageListView.contentY + i); i++; } - return index + return index; } function lastVisibleIndex() { let center = messageListView.x + messageListView.width / 2; - let index = -1 - let i = 0 + let index = -1; + let i = 0; while (index === -1 && i < 100) { index = messageListView.indexAt(center, messageListView.y + messageListView.contentY + messageListView.height - i); - i++ + i++; } return index; } function allUnreadVisible() { - let readMarkerRow = eventToIndex(root.currentRoom.readMarkerEventId) + let readMarkerRow = eventToIndex(root.currentRoom.readMarkerEventId); if (readMarkerRow >= 0 && readMarkerRow < firstVisibleIndex() && messageListView.atYEnd) { - return true + return true; } - return false + return false; } function setHoverActionsToDelegate(delegate) { - hoverActions.delegate = delegate + hoverActions.delegate = delegate; } } function goToLastMessage() { - messageListView.goToLastMessage() + messageListView.goToLastMessage(); } function pageUp() { @@ -395,6 +392,6 @@ QQC2.ScrollView { } function positionViewAtBeginning() { - messageListView.positionViewAtBeginning() + messageListView.positionViewAtBeginning(); } } diff --git a/src/qml/TypingPane.qml b/src/qml/TypingPane.qml index a1e85251a..e94bec3f3 100644 --- a/src/qml/TypingPane.qml +++ b/src/qml/TypingPane.qml @@ -42,7 +42,7 @@ Loader { delegate: Rectangle { id: dot color: Kirigami.Theme.textColor - radius: height/2 + radius: height / 2 implicitWidth: fontMetrics.xHeight implicitHeight: fontMetrics.xHeight // rotating 45 degrees makes the dots look a bit smoother when scaled up @@ -54,36 +54,48 @@ Loader { // Not everyone can see this, but I'm pretty sure it's there. SequentialAnimation { running: true - PauseAnimation { duration: dotRow.duration * index / 2 } + PauseAnimation { + duration: dotRow.duration * index / 2 + } SequentialAnimation { loops: Animation.Infinite ParallelAnimation { // Animators unfortunately sync up instead of being // staggered, so I'm using NumberAnimations instead. NumberAnimation { - target: dot; property: "scale"; - from: 1; to: 1.33 + target: dot + property: "scale" + from: 1 + to: 1.33 duration: dotRow.duration } NumberAnimation { - target: dot; property: "opacity" - from: 0.5; to: 1 + target: dot + property: "opacity" + from: 0.5 + to: 1 duration: dotRow.duration } } ParallelAnimation { NumberAnimation { - target: dot; property: "scale" - from: 1.33; to: 1 + target: dot + property: "scale" + from: 1.33 + to: 1 duration: dotRow.duration } NumberAnimation { - target: dot; property: "opacity" - from: 1; to: 0.5 + target: dot + property: "opacity" + from: 1 + to: 0.5 duration: dotRow.duration } } - PauseAnimation { duration: dotRow.duration } + PauseAnimation { + duration: dotRow.duration + } } } } diff --git a/src/qml/UserDetailDialog.qml b/src/qml/UserDetailDialog.qml index c7a14652c..34b3f56e5 100644 --- a/src/qml/UserDetailDialog.qml +++ b/src/qml/UserDetailDialog.qml @@ -85,10 +85,10 @@ Kirigami.Dialog { title: root.user.displayName, subtitle: root.user.id, avatarColor: root.user.color, - avatarSource: root.user.avatarSource, + avatarSource: root.user.avatarSource }); - root.close() - map.open() + root.close(); + map.open(); } QQC2.ToolTip.visible: hovered @@ -107,8 +107,8 @@ Kirigami.Dialog { text: room.connection.isIgnored(root.user.object) ? i18n("Unignore this user") : i18n("Ignore this user") icon.name: "im-invisible-user" onTriggered: { - root.close() - room.connection.isIgnored(root.user.object) ? room.connection.removeFromIgnoredUsers(root.user.object) : room.connection.addToIgnoredUsers(root.user.object) + root.close(); + room.connection.isIgnored(root.user.object) ? room.connection.removeFromIgnoredUsers(root.user.object) : room.connection.addToIgnoredUsers(root.user.object); } } } @@ -120,8 +120,8 @@ Kirigami.Dialog { text: i18n("Kick this user") icon.name: "im-kick-user" onTriggered: { - room.kickMember(root.user.id) - root.close() + room.kickMember(root.user.id); + root.close(); } } } @@ -134,8 +134,8 @@ Kirigami.Dialog { text: i18n("Invite this user") icon.name: "list-add-user" onTriggered: { - room.inviteToRoom(root.user.id) - root.close() + room.inviteToRoom(root.user.id); + root.close(); } } } @@ -148,11 +148,14 @@ Kirigami.Dialog { icon.name: "im-ban-user" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/BanSheet.qml", {room: root.room, userId: root.user.id}, { + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/BanSheet.qml", { + room: root.room, + userId: root.user.id + }, { title: i18nc("@title", "Ban User"), width: Kirigami.Units.gridUnit * 25 - }) - root.close() + }); + root.close(); } } } @@ -165,8 +168,8 @@ Kirigami.Dialog { icon.name: "im-irc" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - room.unban(root.user.id) - root.close() + room.unban(root.user.id); + root.close(); } } } @@ -182,8 +185,8 @@ Kirigami.Dialog { userId: root.user.id, powerLevel: root.room.getUserPowerLevel(root.user.id) }); - dialog.open() - root.close() + dialog.open(); + root.close(); } } @@ -203,11 +206,14 @@ Kirigami.Dialog { icon.name: "delete" icon.color: Kirigami.Theme.negativeTextColor onTriggered: { - applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", {room: root.room, userId: root.user.id}, { + applicationWindow().pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/RemoveSheet.qml", { + room: root.room, + userId: root.user.id + }, { title: i18nc("@title", "Remove Messages"), width: Kirigami.Units.gridUnit * 25 - }) - root.close() + }); + root.close(); } } } @@ -218,8 +224,8 @@ Kirigami.Dialog { text: root.room.connection.directChatExists(root.user.object) ? i18nc("%1 is the name of the user.", "Chat with %1", root.user.displayName) : i18n("Invite to private chat") icon.name: "document-send" onTriggered: { - root.room.connection.openOrCreateDirectChat(root.user.object) - root.close() + root.room.connection.openOrCreateDirectChat(root.user.object); + root.close(); } } } @@ -229,7 +235,7 @@ Kirigami.Dialog { text: i18n("Copy link") icon.name: "username-copy" onTriggered: { - Clipboard.saveText("https://matrix.to/#/" + root.user.id) + Clipboard.saveText("https://matrix.to/#/" + root.user.id); } } } @@ -239,4 +245,3 @@ Kirigami.Dialog { QrCodeMaximizeComponent {} } } - diff --git a/src/qml/UserInfo.qml b/src/qml/UserInfo.qml index 758720ee0..b3d2cb8f7 100644 --- a/src/qml/UserInfo.qml +++ b/src/qml/UserInfo.qml @@ -120,7 +120,11 @@ RowLayout { } QQC2.ToolButton { icon.name: "settings-configure" - onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") }) + onClicked: pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + connection: root.connection + }, { + title: i18n("Configure") + }) text: i18n("Open Settings") display: QQC2.AbstractButton.IconOnly Layout.minimumWidth: Layout.preferredWidth @@ -143,10 +147,11 @@ RowLayout { parent: root visible: switchUserButton.checked - onVisibleChanged: if (visible) accounts.forceActiveFocus() + onVisibleChanged: if (visible) + accounts.forceActiveFocus() x: -Kirigami.Units.smallSpacing - y: root.bottomEdge ? -height - Kirigami.Units.smallSpacing - 1 : root.height + Kirigami.Units.smallSpacing - 1 + y: root.bottomEdge ? -height - Kirigami.Units.smallSpacing - 1 : root.height + Kirigami.Units.smallSpacing - 1 width: root.width + (root.bottomEdge ? 0 : Kirigami.Units.smallSpacing * 2) leftPadding: 0 rightPadding: 0 @@ -181,20 +186,20 @@ RowLayout { onClicked: { pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/WelcomePage.qml", {}, { - title: i18nc("@title:window", "Login"), + title: i18nc("@title:window", "Login") }); if (switchUserButton.checked) { - switchUserButton.checked = false + switchUserButton.checked = false; } - accounts.currentIndex = Controller.activeConnectionIndex + accounts.currentIndex = Controller.activeConnectionIndex; } Keys.onUpPressed: { - accounts.currentIndex = accounts.count - 1 - accounts.forceActiveFocus() + accounts.currentIndex = accounts.count - 1; + accounts.forceActiveFocus(); } Keys.onDownPressed: { - accounts.currentIndex = 0 - accounts.forceActiveFocus() + accounts.currentIndex = 0; + accounts.forceActiveFocus(); } } clip: true @@ -203,24 +208,24 @@ RowLayout { keyNavigationEnabled: false Keys.onDownPressed: { if (accounts.currentIndex === accounts.count - 1) { - addAccount.forceActiveFocus() - accounts.currentIndex = -1 + addAccount.forceActiveFocus(); + accounts.currentIndex = -1; } else { - accounts.incrementCurrentIndex() + accounts.incrementCurrentIndex(); } } Keys.onUpPressed: { if (accounts.currentIndex === 0) { - addAccount.forceActiveFocus() - accounts.currentIndex = -1 + addAccount.forceActiveFocus(); + accounts.currentIndex = -1; } else { - accounts.decrementCurrentIndex() + accounts.decrementCurrentIndex(); } } Keys.onReleased: if (event.key == Qt.Key_Escape) { if (switchUserButton.checked) { - switchUserButton.checked = false + switchUserButton.checked = false; } } @@ -262,9 +267,9 @@ RowLayout { } onClicked: { - Controller.activeConnection = userDelegate.connection + Controller.activeConnection = userDelegate.connection; if (switchUserButton.checked) { - switchUserButton.checked = false + switchUserButton.checked = false; } } } diff --git a/src/qml/UserSearchPage.qml b/src/qml/UserSearchPage.qml index 19246d2d6..7a3c7069b 100644 --- a/src/qml/UserSearchPage.qml +++ b/src/qml/UserSearchPage.qml @@ -57,8 +57,8 @@ SearchPage { text: displayName onClicked: { - root.connection.openOrCreateDirectChat(userDelegate.userId) - root.closeDialog() + root.connection.openOrCreateDirectChat(userDelegate.userId); + root.closeDialog(); } contentItem: RowLayout { @@ -98,8 +98,12 @@ SearchPage { QtObject { id: _private function openManualUserDialog() { - let dialog = manualUserDialog.createObject(applicationWindow().overlay, {connection: root.connection}); - dialog.accepted.connect(() => {root.closeDialog();}); + let dialog = manualUserDialog.createObject(applicationWindow().overlay, { + connection: root.connection + }); + dialog.accepted.connect(() => { + root.closeDialog(); + }); dialog.open(); } } diff --git a/src/qml/Username.qml b/src/qml/Username.qml index a65e79e69..6904113e9 100644 --- a/src/qml/Username.qml +++ b/src/qml/Username.qml @@ -11,7 +11,9 @@ import org.kde.neochat LoginStep { id: root - onActiveFocusChanged: if (activeFocus) usernameField.forceActiveFocus() + onActiveFocusChanged: if (activeFocus) { + usernameField.forceActiveFocus(); + } FormCard.FormTextFieldDelegate { id: usernameField @@ -21,7 +23,7 @@ LoginStep { statusMessage: Registration.status === Registration.UsernameTaken ? i18n("Username unavailable") : "" Keys.onReturnPressed: { if (root.nextAction.enabled) { - root.nextAction.trigger() + root.nextAction.trigger(); } } } diff --git a/src/qml/VerificationCanceled.qml b/src/qml/VerificationCanceled.qml index 705e6e399..02f31ac23 100644 --- a/src/qml/VerificationCanceled.qml +++ b/src/qml/VerificationCanceled.qml @@ -16,55 +16,55 @@ Message { anchors.centerIn: parent icon: "security-low" text: { - switch(root.reason) { - case KeyVerificationSession.NONE: - return i18n("The session verification was canceled for unknown reason."); - case KeyVerificationSession.TIMEOUT: - return i18n("The session verification timed out."); - case KeyVerificationSession.REMOTE_TIMEOUT: - return i18n("The session verification timed out for remote party."); - case KeyVerificationSession.USER: - return i18n("You canceled the session verification."); - case KeyVerificationSession.REMOTE_USER: - return i18n("The remote party canceled the session verification."); - case KeyVerificationSession.UNEXPECTED_MESSAGE: - return i18n("The session verification was canceled because we received an unexpected message."); - case KeyVerificationSession.REMOTE_UNEXPECTED_MESSAGE: - return i18n("The remote party canceled the session verification because it received an unexpected message."); - case KeyVerificationSession.UNKNOWN_TRANSACTION: - return i18n("The session verification was canceled because it received a message for an unknown session."); - case KeyVerificationSession.REMOTE_UNKNOWN_TRANSACTION: - return i18n("The remote party canceled the session verification because it received a message for an unknown session."); - case KeyVerificationSession.UNKNOWN_METHOD: - return i18n("The session verification was canceled because NeoChat is unable to handle this verification method."); - case KeyVerificationSession.REMOTE_UNKNOWN_METHOD: - return i18n("The remote party canceled the session verification because it is unable to handle this verification method."); - case KeyVerificationSession.KEY_MISMATCH: - return i18n("The session verification was canceled because the keys are incorrect."); - case KeyVerificationSession.REMOTE_KEY_MISMATCH: - return i18n("The remote party canceled the session verification because the keys are incorrect.\n\n**Please log out and log back in, your session is broken/corrupt.**"); - case KeyVerificationSession.USER_MISMATCH: - return i18n("The session verification was canceled because it verifies an unexpected user."); - case KeyVerificationSession.REMOTE_USER_MISMATCH: - return i18n("The remote party canceled the session verification because it verifies an unexpected user."); - case KeyVerificationSession.INVALID_MESSAGE: - return i18n("The session verification was canceled because we received an invalid message."); - case KeyVerificationSession.REMOTE_INVALID_MESSAGE: - return i18n("The remote party canceled the session verification because it received an invalid message."); - case KeyVerificationSession.SESSION_ACCEPTED: - return i18n("The session was accepted on a different device"); //TODO this should not be visible - case KeyVerificationSession.REMOTE_SESSION_ACCEPTED: - return i18n("The session was accepted on a different device"); //TODO neither should this - case KeyVerificationSession.MISMATCHED_COMMITMENT: - return i18n("The session verification was canceled because of a mismatched key."); - case KeyVerificationSession.REMOTE_MISMATCHED_COMMITMENT: - return i18n("The remote party canceled the session verification because of a mismatched key."); - case KeyVerificationSession.MISMATCHED_SAS: - return i18n("The session verification was canceled because the keys do not match."); - case KeyVerificationSession.REMOTE_MISMATCHED_SAS: - return i18n("The remote party canceled the session verification because the keys do not match."); - default: - return i18n("The session verification was canceled due to an unknown error."); + switch (root.reason) { + case KeyVerificationSession.NONE: + return i18n("The session verification was canceled for unknown reason."); + case KeyVerificationSession.TIMEOUT: + return i18n("The session verification timed out."); + case KeyVerificationSession.REMOTE_TIMEOUT: + return i18n("The session verification timed out for remote party."); + case KeyVerificationSession.USER: + return i18n("You canceled the session verification."); + case KeyVerificationSession.REMOTE_USER: + return i18n("The remote party canceled the session verification."); + case KeyVerificationSession.UNEXPECTED_MESSAGE: + return i18n("The session verification was canceled because we received an unexpected message."); + case KeyVerificationSession.REMOTE_UNEXPECTED_MESSAGE: + return i18n("The remote party canceled the session verification because it received an unexpected message."); + case KeyVerificationSession.UNKNOWN_TRANSACTION: + return i18n("The session verification was canceled because it received a message for an unknown session."); + case KeyVerificationSession.REMOTE_UNKNOWN_TRANSACTION: + return i18n("The remote party canceled the session verification because it received a message for an unknown session."); + case KeyVerificationSession.UNKNOWN_METHOD: + return i18n("The session verification was canceled because NeoChat is unable to handle this verification method."); + case KeyVerificationSession.REMOTE_UNKNOWN_METHOD: + return i18n("The remote party canceled the session verification because it is unable to handle this verification method."); + case KeyVerificationSession.KEY_MISMATCH: + return i18n("The session verification was canceled because the keys are incorrect."); + case KeyVerificationSession.REMOTE_KEY_MISMATCH: + return i18n("The remote party canceled the session verification because the keys are incorrect.\n\n**Please log out and log back in, your session is broken/corrupt.**"); + case KeyVerificationSession.USER_MISMATCH: + return i18n("The session verification was canceled because it verifies an unexpected user."); + case KeyVerificationSession.REMOTE_USER_MISMATCH: + return i18n("The remote party canceled the session verification because it verifies an unexpected user."); + case KeyVerificationSession.INVALID_MESSAGE: + return i18n("The session verification was canceled because we received an invalid message."); + case KeyVerificationSession.REMOTE_INVALID_MESSAGE: + return i18n("The remote party canceled the session verification because it received an invalid message."); + case KeyVerificationSession.SESSION_ACCEPTED: + return i18n("The session was accepted on a different device"); //TODO this should not be visible + case KeyVerificationSession.REMOTE_SESSION_ACCEPTED: + return i18n("The session was accepted on a different device"); //TODO neither should this + case KeyVerificationSession.MISMATCHED_COMMITMENT: + return i18n("The session verification was canceled because of a mismatched key."); + case KeyVerificationSession.REMOTE_MISMATCHED_COMMITMENT: + return i18n("The remote party canceled the session verification because of a mismatched key."); + case KeyVerificationSession.MISMATCHED_SAS: + return i18n("The session verification was canceled because the keys do not match."); + case KeyVerificationSession.REMOTE_MISMATCHED_SAS: + return i18n("The remote party canceled the session verification because the keys do not match."); + default: + return i18n("The session verification was canceled due to an unknown error."); } } } diff --git a/src/qml/VideoDelegate.qml b/src/qml/VideoDelegate.qml index 60893794f..4bcd409d0 100644 --- a/src/qml/VideoDelegate.qml +++ b/src/qml/VideoDelegate.qml @@ -59,12 +59,11 @@ MessageDelegate { onDownloadedChanged: { if (downloaded) { - vid.source = root.progressInfo.localPath + vid.source = root.progressInfo.localPath; } - if (downloaded && playOnFinished) { - playSavedFile() - playOnFinished = false + playSavedFile(); + playOnFinished = false; } } @@ -207,19 +206,19 @@ MessageDelegate { onClicked: { if (vid.volume > 0) { - vid.volume = 0 + vid.volume = 0; } else { if (unmuteVolume === 0) { - vid.volume = 1 + vid.volume = 1; } else { - vid.volume = unmuteVolume + vid.volume = unmuteVolume; } } } onHoveredChanged: { if (!hovered && (vid.state === "paused" || vid.state === "playing")) { - videoControlTimer.restart() - volumePopupTimer.restart() + videoControlTimer.restart(); + volumePopupTimer.restart(); } } @@ -243,13 +242,13 @@ MessageDelegate { to: 1 value: vid.volume onMoved: { - vid.volume = value - volumeButton.unmuteVolume = value + vid.volume = value; + volumeButton.unmuteVolume = value; } onHoveredChanged: { if (!hovered && (vid.state === "paused" || vid.state === "playing")) { - videoControlTimer.restart() - volumePopupTimer.restart() + videoControlTimer.restart(); + volumePopupTimer.restart(); } } } @@ -261,8 +260,8 @@ MessageDelegate { id: volumePopupHoverHandler onHoveredChanged: { if (!hovered && (vid.state === "paused" || vid.state === "playing")) { - videoControlTimer.restart() - volumePopupTimer.restart() + videoControlTimer.restart(); + volumePopupTimer.restart(); } } } @@ -290,13 +289,13 @@ MessageDelegate { text: i18n("Maximize") icon.name: "view-fullscreen" onTriggered: { - root.ListView.view.interactive = false - vid.pause() + root.ListView.view.interactive = false; + vid.pause(); // We need to make sure the index is that of the MediaMessageFilterModel. if (root.ListView.view.model instanceof MessageFilterModel) { - RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)) + RoomManager.maximizeMedia(RoomManager.mediaMessageFilterModel.getRowForSourceItem(root.index)); } else { - RoomManager.maximizeMedia(root.index) + RoomManager.maximizeMedia(root.index); } } } @@ -326,7 +325,7 @@ MessageDelegate { id: videoHoverHandler onHoveredChanged: { if (!hovered && (vid.state === "paused" || vid.state === "playing")) { - videoControlTimer.restart() + videoControlTimer.restart(); } } } @@ -336,12 +335,12 @@ MessageDelegate { gesturePolicy: TapHandler.ReleaseWithinBounds | TapHandler.WithinBounds onTapped: if (root.progressInfo.completed) { if (vid.playbackState == MediaPlayer.PlayingState) { - vid.pause() + vid.pause(); } else { - vid.play() + vid.play(); } } else { - root.downloadAndPlay() + root.downloadAndPlay(); } } @@ -355,15 +354,15 @@ MessageDelegate { function downloadAndPlay() { if (vid.downloaded) { - playSavedFile() + playSavedFile(); } else { - playOnFinished = true - root.room.downloadFile(root.eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)) + playOnFinished = true; + root.room.downloadFile(root.eventId, Platform.StandardPaths.writableLocation(Platform.StandardPaths.CacheLocation) + "/" + root.eventId.replace(":", "_").replace("/", "_").replace("+", "_") + root.room.fileNameToDownload(root.eventId)); } } function playSavedFile() { - vid.stop() - vid.play() + vid.stop(); + vid.play(); } } diff --git a/src/qml/WelcomePage.qml b/src/qml/WelcomePage.qml index 942a15aec..5e0e2e4dd 100644 --- a/src/qml/WelcomePage.qml +++ b/src/qml/WelcomePage.qml @@ -62,8 +62,8 @@ FormCard.FormCardPage { delegate: FormCard.FormButtonDelegate { text: model.userId onClicked: { - Controller.activeConnection = model.connection - root.connectionChosen() + Controller.activeConnection = model.connection; + root.connectionChosen(); } } } @@ -96,9 +96,9 @@ FormCard.FormCardPage { headerMessage.text = ""; headerMessage.visible = false; if (!module.item.noControls) { - module.item.forceActiveFocus() + module.item.forceActiveFocus(); } else { - continueButton.forceActiveFocus() + continueButton.forceActiveFocus(); } } @@ -122,16 +122,16 @@ FormCard.FormCardPage { target: Registration function onNextStepChanged() { if (Registration.nextStep === "m.login.recaptcha") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Captcha.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Captcha.qml"); } if (Registration.nextStep === "m.login.terms") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Terms.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Terms.qml"); } if (Registration.nextStep === "m.login.email.identity") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Email.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Email.qml"); } if (Registration.nextStep === "loading") { - stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Loading.qml") + stepConnections.onProcessed("qrc:/org/kde/neochat/qml/Loading.qml"); } } } @@ -168,10 +168,10 @@ FormCard.FormCardPage { } Component.onCompleted: { - LoginHelper.init() - module.item.forceActiveFocus() - Registration.username = "" - Registration.password = "" - Registration.email = "" + LoginHelper.init(); + module.item.forceActiveFocus(); + Registration.username = ""; + Registration.password = ""; + Registration.email = ""; } } diff --git a/src/qml/main.qml b/src/qml/main.qml index e3d8eb659..a2af797e7 100644 --- a/src/qml/main.qml +++ b/src/qml/main.qml @@ -36,7 +36,7 @@ Kirigami.ApplicationWindow { onConnectionChosen: { pageStack.replace(roomListComponent); roomListLoaded = true; - roomListPage = pageStack.currentItem + roomListPage = pageStack.currentItem; RoomManager.loadInitialRoom(); } } @@ -49,10 +49,10 @@ Kirigami.ApplicationWindow { } onConnectionChanged: { - CustomEmojiModel.connection = root.connection - MatrixImageProvider.connection = root.connection - RoomManager.connection = root.connection - SpaceHierarchyCache.connection = root.connection + CustomEmojiModel.connection = root.connection; + MatrixImageProvider.connection = root.connection; + RoomManager.connection = root.connection; + SpaceHierarchyCache.connection = root.connection; } Connections { @@ -60,7 +60,7 @@ Kirigami.ApplicationWindow { function onLoaded() { pageStack.replace(roomListComponent); roomListLoaded = true; - roomListPage = pageStack.currentItem + roomListPage = pageStack.currentItem; RoomManager.loadInitialRoom(); } } @@ -68,7 +68,7 @@ Kirigami.ApplicationWindow { Connections { target: root.quitAction function onTriggered() { - Qt.quit() + Qt.quit(); } } @@ -94,14 +94,23 @@ Kirigami.ApplicationWindow { enabled: false // Disable on startup to avoid writing wrong values if the window is hidden target: root - function onClosing() { WindowController.saveGeometry(); } - function onWidthChanged() { saveWindowGeometryTimer.restart(); } - function onHeightChanged() { saveWindowGeometryTimer.restart(); } - function onXChanged() { saveWindowGeometryTimer.restart(); } - function onYChanged() { saveWindowGeometryTimer.restart(); } + function onClosing() { + WindowController.saveGeometry(); + } + function onWidthChanged() { + saveWindowGeometryTimer.restart(); + } + function onHeightChanged() { + saveWindowGeometryTimer.restart(); + } + function onXChanged() { + saveWindowGeometryTimer.restart(); + } + function onYChanged() { + saveWindowGeometryTimer.restart(); + } } - Loader { id: quickView active: !Kirigami.Settings.isMobile @@ -114,7 +123,9 @@ Kirigami.ApplicationWindow { target: RoomManager function onPushRoom(room, event) { - root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", {connection: root.connection}); + root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", { + connection: root.connection + }); root.roomPage.forceActiveFocus(); if (event.length > 0) { roomPage.goToEvent(event); @@ -131,7 +142,9 @@ Kirigami.ApplicationWindow { pageStack.currentIndex = pageStack.depth - 1; } else { pageStack.pop(); - root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", {connection: root.connection}); + root.roomPage = pageStack.push("qrc:/org/kde/neochat/qml/RoomPage.qml", { + connection: root.connection + }); root.spaceHomePage = null; } root.roomPage.forceActiveFocus(); @@ -159,14 +172,17 @@ Kirigami.ApplicationWindow { } function onOpenRoomInNewWindow(room) { - const secondaryWindow = roomWindow.createObject(undefined, {currentRoom: room, connection: root.connection}); + const secondaryWindow = roomWindow.createObject(undefined, { + currentRoom: room, + connection: root.connection + }); secondaryWindow.width = root.width - pageStack.get(0).width; secondaryWindow.show(); } function onAskDirectChatConfirmation(user) { askDirectChatConfirmationComponent.createObject(QQC2.ApplicationWindow.overlay, { - user: user, + user: user }).open(); } } @@ -182,7 +198,7 @@ Kirigami.ApplicationWindow { function openRoomDrawer() { pageStack.push("qrc:/org/kde/neochat/qml/RoomDrawerPage.qml", { connection: root.connection - }) + }); } contextDrawer: RoomDrawer { @@ -198,7 +214,7 @@ Kirigami.ApplicationWindow { Connections { target: contextDrawer.handle.children[0] function onClicked() { - contextDrawer.drawerUserState = contextDrawer.drawerOpen + contextDrawer.drawerUserState = contextDrawer.drawerOpen; } } @@ -206,8 +222,8 @@ Kirigami.ApplicationWindow { onEnabledChanged: drawerOpen = enabled && !modal onModalChanged: { if (Config.autoRoomInfoDrawer) { - drawerOpen = !modal && drawerUserState - dim = false + drawerOpen = !modal && drawerUserState; + dim = false; } } enabled: RoomManager.hasOpenRoom && pageStack.layers.depth < 2 && pageStack.depth < 3 && (pageStack.visibleItems.length > 1 || pageStack.currentIndex > 0) && !Kirigami.Settings.isMobile && root.pageStack.wideMode @@ -215,10 +231,10 @@ Kirigami.ApplicationWindow { } Component.onCompleted: { - CustomEmojiModel.connection = root.connection - MatrixImageProvider.connection = root.connection - RoomManager.connection = root.connection - SpaceHierarchyCache.connection = root.connection + CustomEmojiModel.connection = root.connection; + MatrixImageProvider.connection = root.connection; + RoomManager.connection = root.connection; + SpaceHierarchyCache.connection = root.connection; WindowController.setBlur(pageStack, Config.blur && !Config.compactLayout); if (Config.minimizeToSystemTrayOnStartup && !Kirigami.Settings.isMobile && Controller.supportSystemTray && Config.systemTray) { restoreWindowGeometryConnections.enabled = true; // To restore window size and position @@ -239,12 +255,12 @@ Kirigami.ApplicationWindow { // blur effect color: Config.blur && !Config.compactLayout ? "transparent" : Kirigami.Theme.backgroundColor - + // we need to apply the translucency effect separately on top of the color background: Rectangle { color: Config.blur && !Config.compactLayout ? Qt.rgba(Kirigami.Theme.backgroundColor.r, Kirigami.Theme.backgroundColor.g, Kirigami.Theme.backgroundColor.b, 1 - Config.transparency) : "transparent" } - + Component { id: roomListComponent RoomListPage { @@ -319,7 +335,7 @@ Kirigami.ApplicationWindow { Component { id: keyVerificationDialogComponent - KeyVerificationDialog { } + KeyVerificationDialog {} } Connections { @@ -330,15 +346,15 @@ Kirigami.ApplicationWindow { } function onNewKeyVerificationSession(session) { applicationWindow().pageStack.pushDialogLayer(keyVerificationDialogComponent, { - session: session, + session: session }, { title: i18nc("@title:window", "Session Verification") }); } function onUserConsentRequired(url) { - let consent = consentSheetComponent.createObject(QQC2.ApplicationWindow.overlay) - consent.url = url - consent.open() + let consent = consentSheetComponent.createObject(QQC2.ApplicationWindow.overlay); + consent.url = url; + consent.open(); } } @@ -383,7 +399,7 @@ Kirigami.ApplicationWindow { Kirigami.OverlaySheet { id: askDirectChatConfirmation - required property var user; + required property var user parent: QQC2.ApplicationWindow.overlay title: i18n("Start a chat") @@ -397,13 +413,13 @@ Kirigami.ApplicationWindow { user.requestDirectChat(); askDirectChatConfirmation.close(); } - onRejected: askDirectChatConfirmation.close(); + onRejected: askDirectChatConfirmation.close() } } } property Item hoverLinkIndicator: QQC2.Control { - parent: overlay.parent + parent: overlay.parent property string text opacity: linkText.text.length > 0 ? 1 : 0 @@ -416,14 +432,18 @@ Kirigami.ApplicationWindow { } Kirigami.Theme.colorSet: Kirigami.Theme.View background: Rectangle { - color: Kirigami.Theme.backgroundColor + color: Kirigami.Theme.backgroundColor } } Shortcut { sequence: "Ctrl+Shift+," onActivated: { - pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", {connection: root.connection}, { title: i18n("Configure") }) + pageStack.pushDialogLayer("qrc:/org/kde/neochat/qml/SettingsPage.qml", { + connection: root.connection + }, { + title: i18n("Configure") + }); } } }