fix #LINQT-1878 emoji picker popup closing

This commit is contained in:
Gaelle Braud 2025-08-19 10:28:19 +02:00
parent c24cfe135a
commit 80d6a75377
6 changed files with 63 additions and 55 deletions

View file

@ -103,13 +103,13 @@ Control.TabBar {
bottomInset: Math.round(32 * DefaultStyle.dp) bottomInset: Math.round(32 * DefaultStyle.dp)
topInset: Math.round(32 * DefaultStyle.dp) topInset: Math.round(32 * DefaultStyle.dp)
hoverEnabled: true hoverEnabled: true
visible: modelData?.visible != undefined ? modelData?.visible : true visible: modelData?.visible != undefined ? modelData.visible : true
UnreadNotification { UnreadNotification {
unread: !defaultAccount unread: !defaultAccount
? -1 ? -1
: index == 0 : index === 0
? defaultAccount.core?.unreadCallNotifications || -1 ? defaultAccount.core?.unreadCallNotifications || -1
: index == 2 : index === 2
? defaultAccount.core?.unreadMessageNotifications || -1 ? defaultAccount.core?.unreadMessageNotifications || -1
: 0 : 0
anchors.right: parent.right anchors.right: parent.right

View file

@ -177,10 +177,14 @@ ListView {
spacing: Math.round(10 * DefaultStyle.dp) spacing: Math.round(10 * DefaultStyle.dp)
Avatar { Avatar {
id: historyAvatar id: historyAvatar
property var contactObj: UtilsCpp.findFriendByAddress(modelData.core.peerAddress) property var contactObj: modelData ? UtilsCpp.findFriendByAddress(modelData.core.peerAddress) : null
contact: contactObj?.value || null contact: contactObj?.value || null
displayNameVal: contact ? undefined : modelData.core.avatarUri displayNameVal: contact
secured: modelData.core.isSecured ? undefined
: modelData
? modelData.core.avatarUri
: null
secured: modelData?.core.isSecured || false
Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredWidth: Math.round(45 * DefaultStyle.dp)
Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp)
// isConference: modelData.core.isConference // isConference: modelData.core.isConference
@ -195,7 +199,7 @@ ListView {
id: friendAddress id: friendAddress
Layout.fillWidth: true Layout.fillWidth: true
maximumLineCount: 1 maximumLineCount: 1
text: modelData.core.title text: modelData? modelData.core.title : ""
color: DefaultStyle.main2_800 color: DefaultStyle.main2_800
font { font {
pixelSize: Typography.p1.pixelSize pixelSize: Typography.p1.pixelSize
@ -258,7 +262,7 @@ ListView {
Layout.fillWidth: true Layout.fillWidth: true
maximumLineCount: 1 maximumLineCount: 1
visible: !remoteComposingInfo.visible visible: !remoteComposingInfo.visible
text: modelData.core.lastMessageText text: modelData ? modelData.core.lastMessageText : ""
color: DefaultStyle.main2_400 color: DefaultStyle.main2_400
font { font {
pixelSize: Typography.p1.pixelSize pixelSize: Typography.p1.pixelSize
@ -267,20 +271,22 @@ ListView {
} }
Text { Text {
id: remoteComposingInfo id: remoteComposingInfo
visible: (modelData.core.composingName !== "" || modelData.core.sendingText !== "") visible: modelData ? (modelData.core.composingName !== "" || modelData.core.sendingText !== "") : false
Layout.fillWidth: true Layout.fillWidth: true
maximumLineCount: 1 maximumLineCount: 1
font { font {
pixelSize: Typography.p3.pixelSize pixelSize: Typography.p3.pixelSize
weight: Typography.p3.weight weight: Typography.p3.weight
italic: modelData.core.sendingText !== "" italic: modelData?.core.sendingText !== ""
} }
//: %1 is writing //: %1 is writing
text: modelData.core.composingName !== "" text: modelData
? qsTr("chat_message_is_writing_info").arg(modelData.core.composingName) ? modelData.core.composingName !== ""
: modelData.core.sendingText !== "" ? qsTr("chat_message_is_writing_info").arg(modelData.core.composingName)
? qsTr("chat_message_draft_sending_text").arg(modelData.core.sendingText) : modelData.core.sendingText !== ""
: "" ? qsTr("chat_message_draft_sending_text").arg(modelData.core.sendingText)
: ""
: ""
} }
} }
} }
@ -290,7 +296,7 @@ ListView {
Item{Layout.fillWidth: true} Item{Layout.fillWidth: true}
Text { Text {
color: DefaultStyle.main2_500main color: DefaultStyle.main2_500main
text: UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false) text: modelData ? UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false) : ""
font { font {
pixelSize: Typography.p3.pixelSize pixelSize: Typography.p3.pixelSize
weight: Typography.p3.weight weight: Typography.p3.weight
@ -303,7 +309,7 @@ ListView {
spacing: Math.round(10 * DefaultStyle.dp) spacing: Math.round(10 * DefaultStyle.dp)
Item {Layout.fillWidth: true} Item {Layout.fillWidth: true}
EffectImage { EffectImage {
visible: modelData?.core.ephemeralEnabled visible: modelData?.core.ephemeralEnabled || false
Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0
Layout.preferredHeight: 14 * DefaultStyle.dp Layout.preferredHeight: 14 * DefaultStyle.dp
colorizationColor: DefaultStyle.main2_400 colorizationColor: DefaultStyle.main2_400
@ -318,23 +324,25 @@ ListView {
} }
UnreadNotification { UnreadNotification {
id: unreadCount id: unreadCount
unread: modelData.core.unreadMessagesCount unread: modelData?.core.unreadMessagesCount || false
} }
EffectImage { EffectImage {
visible: modelData?.core.lastMessage && modelData?.core.lastMessageState !== LinphoneEnums.ChatMessageState.StateIdle visible: modelData?.core.lastMessage && modelData?.core.lastMessageState !== LinphoneEnums.ChatMessageState.StateIdle || false
&& !modelData.core.lastMessage.core.isRemoteMessage && !modelData.core.lastMessage.core.isRemoteMessage
Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0
Layout.preferredHeight: 14 * DefaultStyle.dp Layout.preferredHeight: 14 * DefaultStyle.dp
colorizationColor: DefaultStyle.main1_500_main colorizationColor: DefaultStyle.main1_500_main
imageSource: modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDelivered imageSource: modelData
? AppIcons.envelope ? modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDelivered
: modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDeliveredToUser ? AppIcons.envelope
? AppIcons.check : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDeliveredToUser
: modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateNotDelivered ? AppIcons.check
? AppIcons.warningCircle : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateNotDelivered
: modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDisplayed ? AppIcons.warningCircle
? AppIcons.checks : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDisplayed
: "" ? AppIcons.checks
: ""
: ""
} }
} }
} }
@ -348,8 +356,12 @@ ListView {
popup.contentItem: ColumnLayout { popup.contentItem: ColumnLayout {
IconLabelButton { IconLabelButton {
//: "Mute" //: "Mute"
text: modelData.core.muted ? qsTr("chat_room_unmute") : qsTr("chat_room_mute") text: modelData
icon.source: modelData.core.muted ? AppIcons.bell : AppIcons.bellSlash ? modelData.core.muted
? qsTr("chat_room_unmute")
: qsTr("chat_room_mute")
: ""
icon.source: modelData ? modelData.core.muted ? AppIcons.bell : AppIcons.bellSlash : ""
spacing: Math.round(10 * DefaultStyle.dp) spacing: Math.round(10 * DefaultStyle.dp)
Layout.fillWidth: true Layout.fillWidth: true
onClicked: { onClicked: {
@ -378,7 +390,7 @@ ListView {
id: leaveButton id: leaveButton
//: "leave" //: "leave"
text: qsTr("chat_room_leave") text: qsTr("chat_room_leave")
visible: !modelData.core.isReadOnly && modelData.core.isGroupChat visible: modelData ? !modelData.core.isReadOnly && modelData.core.isGroupChat : false
icon.source: AppIcons.trashCan icon.source: AppIcons.trashCan
spacing: Math.round(10 * DefaultStyle.dp) spacing: Math.round(10 * DefaultStyle.dp)
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -16,7 +16,7 @@ Control.Control {
property var textArea property var textArea
property int selectedFilesCount: 0 property int selectedFilesCount: 0
// property alias cursorPosition: sendingTextArea.cursorPosition // property alias cursorPosition: sendingTextArea.cursorPosition
property bool emojiPickerButtonChecked property Popup emojiPicker
property bool dropEnabled: true property bool dropEnabled: true
property bool isEphemeral : false property bool isEphemeral : false
@ -82,14 +82,11 @@ Control.Control {
BigButton { BigButton {
id: emojiPickerButton id: emojiPickerButton
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
checkable: true checked: mainItem.emojiPicker?.visible || false
icon.source: checked ? AppIcons.closeX : AppIcons.smiley icon.source: checked ? AppIcons.closeX : AppIcons.smiley
onCheckedChanged: mainItem.emojiPickerButtonChecked = checked onPressed: {
Connections { if (!checked) mainItem.emojiPicker.open()
target: mainItem else mainItem.emojiPicker.close()
function onEmojiPickerButtonCheckedChanged() {
emojiPickerButton.checked = mainItem.emojiPickerButtonChecked
}
} }
} }
BigButton { BigButton {

View file

@ -102,7 +102,7 @@ FocusScope {
checked: numericPadPopup?.visible || false checked: numericPadPopup?.visible || false
style: ButtonStyle.noBackground style: ButtonStyle.noBackground
icon.source: AppIcons.dialer icon.source: AppIcons.dialer
contentImageColor: dialerButton.checked ? DefaultStyle.main1_500_main : DefaultStyle.main2_600 contentImageColor: checked ? DefaultStyle.main1_500_main : DefaultStyle.main2_600
hoveredImageColor: contentImageColor hoveredImageColor: contentImageColor
width: Math.round(24 * DefaultStyle.dp) width: Math.round(24 * DefaultStyle.dp)
height: Math.round(24 * DefaultStyle.dp) height: Math.round(24 * DefaultStyle.dp)

View file

@ -275,9 +275,10 @@ FocusScope {
x: Math.round(chatMessagesListView.x + 8*DefaultStyle.dp) x: Math.round(chatMessagesListView.x + 8*DefaultStyle.dp)
width: Math.round(393 * DefaultStyle.dp) width: Math.round(393 * DefaultStyle.dp)
height: Math.round(291 * DefaultStyle.dp) height: Math.round(291 * DefaultStyle.dp)
visible: messageSender.emojiPickerButtonChecked visible: false
closePolicy: Popup.CloseOnPressOutside modal: true
onClosed: messageSender.emojiPickerButtonChecked = false dim: false
closePolicy: Popup.CloseOnReleaseOutside
padding: 10 * DefaultStyle.dp padding: 10 * DefaultStyle.dp
background: Item { background: Item {
anchors.fill: parent anchors.fill: parent
@ -484,6 +485,7 @@ FocusScope {
Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Math.round(79 * DefaultStyle.dp) Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Math.round(79 * DefaultStyle.dp)
chat: mainItem.chat chat: mainItem.chat
selectedFilesCount: contents.count selectedFilesCount: contents.count
emojiPicker: emojiPickerPopup
onChatChanged: { onChatChanged: {
if (chat) messageSender.text = mainItem.chat.core.sendingText if (chat) messageSender.text = mainItem.chat.core.sendingText
} }

View file

@ -75,9 +75,7 @@ Item {
} }
function openAccountSettings(account) { function openAccountSettings(account) {
var page = accountSettingsPageComponent.createObject(parent, { var page = accountSettingsPageComponent.createObject(parent, {"account": account})
"account": account
})
openContextualMenuComponent(page) openContextualMenuComponent(page)
} }
@ -129,6 +127,7 @@ Item {
Layout.fillHeight: true Layout.fillHeight: true
Layout.preferredWidth: Math.round(82 * DefaultStyle.dp) Layout.preferredWidth: Math.round(82 * DefaultStyle.dp)
defaultAccount: accountProxy.defaultAccount defaultAccount: accountProxy.defaultAccount
currentIndex: 0
Binding on currentIndex { Binding on currentIndex {
when: mainItem.contextualMenuOpenedComponent != undefined when: mainItem.contextualMenuOpenedComponent != undefined
value: -1 value: -1
@ -157,7 +156,7 @@ Item {
"visible": !SettingsCpp.disableMeetingsFeature "visible": !SettingsCpp.disableMeetingsFeature
}] }]
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (currentIndex == -1) if (currentIndex === -1)
return return
if (currentIndex === 0 && accountProxy.defaultAccount) if (currentIndex === 0 && accountProxy.defaultAccount)
accountProxy.defaultAccount.core?.lResetMissedCalls() accountProxy.defaultAccount.core?.lResetMissedCalls()
@ -429,8 +428,9 @@ Item {
//: Mon compte //: Mon compte
text: qsTr("drawer_menu_manage_account") text: qsTr("drawer_menu_manage_account")
icon.source: AppIcons.manageProfile icon.source: AppIcons.manageProfile
onClicked: openAccountSettings( onClicked: openAccountSettings(accountProxy.defaultAccount
accountProxy.defaultAccount ? accountProxy.defaultAccount : accountProxy.firstAccount()) ? accountProxy.defaultAccount
: accountProxy.firstAccount())
KeyNavigation.up: visibleChildren.length KeyNavigation.up: visibleChildren.length
!= 0 ? settingsMenuButton.getPreviousItem( != 0 ? settingsMenuButton.getPreviousItem(
0) : null 0) : null
@ -575,14 +575,11 @@ Item {
children[currentIndex].forceActiveFocus() children[currentIndex].forceActiveFocus()
on_CurrentIndexChanged: { on_CurrentIndexChanged: {
if (count > 0) { if (count > 0) {
if (_currentIndex >= count if (_currentIndex >= count && tabbar.model[_currentIndex].link) {
&& tabbar.model[_currentIndex].link) { Qt.openUrlExternally(tabbar.model[_currentIndex].link)
Qt.openUrlExternally(
tabbar.model[_currentIndex].link)
} else if (_currentIndex >= 0) { } else if (_currentIndex >= 0) {
currentIndex = _currentIndex currentIndex = _currentIndex
SettingsCpp.setLastActiveTabIndex( SettingsCpp.setLastActiveTabIndex(currentIndex)
currentIndex)
} }
} }
} }