From e113058ae90753916a89bc3d6b7b410a8638cd64 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Fri, 14 Nov 2025 10:38:57 +0100 Subject: [PATCH] hide group call button if no videoconference uri set avoid displaying more messages when the list is not yet initialized fix meeting form end hour combobox list display #LINQT-2127 check if at least one participant when creating group chat #LINQT-2134 display all the errors at a time if they all occur #LINQT-2133 add signal to add chat to list when state Created #LINQT-2131 fix chat deletion --- Linphone/core/chat/ChatList.cpp | 29 ++++++- Linphone/core/chat/ChatList.hpp | 5 +- Linphone/core/chat/ChatProxy.cpp | 4 + Linphone/core/chat/ChatProxy.hpp | 2 + Linphone/data/languages/de.ts | 78 ++++++++++--------- Linphone/data/languages/en.ts | 78 ++++++++++--------- Linphone/data/languages/fr.ts | 78 ++++++++++--------- Linphone/model/tool/ToolModel.cpp | 1 + Linphone/tool/Utils.cpp | 4 +- Linphone/tool/Utils.hpp | 2 +- .../Control/Container/CreationFormLayout.qml | 2 + .../view/Control/Container/FormItemLayout.qml | 7 ++ .../Container/GroupCreationFormLayout.qml | 39 ++++------ .../Control/Display/Chat/ChatListView.qml | 11 +-- .../Display/Chat/ChatMessagesListView.qml | 5 +- Linphone/view/Page/Form/Call/NewCallForm.qml | 1 + Linphone/view/Page/Main/Chat/ChatPage.qml | 33 ++++---- 17 files changed, 220 insertions(+), 159 deletions(-) diff --git a/Linphone/core/chat/ChatList.cpp b/Linphone/core/chat/ChatList.cpp index ba0fbc84..69878049 100644 --- a/Linphone/core/chat/ChatList.cpp +++ b/Linphone/core/chat/ChatList.cpp @@ -167,6 +167,30 @@ void ChatList::setSelf(QSharedPointer me) { addChatToList(core, room, message); }); + mModelConnection->makeConnectToModel( + &CoreModel::chatRoomStateChanged, + [this](const std::shared_ptr &core, const std::shared_ptr &chatRoom, + linphone::ChatRoom::State state) { + auto chatRoomAccount = chatRoom->getAccount(); + auto currentAccount = CoreModel::getInstance()->getCore()->getDefaultAccount(); + if (!chatRoomAccount || !currentAccount || !chatRoomAccount->getParams() || !currentAccount->getParams() || + !chatRoomAccount->getParams()->getIdentityAddress()->weakEqual( + currentAccount->getParams()->getIdentityAddress())) { + lInfo() << "ChatRoom state of another account changed, return"; + return; + } + if (chatRoom->getState() == linphone::ChatRoom::State::Created) { + lInfo() << "ChatRoom created, add it to the list" << chatRoom.get(); + auto chatCore = ChatCore::create(chatRoom); + mModelConnection->invokeToCore([this, chatCore] { + if (chatCore) { + bool added = addChatInList(chatCore); + if (added) emit chatCreated(new ChatGui(chatCore)); + } + }); + } + }); + connect(this, &ChatList::filterChanged, [this](QString filter) { mFilter = filter; lUpdate(); @@ -184,7 +208,8 @@ int ChatList::findChatIndex(ChatGui *chatGui) { return it == chatList.end() ? -1 : std::distance(chatList.begin(), it); } -void ChatList::addChatInList(QSharedPointer chatCore) { +bool ChatList::addChatInList(QSharedPointer chatCore) { + mustBeInMainThread(log().arg(Q_FUNC_INFO)); auto chatList = getSharedList(); auto it = std::find_if(chatList.begin(), chatList.end(), [chatCore](const QSharedPointer item) { return item && chatCore && item->getModel() && chatCore->getModel() && @@ -193,8 +218,10 @@ void ChatList::addChatInList(QSharedPointer chatCore) { if (it == chatList.end()) { connectItem(chatCore); add(chatCore); + return true; emit chatAdded(); } + return false; } QVariant ChatList::data(const QModelIndex &index, int role) const { diff --git a/Linphone/core/chat/ChatList.hpp b/Linphone/core/chat/ChatList.hpp index 335e06a2..6757e615 100644 --- a/Linphone/core/chat/ChatList.hpp +++ b/Linphone/core/chat/ChatList.hpp @@ -42,7 +42,7 @@ public: void connectItem(QSharedPointer chat); int findChatIndex(ChatGui *chat); - void addChatInList(QSharedPointer chatCore); + bool addChatInList(QSharedPointer chatCore); virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; signals: @@ -50,6 +50,9 @@ signals: void filterChanged(QString filter); void chatAdded(); void chatUpdated(); + // emit this signal to force selection when + // newly created chat added to the list + void chatCreated(ChatGui *chatGui); private: QString mFilter; diff --git a/Linphone/core/chat/ChatProxy.cpp b/Linphone/core/chat/ChatProxy.cpp index 9b34f3e1..87778d97 100644 --- a/Linphone/core/chat/ChatProxy.cpp +++ b/Linphone/core/chat/ChatProxy.cpp @@ -46,6 +46,10 @@ void ChatProxy::setSourceModel(QAbstractItemModel *model) { connect(this, &ChatProxy::filterTextChanged, newChatList, [this, newChatList] { emit newChatList->filterChanged(getFilterText()); }); connect(newChatList, &ChatList::chatAdded, this, [this] { invalidate(); }); + connect(newChatList, &ChatList::chatCreated, this, [this](ChatGui *chatGui) { + invalidate(); + emit chatCreated(chatGui); + }); connect(newChatList, &ChatList::dataChanged, this, [this] { invalidate(); }); } auto firstList = new SortFilterList(model, Qt::AscendingOrder); diff --git a/Linphone/core/chat/ChatProxy.hpp b/Linphone/core/chat/ChatProxy.hpp index c90548f3..f15ae999 100644 --- a/Linphone/core/chat/ChatProxy.hpp +++ b/Linphone/core/chat/ChatProxy.hpp @@ -41,6 +41,8 @@ public: Q_INVOKABLE int findChatIndex(ChatGui *chatGui); Q_INVOKABLE void addChatInList(ChatGui *chatGui); +signals: + void chatCreated(ChatGui *chatGui); protected: QSharedPointer mList; diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index f372462b..a4faeb69 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -2112,65 +2112,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… - + chat_message_draft_sending_text - + chat_room_delete "Delete" Löschen - + chat_room_mute - + chat_room_unmute "Mute" - + chat_room_mark_as_read "Mark as read" - + chat_room_leave "leave" - + chat_list_leave_chat_popup_title leave the conversation ? - + chat_list_leave_chat_popup_message You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? - + chat_list_delete_chat_popup_title Delete the conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? @@ -2453,58 +2453,58 @@ Error ChatMessagesListView - - + + popup_info_find_message_title Find message - + info_popup_no_result_message No result found - + info_popup_first_result_message First result reached - + info_popup_last_result_message Last result reached - + chat_message_list_encrypted_header_title End to end encrypted chat - + unencrypted_conversation_warning This conversation is not encrypted ! - + chat_message_list_encrypted_header_message Messages in this conversation are e2e encrypted. Only your correspondent can decrypt them. - + chat_message_list_not_encrypted_header_message Messages are not end to end encrypted, may sure you don't share any sensitive information ! - + chat_message_is_writing_info %1 is writing… @@ -2567,32 +2567,32 @@ Error - + chat_action_start_new_chat "New chat" - + chat_start_group_chat_title "Nouveau groupe" - + chat_action_start_group_chat "Créer" Erstellen - - - + + + information_popup_error_title Fehler - + information_popup_chat_creation_failed_message "La création a échoué" @@ -2603,19 +2603,25 @@ Error Der Codec konnte nicht installiert werden. - + group_chat_error_must_have_name "Un nom doit être donné au groupe - + + group_chat_error_no_participant + "Please select at least one participant + + + + group_call_error_not_connected "Vous n'etes pas connecté" Sie sind nicht verbunden - + chat_creation_in_progress Creation de la conversation en cours … @@ -3543,7 +3549,7 @@ Error CreationFormLayout - + search_bar_look_for_contact_text "Rechercher un contact" Kontakt suchen @@ -3930,20 +3936,20 @@ Error Gruppenname - + return_accessible_name Return - + group_start_dialog_subject_hint "Nom du groupe" Gruppenname - + required "Requis" Erforderlich @@ -4955,7 +4961,7 @@ Error NewCallForm - + call_transfer_active_calls_label "Appels en cours" Laufender Anruf diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index a1d78f47..fb7df779 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -2089,65 +2089,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… %1 is writing… - + chat_message_draft_sending_text Draft : %1 - + chat_room_delete "Delete" Delete - + chat_room_mute Mute - + chat_room_unmute "Mute" Unmute - + chat_room_mark_as_read "Mark as read" Mark as read - + chat_room_leave "leave" Leave - + chat_list_leave_chat_popup_title leave the conversation ? Leave the conversation ? - + chat_list_leave_chat_popup_message You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? - + chat_list_delete_chat_popup_title Delete the conversation ? Delete the conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? This conversation and all its messages will be deleted. Do You want to continue ? @@ -2425,44 +2425,44 @@ Error ChatMessagesListView - - + + popup_info_find_message_title Find message Find message - + info_popup_no_result_message No result found No result found - + info_popup_first_result_message First result reached First result reached - + info_popup_last_result_message Last result reached Last result reached - + chat_message_list_encrypted_header_title End to end encrypted chat End to end encrypted chat - + unencrypted_conversation_warning This conversation is not encrypted ! This conversation is not encrypted ! - + chat_message_list_encrypted_header_message Messages in this conversation are e2e encrypted. Only your correspondent can decrypt them. @@ -2470,7 +2470,7 @@ Error Only your correspondent can decrypt them. - + chat_message_list_not_encrypted_header_message Messages are not end to end encrypted, may sure you don't share any sensitive information ! @@ -2478,7 +2478,7 @@ Only your correspondent can decrypt them. may sure you don't share any sensitive information ! - + chat_message_is_writing_info %1 is writing… %1 is writing… @@ -2541,50 +2541,56 @@ Only your correspondent can decrypt them. No conversation in history - + chat_action_start_new_chat "New chat" New conversation - + chat_start_group_chat_title "Nouveau groupe" New group - + chat_action_start_group_chat "Créer" Create - - - + + + information_popup_error_title Error - + information_popup_chat_creation_failed_message "La création a échoué" Creation failed - + group_chat_error_must_have_name "Un nom doit être donné au groupe A name must be set for the group - + + group_chat_error_no_participant + "Please select at least one participant + Please select at least one participant + + + group_call_error_not_connected "Vous n'etes pas connecté" You are not connected - + chat_creation_in_progress Creation de la conversation en cours … Chat creation pending… @@ -3462,7 +3468,7 @@ Only your correspondent can decrypt them. CreationFormLayout - + search_bar_look_for_contact_text "Rechercher un contact" Find contact @@ -3846,20 +3852,20 @@ Expiration : %1 GroupCreationFormLayout - + return_accessible_name Return Return - + group_start_dialog_subject_hint "Nom du groupe" Group name - + required "Requis" Required @@ -4867,7 +4873,7 @@ Expiration : %1 NewCallForm - + call_transfer_active_calls_label "Appels en cours" Ongoing call diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index 42d98aa1..232c0d1c 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -2089,65 +2089,65 @@ ChatListView - + chat_message_is_writing_info %1 is writing… %1 est en train d'écrire… - + chat_message_draft_sending_text Brouillon : %1 - + chat_room_delete "Delete" Supprimer - + chat_room_mute Mettre en sourdine - + chat_room_unmute "Mute" Enlever la sourdine - + chat_room_mark_as_read "Mark as read" Marquer comme lu - + chat_room_leave "leave" Quitter la conversation - + chat_list_leave_chat_popup_title leave the conversation ? Quitter la conversation ? - + chat_list_leave_chat_popup_message You will not be able to send or receive messages in this conversation anymore. Do You want to continue ? Vous ne pourrez plus envoyer ou recevoir de messages dans cette conversation. Souhaitez-vous continuer ? - + chat_list_delete_chat_popup_title Delete the conversation ? Supprimer la conversation ? - + chat_list_delete_chat_popup_message This conversation and all its messages will be deleted. Do You want to continue ? La conversation et tous ses messages seront supprimés. Souhaitez-vous continuer ? @@ -2425,44 +2425,44 @@ Error ChatMessagesListView - - + + popup_info_find_message_title Find message Trouver un message - + info_popup_no_result_message No result found Aucun résultat trouvé - + info_popup_first_result_message First result reached Premier résultat atteint - + info_popup_last_result_message Last result reached Dernier résultat atteint - + chat_message_list_encrypted_header_title End to end encrypted chat Conversation chiffrée de bout en bout - + unencrypted_conversation_warning This conversation is not encrypted ! Cette conversation n'est pas chiffrée ! - + chat_message_list_encrypted_header_message Messages in this conversation are e2e encrypted. Only your correspondent can decrypt them. @@ -2470,7 +2470,7 @@ Error en bout. Seul votre correspondant peut les déchiffrer. - + chat_message_list_not_encrypted_header_message Messages are not end to end encrypted, may sure you don't share any sensitive information ! @@ -2478,7 +2478,7 @@ en bout. Seul votre correspondant peut les déchiffrer. assurez-vous de ne pas partager d’informations sensibles ! - + chat_message_is_writing_info %1 is writing… %1 est en train d'écrire… @@ -2541,50 +2541,56 @@ en bout. Seul votre correspondant peut les déchiffrer. Aucune conversation dans votre historique - + chat_action_start_new_chat "New chat" Nouvelle conversation - + chat_start_group_chat_title "Nouveau groupe" Nouveau groupe - + chat_action_start_group_chat "Créer" Créer - - - + + + information_popup_error_title Erreur - + information_popup_chat_creation_failed_message "La création a échoué" La création a échoué - + group_chat_error_must_have_name "Un nom doit être donné au groupe Un nom doit être donné au groupe - + + group_chat_error_no_participant + "Please select at least one participant + Veuillez sélectionner au moins un participant + + + group_call_error_not_connected "Vous n'etes pas connecté" Vous n'êtes pas connecté - + chat_creation_in_progress Creation de la conversation en cours … Création de la conversation en cours… @@ -3462,7 +3468,7 @@ en bout. Seul votre correspondant peut les déchiffrer. CreationFormLayout - + search_bar_look_for_contact_text "Rechercher un contact" Rechercher un contact @@ -3846,20 +3852,20 @@ Expiration : %1 GroupCreationFormLayout - + return_accessible_name Return Retour - + group_start_dialog_subject_hint "Nom du groupe" Nom du groupe - + required "Requis" Requis @@ -4867,7 +4873,7 @@ Expiration : %1 NewCallForm - + call_transfer_active_calls_label "Appels en cours" Appels en cours diff --git a/Linphone/model/tool/ToolModel.cpp b/Linphone/model/tool/ToolModel.cpp index c21c8bbd..2ce9478e 100644 --- a/Linphone/model/tool/ToolModel.cpp +++ b/Linphone/model/tool/ToolModel.cpp @@ -760,6 +760,7 @@ ToolModel::createGroupChatRoom(QString subject, std::listgetParams(); auto chatRoom = core->createChatRoom(params, participantsAddresses); + if (!chatRoom) lWarning() << ("[ToolModel] Failed to create group chat"); return chatRoom; } diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index 77bec472..efbdd42c 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -1435,9 +1435,9 @@ QDateTime Utils::addYears(QDateTime date, int years) { return date; } -int Utils::timeOffset(QDateTime start, QDateTime end) { +int Utils::timeOffset(QTime start, QTime end) { int offset = start.secsTo(end); - return std::min(offset, INT_MAX); + return std::max(std::min(offset, INT_MAX), INT_MIN); } int Utils::daysOffset(QDateTime start, QDateTime end) { diff --git a/Linphone/tool/Utils.hpp b/Linphone/tool/Utils.hpp index 7b8f1ea6..23839f87 100644 --- a/Linphone/tool/Utils.hpp +++ b/Linphone/tool/Utils.hpp @@ -126,7 +126,7 @@ public: Q_INVOKABLE static int secsTo(const QString &start, const QString &end); Q_INVOKABLE static QDateTime addSecs(QDateTime date, int secs); Q_INVOKABLE static QDateTime addYears(QDateTime date, int years); - Q_INVOKABLE static int timeOffset(QDateTime start, QDateTime end); + Q_INVOKABLE static int timeOffset(QTime start, QTime end); Q_INVOKABLE static int daysOffset(QDateTime start, QDateTime end); Q_INVOKABLE static VariantObject *interpretUrl(QString uri); Q_INVOKABLE static bool isValidURL(const QString &url); diff --git a/Linphone/view/Control/Container/CreationFormLayout.qml b/Linphone/view/Control/Container/CreationFormLayout.qml index 8fbcbd28..d93454cf 100644 --- a/Linphone/view/Control/Container/CreationFormLayout.qml +++ b/Linphone/view/Control/Container/CreationFormLayout.qml @@ -14,6 +14,7 @@ FocusScope { property color searchBarBorderColor: "transparent" property alias searchBar: searchBar property string startGroupButtonText + property bool startGroupButtonVisible: true property NumericPadPopup numPadPopup signal groupCreationRequested() signal contactClicked(FriendGui contact) @@ -52,6 +53,7 @@ FocusScope { spacing: Utils.getSizeWithScreenRatio(32) Button { id: groupCreationButton + visible: mainItem.startGroupButtonVisible Layout.preferredWidth: Utils.getSizeWithScreenRatio(320) Layout.preferredHeight: Utils.getSizeWithScreenRatio(44) padding: 0 diff --git a/Linphone/view/Control/Container/FormItemLayout.qml b/Linphone/view/Control/Container/FormItemLayout.qml index 090581ce..fceaf129 100644 --- a/Linphone/view/Control/Container/FormItemLayout.qml +++ b/Linphone/view/Control/Container/FormItemLayout.qml @@ -9,6 +9,7 @@ FocusScope{ id: mainItem property alias contentItem: contentItem.data property string label: "" + property string labelIndication property string tooltip: "" property bool mandatory: false @@ -73,6 +74,12 @@ FocusScope{ text: mainItem.tooltip } } + Text { + visible: mainItem.labelIndication !== undefined + font.pixelSize: Utils.getSizeWithScreenRatio(12) + font.weight: Utils.getSizeWithScreenRatio(300) + text: mainItem.labelIndication + } } Item { diff --git a/Linphone/view/Control/Container/GroupCreationFormLayout.qml b/Linphone/view/Control/Container/GroupCreationFormLayout.qml index bd01db9c..e2c1c80d 100644 --- a/Linphone/view/Control/Container/GroupCreationFormLayout.qml +++ b/Linphone/view/Control/Container/GroupCreationFormLayout.qml @@ -12,6 +12,7 @@ import "qrc:/qt/qml/Linphone/view/Style/buttonStyle.js" as ButtonStyle FocusScope { id: mainItem property alias addParticipantsLayout: addParticipantsLayout + property alias groupNameItem: groupNameItem property alias groupName: groupName property string formTitle property string createGroupButtonText @@ -65,34 +66,24 @@ FocusScope { } } } - RowLayout { - spacing: 0 + FormItemLayout { + id: groupNameItem + enableErrorText: true + Layout.fillWidth: true Layout.topMargin: Utils.getSizeWithScreenRatio(18) Layout.rightMargin: Utils.getSizeWithScreenRatio(38) - Text { - font.pixelSize: Typography.p2.pixelSize - font.weight: Typography.p2.weight - //: "Nom du groupe" - text: qsTr("group_start_dialog_subject_hint") - } - Item { + //: "Nom du groupe" + label: qsTr("group_start_dialog_subject_hint") + //: "Requis" + labelIndication: qsTr("required") + contentItem: TextField { + id: groupName Layout.fillWidth: true + Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) + focus: true + KeyNavigation.down: addParticipantsLayout //participantList.count > 0 ? participantList : searchbar + Accessible.name: qsTr("group_start_dialog_subject_hint") } - Text { - font.pixelSize: Utils.getSizeWithScreenRatio(12) - font.weight: Utils.getSizeWithScreenRatio(300) - //: "Requis" - text: qsTr("required") - } - } - TextField { - id: groupName - Layout.fillWidth: true - Layout.rightMargin: Utils.getSizeWithScreenRatio(38) - Layout.preferredHeight: Utils.getSizeWithScreenRatio(49) - focus: true - KeyNavigation.down: addParticipantsLayout //participantList.count > 0 ? participantList : searchbar - Accessible.name: qsTr("group_start_dialog_subject_hint") } AddParticipantsForm { id: addParticipantsLayout diff --git a/Linphone/view/Control/Display/Chat/ChatListView.qml b/Linphone/view/Control/Display/Chat/ChatListView.qml index 46fca2b8..8009ed15 100644 --- a/Linphone/view/Control/Display/Chat/ChatListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatListView.qml @@ -60,6 +60,9 @@ ListView { onLayoutChanged: { selectChat(mainItem.currentChatGui) } + onChatCreated: (chat) => { + selectChat(chat) + } } // flickDeceleration: 10000 spacing: Utils.getSizeWithScreenRatio(10) @@ -67,14 +70,6 @@ ListView { function selectChat(chatGui) { var index = chatProxy.findChatIndex(chatGui) mainItem.currentIndex = index - // if the chat exists, it may not be displayed - // in list if hide_empty_chatrooms is set. Thus, we need - // to force adding it in the list so it is displayed - if (index === -1 && chatGui) { - chatProxy.addChatInList(chatGui) - var index = chatProxy.findChatIndex(chatGui) - mainItem.currentIndex = index - } } Component.onCompleted: cacheBuffer = Math.max(contentHeight, 0) //contentHeight>0 ? contentHeight : 0// cache all items diff --git a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml index 38fbfebe..05acbf86 100644 --- a/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml +++ b/Linphone/view/Control/Display/Chat/ChatMessagesListView.qml @@ -73,7 +73,10 @@ ListView { onAtYEndChanged: if (atYEnd && chat) { chat.core.lMarkAsRead() } - onAtYBeginningChanged: if (atYBeginning) { + // Workaround : check if there is already items in the list + // so this function is only called when the user actually scroll + // the view till the begining + onAtYBeginningChanged: if (atYBeginning && count !== 0) { eventLogProxy.displayMore() } diff --git a/Linphone/view/Page/Form/Call/NewCallForm.qml b/Linphone/view/Page/Form/Call/NewCallForm.qml index 8af410ca..29801021 100644 --- a/Linphone/view/Page/Form/Call/NewCallForm.qml +++ b/Linphone/view/Page/Form/Call/NewCallForm.qml @@ -15,6 +15,7 @@ CreationFormLayout { //: Appel de groupe startGroupButtonText: qsTr("call_start_group_call_title") + startGroupButtonVisible: !SettingsCpp.disableMeetingsFeature topLayoutVisible: mainItem.displayCurrentCalls && callList.count > 0 topContent: [ diff --git a/Linphone/view/Page/Main/Chat/ChatPage.qml b/Linphone/view/Page/Main/Chat/ChatPage.qml index b2c3e882..c1db2778 100644 --- a/Linphone/view/Page/Main/Chat/ChatPage.qml +++ b/Linphone/view/Page/Main/Chat/ChatPage.qml @@ -198,8 +198,8 @@ AbstractMainPage { Connections { target: mainItem - function onSelectedChatGuiChanged() { - chatListView.selectChat(mainItem.selectedChatGui) + function onRemoteChatChanged() { + if (mainItem.remoteChat) chatListView.chatToSelect = mainItem.remoteChat } function onOpenChatRequested(chat) { chatListView.chatToSelect = chat @@ -322,22 +322,29 @@ AbstractMainPage { } onGroupCreationRequested: { + var hasError = false if (groupName.text.length === 0) { + //: "Un nom doit être donné au groupe + groupNameItem.errorMessage = qsTr("group_chat_error_must_have_name") + hasError = true + } if (addParticipantsLayout.selectedParticipantsCount === 0) { UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), - //: "Un nom doit être donné au groupe - qsTr("group_chat_error_must_have_name"), false) - } else if (!mainItem.isRegistered) { + //: "Please select at least one participant + qsTr("group_chat_error_no_participant"), false) + hasError = true + } if (!mainItem.isRegistered) { UtilsCpp.showInformationPopup(qsTr("information_popup_error_title"), //: "Vous n'etes pas connecté" qsTr("group_call_error_not_connected"), false) - } else { - console.log("create group chat") - //: Creation de la conversation en cours … - mainWindow.showLoadingPopup(qsTr("chat_creation_in_progress"), true, function () { - if (chatCreationLayout.groupChat) chatCreationLayout.groupChat.core.lDelete() - }) - chatCreationLayout.groupChatObj = UtilsCpp.createGroupChat(chatCreationLayout.groupName.text, addParticipantsLayout.selectedParticipants) - } + hasError = true + } + if (hasError) return + console.log("Create group chat") + //: Creation de la conversation en cours … + mainWindow.showLoadingPopup(qsTr("chat_creation_in_progress"), true, function () { + if (chatCreationLayout.groupChat) chatCreationLayout.groupChat.core.lDelete() + }) + chatCreationLayout.groupChatObj = UtilsCpp.createGroupChat(chatCreationLayout.groupName.text, addParticipantsLayout.selectedParticipants) } } }