From 80d6a753772e4b744d7191224da7ad4ef126d6f9 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Tue, 19 Aug 2025 10:28:19 +0200 Subject: [PATCH] fix #LINQT-1878 emoji picker popup closing --- .../view/Control/Container/VerticalTabBar.qml | 6 +- .../Control/Display/Chat/ChatListView.qml | 68 +++++++++++-------- .../Input/Chat/ChatDroppableTextArea.qml | 13 ++-- Linphone/view/Control/Input/SearchBar.qml | 2 +- .../view/Page/Form/Chat/SelectedChatView.qml | 8 ++- Linphone/view/Page/Layout/Main/MainLayout.qml | 21 +++--- 6 files changed, 63 insertions(+), 55 deletions(-) diff --git a/Linphone/view/Control/Container/VerticalTabBar.qml b/Linphone/view/Control/Container/VerticalTabBar.qml index a896123a4..c6c33b773 100644 --- a/Linphone/view/Control/Container/VerticalTabBar.qml +++ b/Linphone/view/Control/Container/VerticalTabBar.qml @@ -103,13 +103,13 @@ Control.TabBar { bottomInset: Math.round(32 * DefaultStyle.dp) topInset: Math.round(32 * DefaultStyle.dp) hoverEnabled: true - visible: modelData?.visible != undefined ? modelData?.visible : true + visible: modelData?.visible != undefined ? modelData.visible : true UnreadNotification { unread: !defaultAccount ? -1 - : index == 0 + : index === 0 ? defaultAccount.core?.unreadCallNotifications || -1 - : index == 2 + : index === 2 ? defaultAccount.core?.unreadMessageNotifications || -1 : 0 anchors.right: parent.right diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index b9c636192..6f7dff9a7 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -177,10 +177,14 @@ ListView { spacing: Math.round(10 * DefaultStyle.dp) Avatar { id: historyAvatar - property var contactObj: UtilsCpp.findFriendByAddress(modelData.core.peerAddress) + property var contactObj: modelData ? UtilsCpp.findFriendByAddress(modelData.core.peerAddress) : null contact: contactObj?.value || null - displayNameVal: contact ? undefined : modelData.core.avatarUri - secured: modelData.core.isSecured + displayNameVal: contact + ? undefined + : modelData + ? modelData.core.avatarUri + : null + secured: modelData?.core.isSecured || false Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) // isConference: modelData.core.isConference @@ -195,7 +199,7 @@ ListView { id: friendAddress Layout.fillWidth: true maximumLineCount: 1 - text: modelData.core.title + text: modelData? modelData.core.title : "" color: DefaultStyle.main2_800 font { pixelSize: Typography.p1.pixelSize @@ -258,7 +262,7 @@ ListView { Layout.fillWidth: true maximumLineCount: 1 visible: !remoteComposingInfo.visible - text: modelData.core.lastMessageText + text: modelData ? modelData.core.lastMessageText : "" color: DefaultStyle.main2_400 font { pixelSize: Typography.p1.pixelSize @@ -267,20 +271,22 @@ ListView { } Text { id: remoteComposingInfo - visible: (modelData.core.composingName !== "" || modelData.core.sendingText !== "") + visible: modelData ? (modelData.core.composingName !== "" || modelData.core.sendingText !== "") : false Layout.fillWidth: true maximumLineCount: 1 font { pixelSize: Typography.p3.pixelSize weight: Typography.p3.weight - italic: modelData.core.sendingText !== "" + italic: modelData?.core.sendingText !== "" } //: %1 is writing… - text: modelData.core.composingName !== "" - ? qsTr("chat_message_is_writing_info").arg(modelData.core.composingName) - : modelData.core.sendingText !== "" - ? qsTr("chat_message_draft_sending_text").arg(modelData.core.sendingText) - : "" + text: modelData + ? modelData.core.composingName !== "" + ? qsTr("chat_message_is_writing_info").arg(modelData.core.composingName) + : modelData.core.sendingText !== "" + ? qsTr("chat_message_draft_sending_text").arg(modelData.core.sendingText) + : "" + : "" } } } @@ -290,7 +296,7 @@ ListView { Item{Layout.fillWidth: true} Text { color: DefaultStyle.main2_500main - text: UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false) + text: modelData ? UtilsCpp.formatDate(modelData.core.lastUpdatedTime, true, false) : "" font { pixelSize: Typography.p3.pixelSize weight: Typography.p3.weight @@ -303,7 +309,7 @@ ListView { spacing: Math.round(10 * DefaultStyle.dp) Item {Layout.fillWidth: true} EffectImage { - visible: modelData?.core.ephemeralEnabled + visible: modelData?.core.ephemeralEnabled || false Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 Layout.preferredHeight: 14 * DefaultStyle.dp colorizationColor: DefaultStyle.main2_400 @@ -318,23 +324,25 @@ ListView { } UnreadNotification { id: unreadCount - unread: modelData.core.unreadMessagesCount + unread: modelData?.core.unreadMessagesCount || false } 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 Layout.preferredWidth: visible ? 14 * DefaultStyle.dp : 0 Layout.preferredHeight: 14 * DefaultStyle.dp colorizationColor: DefaultStyle.main1_500_main - imageSource: modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDelivered - ? AppIcons.envelope - : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDeliveredToUser - ? AppIcons.check - : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateNotDelivered - ? AppIcons.warningCircle - : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDisplayed - ? AppIcons.checks - : "" + imageSource: modelData + ? modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDelivered + ? AppIcons.envelope + : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDeliveredToUser + ? AppIcons.check + : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateNotDelivered + ? AppIcons.warningCircle + : modelData.core.lastMessageState === LinphoneEnums.ChatMessageState.StateDisplayed + ? AppIcons.checks + : "" + : "" } } } @@ -348,8 +356,12 @@ ListView { popup.contentItem: ColumnLayout { IconLabelButton { //: "Mute" - text: modelData.core.muted ? qsTr("chat_room_unmute") : qsTr("chat_room_mute") - icon.source: modelData.core.muted ? AppIcons.bell : AppIcons.bellSlash + text: modelData + ? 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) Layout.fillWidth: true onClicked: { @@ -378,7 +390,7 @@ ListView { id: leaveButton //: "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 spacing: Math.round(10 * DefaultStyle.dp) Layout.fillWidth: true diff --git a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml index f1c93ce53..7e6ee32b9 100644 --- a/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml +++ b/Linphone/view/Control/Input/Chat/ChatDroppableTextArea.qml @@ -16,7 +16,7 @@ Control.Control { property var textArea property int selectedFilesCount: 0 // property alias cursorPosition: sendingTextArea.cursorPosition - property bool emojiPickerButtonChecked + property Popup emojiPicker property bool dropEnabled: true property bool isEphemeral : false @@ -82,14 +82,11 @@ Control.Control { BigButton { id: emojiPickerButton style: ButtonStyle.noBackground - checkable: true + checked: mainItem.emojiPicker?.visible || false icon.source: checked ? AppIcons.closeX : AppIcons.smiley - onCheckedChanged: mainItem.emojiPickerButtonChecked = checked - Connections { - target: mainItem - function onEmojiPickerButtonCheckedChanged() { - emojiPickerButton.checked = mainItem.emojiPickerButtonChecked - } + onPressed: { + if (!checked) mainItem.emojiPicker.open() + else mainItem.emojiPicker.close() } } BigButton { diff --git a/Linphone/view/Control/Input/SearchBar.qml b/Linphone/view/Control/Input/SearchBar.qml index cb9996885..6e397f52c 100644 --- a/Linphone/view/Control/Input/SearchBar.qml +++ b/Linphone/view/Control/Input/SearchBar.qml @@ -102,7 +102,7 @@ FocusScope { checked: numericPadPopup?.visible || false style: ButtonStyle.noBackground 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 width: Math.round(24 * DefaultStyle.dp) height: Math.round(24 * DefaultStyle.dp) diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index ae576cf95..194775c54 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -275,9 +275,10 @@ FocusScope { x: Math.round(chatMessagesListView.x + 8*DefaultStyle.dp) width: Math.round(393 * DefaultStyle.dp) height: Math.round(291 * DefaultStyle.dp) - visible: messageSender.emojiPickerButtonChecked - closePolicy: Popup.CloseOnPressOutside - onClosed: messageSender.emojiPickerButtonChecked = false + visible: false + modal: true + dim: false + closePolicy: Popup.CloseOnReleaseOutside padding: 10 * DefaultStyle.dp background: Item { anchors.fill: parent @@ -484,6 +485,7 @@ FocusScope { Control.SplitView.minimumHeight: mainItem.chat?.core.isReadOnly ? 0 : Math.round(79 * DefaultStyle.dp) chat: mainItem.chat selectedFilesCount: contents.count + emojiPicker: emojiPickerPopup onChatChanged: { if (chat) messageSender.text = mainItem.chat.core.sendingText } diff --git a/Linphone/view/Page/Layout/Main/MainLayout.qml b/Linphone/view/Page/Layout/Main/MainLayout.qml index af853858c..57944edee 100644 --- a/Linphone/view/Page/Layout/Main/MainLayout.qml +++ b/Linphone/view/Page/Layout/Main/MainLayout.qml @@ -75,9 +75,7 @@ Item { } function openAccountSettings(account) { - var page = accountSettingsPageComponent.createObject(parent, { - "account": account - }) + var page = accountSettingsPageComponent.createObject(parent, {"account": account}) openContextualMenuComponent(page) } @@ -129,6 +127,7 @@ Item { Layout.fillHeight: true Layout.preferredWidth: Math.round(82 * DefaultStyle.dp) defaultAccount: accountProxy.defaultAccount + currentIndex: 0 Binding on currentIndex { when: mainItem.contextualMenuOpenedComponent != undefined value: -1 @@ -157,7 +156,7 @@ Item { "visible": !SettingsCpp.disableMeetingsFeature }] onCurrentIndexChanged: { - if (currentIndex == -1) + if (currentIndex === -1) return if (currentIndex === 0 && accountProxy.defaultAccount) accountProxy.defaultAccount.core?.lResetMissedCalls() @@ -429,8 +428,9 @@ Item { //: Mon compte text: qsTr("drawer_menu_manage_account") icon.source: AppIcons.manageProfile - onClicked: openAccountSettings( - accountProxy.defaultAccount ? accountProxy.defaultAccount : accountProxy.firstAccount()) + onClicked: openAccountSettings(accountProxy.defaultAccount + ? accountProxy.defaultAccount + : accountProxy.firstAccount()) KeyNavigation.up: visibleChildren.length != 0 ? settingsMenuButton.getPreviousItem( 0) : null @@ -575,14 +575,11 @@ Item { children[currentIndex].forceActiveFocus() on_CurrentIndexChanged: { if (count > 0) { - if (_currentIndex >= count - && tabbar.model[_currentIndex].link) { - Qt.openUrlExternally( - tabbar.model[_currentIndex].link) + if (_currentIndex >= count && tabbar.model[_currentIndex].link) { + Qt.openUrlExternally(tabbar.model[_currentIndex].link) } else if (_currentIndex >= 0) { currentIndex = _currentIndex - SettingsCpp.setLastActiveTabIndex( - currentIndex) + SettingsCpp.setLastActiveTabIndex(currentIndex) } } }