From 018154f555e333fa9820c61df421c7973ac56587 Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 9 Aug 2023 18:10:53 +0000 Subject: [PATCH] No emoji chatbar button on mobile Hide the emoji button in the `chatbar` and don't instantiate the dialog component on mobile. This isn't needed on mobile as the virtual keyboard can add emojis. Should also save a small amount of memory on mobile from the dialog which is normally always instantiated. --- src/qml/Component/ChatBox/ChatBar.qml | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/qml/Component/ChatBox/ChatBar.qml b/src/qml/Component/ChatBox/ChatBar.qml index b56f24aa0..886ca85d8 100644 --- a/src/qml/Component/ChatBox/ChatBar.qml +++ b/src/qml/Component/ChatBox/ChatBar.qml @@ -85,16 +85,17 @@ QQC2.Control { property bool isBusy: false + visible: !Kirigami.Settings.isMobile icon.name: "smiley" text: i18n("Emojis & Stickers") displayHint: Kirigami.DisplayHint.IconOnly checkable: true onTriggered: { - if (emojiDialog.visible) { - emojiDialog.close() + if (emojiDialog.item.visible) { + emojiDialog.item.close() } else { - emojiDialog.open() + emojiDialog.item.open() } } }, @@ -393,19 +394,22 @@ QQC2.Control { } } - EmojiDialog { + Loader { id: emojiDialog - x: parent.width - width - y: -implicitHeight // - Kirigami.Units.smallSpacing + active: !Kirigami.Settings.isMobile + sourceComponent: EmojiDialog { + x: root.width - width + y: -implicitHeight // - Kirigami.Units.smallSpacing - modal: false - includeCustom: true - closeOnChosen: false + modal: false + includeCustom: true + closeOnChosen: false - currentRoom: root.currentRoom + currentRoom: root.currentRoom - onChosen: insertText(emoji) - onClosed: if (emojiButton.checked) emojiButton.checked = false + onChosen: insertText(emoji) + onClosed: if (emojiAction.checked) emojiAction.checked = false + } } background: Rectangle {