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.
This commit is contained in:
James Graham
2023-08-09 18:10:53 +00:00
parent 80a5daa1f7
commit 018154f555

View File

@@ -85,16 +85,17 @@ QQC2.Control {
property bool isBusy: false property bool isBusy: false
visible: !Kirigami.Settings.isMobile
icon.name: "smiley" icon.name: "smiley"
text: i18n("Emojis & Stickers") text: i18n("Emojis & Stickers")
displayHint: Kirigami.DisplayHint.IconOnly displayHint: Kirigami.DisplayHint.IconOnly
checkable: true checkable: true
onTriggered: { onTriggered: {
if (emojiDialog.visible) { if (emojiDialog.item.visible) {
emojiDialog.close() emojiDialog.item.close()
} else { } else {
emojiDialog.open() emojiDialog.item.open()
} }
} }
}, },
@@ -393,19 +394,22 @@ QQC2.Control {
} }
} }
EmojiDialog { Loader {
id: emojiDialog id: emojiDialog
x: parent.width - width active: !Kirigami.Settings.isMobile
y: -implicitHeight // - Kirigami.Units.smallSpacing sourceComponent: EmojiDialog {
x: root.width - width
y: -implicitHeight // - Kirigami.Units.smallSpacing
modal: false modal: false
includeCustom: true includeCustom: true
closeOnChosen: false closeOnChosen: false
currentRoom: root.currentRoom currentRoom: root.currentRoom
onChosen: insertText(emoji) onChosen: insertText(emoji)
onClosed: if (emojiButton.checked) emojiButton.checked = false onClosed: if (emojiAction.checked) emojiAction.checked = false
}
} }
background: Rectangle { background: Rectangle {