From 0614520e5a5994f95455a9a94212b65346d32ff0 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Thu, 22 May 2025 09:50:28 +0200 Subject: [PATCH] fix sending area wiped everytime we receive a message : set a sending text in chatcore (also allows to write something to someone and let it unfinished for later) fix chat message insertion in list --- Linphone/core/chat/ChatCore.cpp | 11 + Linphone/core/chat/ChatCore.hpp | 6 + .../core/chat/message/ChatMessageList.cpp | 7 +- Linphone/data/languages/de.ts | 72 +++-- Linphone/data/languages/en.ts | 112 ++++---- Linphone/data/languages/fr_FR.ts | 92 ++++--- Linphone/view/CMakeLists.txt | 2 +- Linphone/view/Control/Button/PopupButton.qml | 4 + .../Control/Display/Chat/ChatListView.qml | 18 +- .../Emoji/EmojiPicker.qml | 3 +- .../view/Control/Display/Contact/Contact.qml | 5 +- .../Contact/PresenceSetCustomStatus.qml | 2 +- .../Conversation/ConversationListView.qml | 247 ------------------ .../view/Page/Form/Chat/SelectedChatView.qml | 10 +- 14 files changed, 219 insertions(+), 372 deletions(-) rename Linphone/view/Control/Display/{Conversation => Chat}/Emoji/EmojiPicker.qml (99%) delete mode 100644 Linphone/view/Control/Display/Conversation/ConversationListView.qml diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index ab9d7921..333b4026 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -257,6 +257,17 @@ void ChatCore::setTitle(QString title) { } } +QString ChatCore::getSendingText() const { + return mSendingText; +} + +void ChatCore::setSendingText(const QString &text) { + if (mSendingText != text) { + mSendingText = text; + emit sendingTextChanged(text); + } +} + bool ChatCore::isGroupChat() const { return mIsGroupChat; } diff --git a/Linphone/core/chat/ChatCore.hpp b/Linphone/core/chat/ChatCore.hpp index 0efef770..2773fa3c 100644 --- a/Linphone/core/chat/ChatCore.hpp +++ b/Linphone/core/chat/ChatCore.hpp @@ -51,6 +51,7 @@ public: Q_PROPERTY(bool isGroupChat READ isGroupChat CONSTANT) Q_PROPERTY(bool isEncrypted READ isEncrypted CONSTANT) Q_PROPERTY(bool isReadOnly READ getIsReadOnly WRITE setIsReadOnly NOTIFY readOnlyChanged) + Q_PROPERTY(QString sendingText READ getSendingText WRITE setSendingText NOTIFY sendingTextChanged) // Should be call from model Thread. Will be automatically in App thread after initialization static QSharedPointer create(const std::shared_ptr &chatRoom); @@ -70,6 +71,9 @@ public: QString getIdentifier() const; + QString getSendingText() const; + void setSendingText(const QString &text); + ChatMessageGui *getLastMessage() const; QString getLastMessageText() const; @@ -122,6 +126,7 @@ signals: void composingUserChanged(); void chatRoomStateChanged(); void readOnlyChanged(); + void sendingTextChanged(QString text); void lDeleteMessage(); void lDelete(); @@ -142,6 +147,7 @@ private: QString mTitle; QString mIdentifier; QString mAvatarUri; + QString mSendingText; int mUnreadMessagesCount; QString mComposingName; QString mComposingAddress; diff --git a/Linphone/core/chat/message/ChatMessageList.cpp b/Linphone/core/chat/message/ChatMessageList.cpp index b2422a01..8d3ebfeb 100644 --- a/Linphone/core/chat/message/ChatMessageList.cpp +++ b/Linphone/core/chat/message/ChatMessageList.cpp @@ -74,10 +74,9 @@ void ChatMessageList::setChatCore(QSharedPointer core) { [this](QList> list) { auto chatList = getSharedList(); for (auto &message : list) { - auto it = std::find_if(chatList.begin(), chatList.end(), - [message](const QSharedPointer item) { - return item->getMessageId() == message->getMessageId(); - }); + auto it = std::find_if( + chatList.begin(), chatList.end(), + [message](const QSharedPointer item) { return item == message; }); if (it == chatList.end()) { add(message); int index; diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 6a700d6c..40d23dd5 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -809,25 +809,25 @@ Offline - + meeting_info_join_title "Rejoindre la réunion" Besprechung beitreten - + contact_call_action "Appel" Anrufen - + contact_message_action "Message" Nachricht - + contact_video_call_action "Appel Video" Videoanruf @@ -1712,13 +1712,13 @@ ChatCore - + info_toast_deleted_title Deleted - + info_toast_deleted_message_history Message history has been deleted @@ -1727,19 +1727,31 @@ ChatListView - + + chat_message_is_writing_info + %1 is writing… + + + + + chat_message_draft_sending_text + Draft : %1 + + + + chat_room_delete "Supprimer" - + chat_list_delete_chat_popup_title Delete the chat ? - + chat_list_delete_chat_popup_message This chat and all its messages will be deleted. Do You want to continue ? @@ -1748,25 +1760,25 @@ ChatMessage - + chat_message_copy "Copy" - + chat_message_copied_to_clipboard_title Copied - + chat_message_copied_to_clipboard_toast "to clipboard" - + chat_message_delete "Delete" @@ -1834,20 +1846,20 @@ ChatMessagesListView - + chat_message_list_encrypted_header_title End to end encrypted chat - + chat_message_list_encrypted_header_message Les messages de cette conversation sont chiffrés de bout en bout. Seul votre correspondant peut les déchiffrer. - + chat_message_is_writing_info %1 is writing… @@ -4294,31 +4306,49 @@ Pour les activer dans un projet commercial, merci de nous contacter. SelectedChatView - + chat_view_send_area_placeholder_text Say something… : placeholder text for sending message text area - + chat_view_detail_other_actions_title Other actions - + + chat_view_detail_leave_room_toast_button + "Leave Chat Room" + + + + + chat_view_detail_leave_room_toast_title + Leave Chat Room ? + + + + + chat_view_detail_leave_room_toast_message + All the messages will be removed from the chat room. Do you want to continue ? + + + + chat_view_detail_delete_history_button "Delete history" - + chat_view_detail_delete_history_toast_title Delete history ? - + chat_view_detail_delete_history_toast_message All the messages will be removed from the chat room. Do you want to continue ? diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index 356eadb6..c5c5ca37 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -397,9 +397,9 @@ add_participant_selected_count 0 "%n participant(s) sélectionné(s)" - - 1 selected participant - %n selected participants + + %1 selected participant + %1 selected participants @@ -789,25 +789,25 @@ CallHistoryLayout - + meeting_info_join_title "Rejoindre la réunion" Join meeting - + contact_call_action "Appel" Call - + contact_message_action "Message" Message - + contact_video_call_action "Appel Video" Video call @@ -1412,8 +1412,8 @@ group_call_participant_selected - 1 selected participant - %n selected participants + %1 selected participant + %1 selected participants @@ -1674,13 +1674,13 @@ ChatCore - + info_toast_deleted_title Deleted Deleted - + info_toast_deleted_message_history Message history has been deleted Message history has been deleted @@ -1689,19 +1689,31 @@ ChatListView - + + chat_message_is_writing_info + %1 is writing… + %1 is writing… + + + + chat_message_draft_sending_text + Draft : %1 + Draft : %1 + + + chat_room_delete "Supprimer" Delete - + chat_list_delete_chat_popup_title Delete the chat ? Delete the chat ? - + chat_list_delete_chat_popup_message This chat and all its messages will be deleted. Do You want to continue ? This chat and all its messages will be deleted. Do You want to continue ? @@ -1710,25 +1722,25 @@ ChatMessage - + chat_message_copy "Copy" Copy - + chat_message_copied_to_clipboard_title Copied Copied - + chat_message_copied_to_clipboard_toast "to clipboard" in clipboard - + chat_message_delete "Delete" Delete @@ -1796,13 +1808,13 @@ ChatMessagesListView - + chat_message_list_encrypted_header_title End to end encrypted chat End to end encrypted chat - + chat_message_list_encrypted_header_message Les messages de cette conversation sont chiffrés de bout en bout. Seul votre correspondant peut les déchiffrer. @@ -1810,7 +1822,7 @@ Only your correspondent can decrypt them. - + chat_message_is_writing_info %1 is writing… %1 is writing… @@ -3453,8 +3465,8 @@ Only your correspondent can decrypt them. group_call_participant_selected "%n participant(s) sélectionné(s)" - 1 selected participant - %n selected participants + %1 selected participant + %1 selected participants @@ -4213,53 +4225,53 @@ To enable them in a commercial project, please contact us. Other actions - + chat_view_send_area_placeholder_text Say something… : placeholder text for sending message text area Say something… - + chat_view_detail_other_actions_title Other actions Other actions - + chat_view_detail_delete_history_button "Delete history" Delete history - + chat_view_detail_delete_history_toast_title Delete history ? Delete history ? - + chat_view_detail_delete_history_toast_message All the messages will be removed from the chat room. Do you want to continue ? All the messages will be removed from the chat room. Do you want to continue ? - - - chat_view_detail_leave_room_toast_button - "Leave chat room" - Leave chat room - - - - chat_view_detail_leave_room_toast_title - Leave chat room ? - Leave chat room ? - - - - chat_view_detail_leave_room_toast_message - You will not be able to send or receive messages in this room anymore, leave ? - You will not be able to send or receive messages in this room anymore, leave ? - + + + chat_view_detail_leave_room_toast_button + "Leave Chat Room" + Leave chat room + + + + chat_view_detail_leave_room_toast_title + Leave Chat Room ? + Leave chat room ? + + + + chat_view_detail_leave_room_toast_message + All the messages will be removed from the chat room. Do you want to continue ? + You will not be able to send or receive messages in this room anymore, leave ? + SettingsPage @@ -4450,7 +4462,7 @@ Failed to create 1-1 conversation with %1 ! %n an(s) one year - %n years + %1 years @@ -4459,7 +4471,7 @@ Failed to create 1-1 conversation with %1 ! "%n mois" one month - %n months + %1 months @@ -4468,7 +4480,7 @@ Failed to create 1-1 conversation with %1 ! %n semaine(s) one week - %n weeks + %1 weeks @@ -4477,7 +4489,7 @@ Failed to create 1-1 conversation with %1 ! %n jour(s) one day - %n days + %1 days diff --git a/Linphone/data/languages/fr_FR.ts b/Linphone/data/languages/fr_FR.ts index 95a26f5c..4d003ee9 100644 --- a/Linphone/data/languages/fr_FR.ts +++ b/Linphone/data/languages/fr_FR.ts @@ -397,7 +397,7 @@ add_participant_selected_count 0 "%n participant(s) sélectionné(s)" - + %1 participant sélectionné %1 participants sélectionnés @@ -789,25 +789,25 @@ CallHistoryLayout - + meeting_info_join_title "Rejoindre la réunion" Rejoindre la réunion - + contact_call_action "Appel" Appel - + contact_message_action "Message" Message - + contact_video_call_action "Appel Video" Appel Vidéo @@ -1684,13 +1684,13 @@ ChatCore - + info_toast_deleted_title Deleted Supprimé - + info_toast_deleted_message_history Message history has been deleted L'historique des messages a été supprimé @@ -1699,19 +1699,31 @@ ChatListView - + + chat_message_is_writing_info + %1 is writing… + %1 est en train d'écrire… + + + + chat_message_draft_sending_text + Draft : %1 + Brouillon : %1 + + + chat_room_delete "Supprimer" Supprimer - + chat_list_delete_chat_popup_title Delete the chat ? Supprimer la conversation ? - + chat_list_delete_chat_popup_message This chat and all its messages will be deleted. Do You want to continue ? La conversation et tous ses messages seront supprimés. Souhaitez-vous continuer ? @@ -1720,25 +1732,25 @@ ChatMessage - + chat_message_copy "Copy" Copier - + chat_message_copied_to_clipboard_title Copied Copié - + chat_message_copied_to_clipboard_toast "to clipboard" dans le presse-papiers - + chat_message_delete "Delete" Supprimer @@ -1806,13 +1818,13 @@ ChatMessagesListView - + chat_message_list_encrypted_header_title End to end encrypted chat Conversation chiffrée de bout en bout - + chat_message_list_encrypted_header_message Les messages de cette conversation sont chiffrés de bout en bout. Seul votre correspondant peut les déchiffrer. @@ -1820,7 +1832,7 @@ en bout. Seul votre correspondant peut les déchiffrer. - + chat_message_is_writing_info %1 is writing… %1 est en train d'écrire… @@ -4215,53 +4227,53 @@ Pour les activer dans un projet commercial, merci de nous contacter. SelectedChatView - + chat_view_send_area_placeholder_text Say something… : placeholder text for sending message text area Dites quelque chose… - + chat_view_detail_other_actions_title Other actions Autres actions - + chat_view_detail_delete_history_button "Delete history" Supprimer l'historique - + chat_view_detail_delete_history_toast_title Delete history ? Supprimer l'historique ? - + chat_view_detail_delete_history_toast_message All the messages will be removed from the chat room. Do you want to continue ? Tous les messages seront supprimés. Souhaitez-vous continuer ? - - - chat_view_detail_leave_room_toast_button - "Leave chat room" - Quitter la conversation - - - - chat_view_detail_leave_room_toast_title - Leave chat room ? - Quitter la conversation ? - - - - chat_view_detail_leave_room_toast_message - You will not be able to send or receive messages in this room anymore, leave ? - Vous ne recevrez ni pourrez envoyer des messages dans cette conversation, quitter ? - + + + chat_view_detail_leave_room_toast_button + "Leave Chat Room" + Quitter la conversation + + + + chat_view_detail_leave_room_toast_title + Leave Chat Room ? + Quitter la conversation ? + + + + chat_view_detail_leave_room_toast_message + All the messages will be removed from the chat room. Do you want to continue ? + Vous ne recevrez ni pourrez envoyer des messages dans cette conversation, quitter ? + SettingsPage diff --git a/Linphone/view/CMakeLists.txt b/Linphone/view/CMakeLists.txt index c80c266b..22bef91d 100644 --- a/Linphone/view/CMakeLists.txt +++ b/Linphone/view/CMakeLists.txt @@ -52,6 +52,7 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Control/Display/Call/CallListView.qml view/Control/Display/Call/CallHistoryListView.qml view/Control/Display/Call/CallStatistics.qml + view/Control/Display/Chat/Emoji/EmojiPicker.qml view/Control/Display/Chat/ChatListView.qml view/Control/Display/Chat/ChatMessage.qml view/Control/Display/Chat/ChatMessageInvitationBubble.qml @@ -65,7 +66,6 @@ list(APPEND _LINPHONEAPP_QML_FILES view/Control/Display/Contact/ContactListView.qml view/Control/Display/Contact/AllContactListView.qml view/Control/Display/Contact/Voicemail.qml - view/Control/Display/Conversation/Emoji/EmojiPicker.qml view/Control/Display/Meeting/MeetingListView.qml view/Control/Display/Participant/ParticipantDeviceListView.qml view/Control/Display/Participant/ParticipantListView.qml diff --git a/Linphone/view/Control/Button/PopupButton.qml b/Linphone/view/Control/Button/PopupButton.qml index a95876bc..f118f066 100644 --- a/Linphone/view/Control/Button/PopupButton.qml +++ b/Linphone/view/Control/Button/PopupButton.qml @@ -171,6 +171,7 @@ Button { } } + background: Item { anchors.fill: parent Rectangle { @@ -187,6 +188,9 @@ Button { shadowColor: DefaultStyle.grey_1000 shadowOpacity: 0.4 } + MouseArea{ + anchors.fill: parent + } } } } diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index a0fffcd6..727bd1b4 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -197,6 +197,7 @@ ListView { Text { Layout.fillWidth: true maximumLineCount: 1 + visible: !remoteComposingInfo.visible text: modelData.core.lastMessageText color: DefaultStyle.main2_400 font { @@ -204,7 +205,22 @@ ListView { weight: unreadCount.unread > 0 ? Typography.p2.weight : Typography.p1.weight } } - + Text { + id: remoteComposingInfo + visible: mainItem.currentIndex !== model.index && (modelData.core.composingName !== "" || modelData.core.sendingText !== "") + Layout.fillWidth: true + maximumLineCount: 1 + font { + pixelSize: Typography.p3.pixelSize + weight: Typography.p3.weight + } + //: %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) + : "" + } } ColumnLayout { Layout.alignment: Qt.AlignRight diff --git a/Linphone/view/Control/Display/Conversation/Emoji/EmojiPicker.qml b/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml similarity index 99% rename from Linphone/view/Control/Display/Conversation/Emoji/EmojiPicker.qml rename to Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml index cb80dd1d..93f0d8af 100644 --- a/Linphone/view/Control/Display/Conversation/Emoji/EmojiPicker.qml +++ b/Linphone/view/Control/Display/Chat/Emoji/EmojiPicker.qml @@ -170,7 +170,8 @@ ColumnLayout { property int columnCount: Math.round(list.width / 50 * DefaultStyle.dp) property int sc: grid.category === 'People & Body' ? mainItem.skinColor : -1 columns: columnCount - columnSpacing: Math.round(8 * DefaultStyle.dp) + width: list.width + columnSpacing: Math.round(5 * DefaultStyle.dp) Text { Layout.fillWidth: true Layout.preferredHeight: Math.round(20 * DefaultStyle.dp) diff --git a/Linphone/view/Control/Display/Contact/Contact.qml b/Linphone/view/Control/Display/Contact/Contact.qml index 937d6efb..6d8ce2b0 100644 --- a/Linphone/view/Control/Display/Contact/Contact.qml +++ b/Linphone/view/Control/Display/Contact/Contact.qml @@ -77,7 +77,9 @@ Control.Control{ smooth: false Layout.preferredWidth: 11 * DefaultStyle.dp Layout.preferredHeight: 11 * DefaultStyle.dp - source: presenceBar.isRegistered ? mainItem.account.core.presenceIcon : mainItem.account?.core.registrationStateIcon + source: presenceBar.isRegistered + ? mainItem.account.core.presenceIcon + : mainItem.account?.core.registrationStateIcon || "" Layout.leftMargin: 8 * DefaultStyle.dp } Text { @@ -110,7 +112,6 @@ Control.Control{ popup.contentItem: Rectangle { implicitWidth: 280 * DefaultStyle.dp implicitHeight: 20 * DefaultStyle.dp + (setCustomStatus.visible ? 240 * DefaultStyle.dp : setPresence.implicitHeight) - MouseArea{anchors.fill: parent} Presence { id: setPresence anchors.fill: parent diff --git a/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml b/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml index 56866c72..0d822ce1 100644 --- a/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml +++ b/Linphone/view/Control/Display/Contact/PresenceSetCustomStatus.qml @@ -5,7 +5,7 @@ import Linphone import SettingsCpp import 'qrc:/qt/qml/Linphone/view/Style/buttonStyle.js' as ButtonStyle -ColumnLayout { +Column { id: mainItem spacing: 20 * DefaultStyle.dp anchors.centerIn: parent diff --git a/Linphone/view/Control/Display/Conversation/ConversationListView.qml b/Linphone/view/Control/Display/Conversation/ConversationListView.qml deleted file mode 100644 index 088b8199..00000000 --- a/Linphone/view/Control/Display/Conversation/ConversationListView.qml +++ /dev/null @@ -1,247 +0,0 @@ -import QtQuick -import QtQuick.Effects -import QtQuick.Layouts -import QtQuick.Controls.Basic as Control -import Linphone -import UtilsCpp -import SettingsCpp -import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle -import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils - -ListView { - id: mainItem - clip: true - - property SearchBar searchBar - property bool loading: false - property string searchText: searchBar?.text - property real busyIndicatorSize: Math.round(60 * DefaultStyle.dp) - - signal resultsReceived - - onResultsReceived: { - loading = false - // contentY = 0 - } - - model: CallHistoryProxy { - id: callHistoryProxy - Component.onCompleted: { - loading = true - } - filterText: mainItem.searchText - onFilterTextChanged: maxDisplayItems = initialDisplayItems - initialDisplayItems: Math.max( - 20, - 2 * mainItem.height / (Math.round(56 * DefaultStyle.dp))) - displayItemsStep: 3 * initialDisplayItems / 2 - onModelReset: { - mainItem.resultsReceived() - } - } - flickDeceleration: 10000 - spacing: Math.round(10 * DefaultStyle.dp) - - Keys.onPressed: event => { - if (event.key == Qt.Key_Escape) { - console.log("Back") - searchBar.forceActiveFocus() - event.accepted = true - } - } - - Component.onCompleted: cacheBuffer = Math.max( - contentHeight, - 0) //contentHeight>0 ? contentHeight : 0// cache all items - // remove binding loop - onContentHeightChanged: Qt.callLater(function () { - if (mainItem) - mainItem.cacheBuffer = Math?.max(contentHeight, 0) || 0 - }) - - onActiveFocusChanged: if (activeFocus && currentIndex < 0 && count > 0) - currentIndex = 0 - onCountChanged: { - if (currentIndex < 0 && count > 0) { - mainItem.currentIndex = 0 // Select first item after loading model - } - if (atYBeginning) - positionViewAtBeginning() // Stay at beginning - } - Connections { - target: deleteHistoryPopup - function onAccepted() { - mainItem.model.removeAllEntries() - } - } - - onAtYEndChanged: { - if (atYEnd && count > 0) { - callHistoryProxy.displayMore() - } - } - //---------------------------------------------------------------- - function moveToCurrentItem() { - if (mainItem.currentIndex >= 0) - Utils.updatePosition(mainItem, mainItem) - } - onCurrentItemChanged: { - moveToCurrentItem() - } - // Update position only if we are moving to current item and its position is changing. - property var _currentItemY: currentItem?.y - on_CurrentItemYChanged: if (_currentItemY && moveAnimation.running) { - moveToCurrentItem() - } - Behavior on contentY { - NumberAnimation { - id: moveAnimation - duration: 500 - easing.type: Easing.OutExpo - alwaysRunToEnd: true - } - } - - //---------------------------------------------------------------- - onVisibleChanged: { -// if (!visible) -// currentIndex = -1 - } - - BusyIndicator { - anchors.horizontalCenter: mainItem.horizontalCenter - visible: mainItem.loading - height: visible ? mainItem.busyIndicatorSize : 0 - width: mainItem.busyIndicatorSize - indicatorHeight: mainItem.busyIndicatorSize - indicatorWidth: mainItem.busyIndicatorSize - indicatorColor: DefaultStyle.main1_500_main - } - - // Qt bug: sometimes, containsMouse may not be send and update on each MouseArea. - // So we need to use this variable to switch off all hovered items. - property int lastMouseContainsIndex: -1 - delegate: FocusScope { - width: mainItem.width - height: Math.round(56 * DefaultStyle.dp) - RowLayout { - z: 1 - anchors.fill: parent - anchors.leftMargin: Math.round(10 * DefaultStyle.dp) - spacing: Math.round(10 * DefaultStyle.dp) - Avatar { - id: historyAvatar - property var contactObj: UtilsCpp.findFriendByAddress( - modelData.core.remoteAddress) - contact: contactObj?.value || null - displayNameVal: modelData.core.displayName - secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified - width: Math.round(45 * DefaultStyle.dp) - height: Math.round(45 * DefaultStyle.dp) - isConference: modelData.core.isConference - shadowEnabled: false - asynchronous: false - } - ColumnLayout { - Layout.fillHeight: true - Layout.fillWidth: true - spacing: Math.round(5 * DefaultStyle.dp) - Text { - id: friendAddress - Layout.fillWidth: true - maximumLineCount: 1 - text: historyAvatar.displayNameVal - font { - pixelSize: Typography.p1.pixelSize - weight: Typography.p1.weight - capitalization: Font.Capitalize - } - } - RowLayout { - spacing: Math.round(6 * DefaultStyle.dp) - EffectImage { - id: statusIcon - imageSource: modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status - === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status === LinphoneEnums.CallStatus.EarlyAborted ? AppIcons.arrowElbow : modelData.core.isOutgoing ? AppIcons.arrowUpRight : AppIcons.arrowDownLeft - colorizationColor: modelData.core.status - === LinphoneEnums.CallStatus.Declined - || modelData.core.status - === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status - === LinphoneEnums.CallStatus.Aborted - || modelData.core.status - === LinphoneEnums.CallStatus.EarlyAborted - || modelData.core.status === LinphoneEnums.CallStatus.Missed ? DefaultStyle.danger_500main : modelData.core.isOutgoing ? DefaultStyle.info_500_main : DefaultStyle.success_500main - Layout.preferredWidth: Math.round(12 * DefaultStyle.dp) - Layout.preferredHeight: Math.round(12 * DefaultStyle.dp) - transform: Rotation { - angle: modelData.core.isOutgoing - && (modelData.core.status === LinphoneEnums.CallStatus.Declined - || modelData.core.status - === LinphoneEnums.CallStatus.DeclinedElsewhere - || modelData.core.status === LinphoneEnums.CallStatus.Aborted - || modelData.core.status - === LinphoneEnums.CallStatus.EarlyAborted) ? 180 : 0 - origin { - x: statusIcon.width / 2 - y: statusIcon.height / 2 - } - } - } - Text { - // text: modelData.core.date - text: UtilsCpp.formatDate(modelData.core.date) - font { - pixelSize: Math.round(12 * DefaultStyle.dp) - weight: Math.round(300 * DefaultStyle.dp) - } - } - } - } - BigButton { - style: ButtonStyle.noBackground - icon.source: AppIcons.phone - focus: true - activeFocusOnTab: false - asynchronous: false - onClicked: { - if (modelData.core.isConference) { - var callsWindow = UtilsCpp.getCallsWindow() - callsWindow.setupConference( - modelData.core.conferenceInfo) - UtilsCpp.smartShowWindow(callsWindow) - } else { - UtilsCpp.createCall(modelData.core.remoteAddress) - } - } - } - } - MouseArea { - hoverEnabled: true - anchors.fill: parent - focus: true - onContainsMouseChanged: { - if (containsMouse) - mainItem.lastMouseContainsIndex = index - else if (mainItem.lastMouseContainsIndex == index) - mainItem.lastMouseContainsIndex = -1 - } - Rectangle { - anchors.fill: parent - opacity: 0.7 - radius: Math.round(8 * DefaultStyle.dp) - color: mainItem.currentIndex - === index ? DefaultStyle.main2_200 : DefaultStyle.main2_100 - visible: mainItem.lastMouseContainsIndex === index - || mainItem.currentIndex === index - } - onPressed: { - mainItem.currentIndex = model.index - mainItem.forceActiveFocus() - } - } - } -} diff --git a/Linphone/view/Page/Form/Chat/SelectedChatView.qml b/Linphone/view/Page/Form/Chat/SelectedChatView.qml index 6e084ed4..6c4fbdab 100644 --- a/Linphone/view/Page/Form/Chat/SelectedChatView.qml +++ b/Linphone/view/Page/Form/Chat/SelectedChatView.qml @@ -101,6 +101,7 @@ RowLayout { visible: emojiPickerButton.checked closePolicy: Popup.CloseOnPressOutside onClosed: emojiPickerButton.checked = false + padding: 10 * DefaultStyle.dp background: Item { anchors.fill: parent Rectangle { @@ -234,13 +235,14 @@ RowLayout { } onCursorRectangleChanged: sendingAreaFlickable.ensureVisible(cursorRectangle) wrapMode: TextEdit.WordWrap - property string previousText - Component.onCompleted: previousText = text + Component.onCompleted: { + if (mainItem.chat) text = mainItem.chat.core.sendingText + } onTextChanged: { - if (previousText === "" && text !== "") { + if (text !== "" && mainItem.chat.core.composingName !== "") { mainItem.chat.core.lCompose() } - previousText = text + mainItem.chat.core.sendingText = text } Keys.onPressed: (event) => { event.accepted = false