From afc03daa226f53fb6ed13cb8aa6b9daedfb25f83 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Fri, 7 Nov 2025 15:40:38 +0100 Subject: [PATCH] fix admin rights modification #LINQT-2114 --- Linphone/core/chat/ChatCore.cpp | 16 +++++++++------ Linphone/data/languages/de.ts | 20 +++++++++---------- Linphone/data/languages/en.ts | 20 +++++++++---------- Linphone/data/languages/fr.ts | 20 +++++++++---------- Linphone/view/Control/Button/Button.qml | 2 +- .../Layout/Chat/GroupChatInfoParticipants.qml | 12 +++++------ 6 files changed, 46 insertions(+), 44 deletions(-) diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 30547bb63..8a8365940 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -362,12 +362,16 @@ void ChatCore::setSelf(QSharedPointer me) { auto participants = buildParticipants(chatRoom); mChatModelConnection->invokeToCore([this, participants]() { setParticipants(participants); }); }); - mChatModelConnection->makeConnectToModel( - &ChatModel::participantAdminStatusChanged, [this](const std::shared_ptr &chatRoom, - const std::shared_ptr &eventLog) { - auto participants = buildParticipants(chatRoom); - mChatModelConnection->invokeToCore([this, participants]() { setParticipants(participants); }); - }); + mChatModelConnection->makeConnectToModel(&ChatModel::participantAdminStatusChanged, + [this](const std::shared_ptr &chatRoom, + const std::shared_ptr &eventLog) { + auto participants = buildParticipants(chatRoom); + bool meAdmin = chatRoom->getMe()->isAdmin(); + mChatModelConnection->invokeToCore([this, participants, meAdmin]() { + setParticipants(participants); + setMeAdmin(meAdmin); + }); + }); mChatModelConnection->makeConnectToCore(&ChatCore::lRemoveParticipantAtIndex, [this](int index) { mChatModelConnection->invokeToModel([this, index]() { mChatModel->removeParticipantAtIndex(index); }); }); diff --git a/Linphone/data/languages/de.ts b/Linphone/data/languages/de.ts index 5177784de..6f0f67d73 100644 --- a/Linphone/data/languages/de.ts +++ b/Linphone/data/languages/de.ts @@ -3849,55 +3849,55 @@ Error GroupChatInfoParticipants - + group_infos_participant_is_admin Admin - + group_infos_manage_participants_title "Gérer des participants" Manage Participants - + menu_see_existing_contact "Show contact" Kontakt anzeigen - + menu_add_address_to_contacts "Add to contacts" Zu Kontakten hinzufügen - + group_infos_give_admin_rights Give admin rights - + group_infos_remove_admin_rights Remove admin rights - + group_infos_copy_sip_address Copy SIP Address - + group_infos_remove_participant Remove participant - + group_infos_remove_participants_toast_title Remove participant ? - + group_infos_remove_participants_toast_message Participant will be removed from chat room. diff --git a/Linphone/data/languages/en.ts b/Linphone/data/languages/en.ts index df289fb95..ccf93ae5d 100644 --- a/Linphone/data/languages/en.ts +++ b/Linphone/data/languages/en.ts @@ -3770,55 +3770,55 @@ Expiration : %1 GroupChatInfoParticipants - + group_infos_manage_participants_title "Gérer des participants" Manage participants - + group_infos_participant_is_admin Admin - + menu_see_existing_contact "Show contact" Show contact - + menu_add_address_to_contacts "Add to contacts" Add to contacts - + group_infos_give_admin_rights Give admin rights - + group_infos_remove_admin_rights Remove admin rights - + group_infos_copy_sip_address Copy SIP Address - + group_infos_remove_participant Remove participant - + group_infos_remove_participants_toast_title Remove participant ? - + group_infos_remove_participants_toast_message Participant will be removed from chat room. diff --git a/Linphone/data/languages/fr.ts b/Linphone/data/languages/fr.ts index 4a8db8600..5bf22ecfa 100644 --- a/Linphone/data/languages/fr.ts +++ b/Linphone/data/languages/fr.ts @@ -3770,55 +3770,55 @@ Expiration : %1 GroupChatInfoParticipants - + group_infos_manage_participants_title "Gérer des participants" Gérer les participants - + group_infos_participant_is_admin Admin - + menu_see_existing_contact "Show contact" Voir le contact - + menu_add_address_to_contacts "Add to contacts" Ajouter aux contacts - + group_infos_give_admin_rights Donner les droits admins - + group_infos_remove_admin_rights Retirer les droits admins - + group_infos_copy_sip_address Copier l’adresse SIP - + group_infos_remove_participant Retirer le participant - + group_infos_remove_participants_toast_title Retirer le participant ? - + group_infos_remove_participants_toast_message La participant sere retiré de la conversation diff --git a/Linphone/view/Control/Button/Button.qml b/Linphone/view/Control/Button/Button.qml index 6552f67bc..a93c138b0 100644 --- a/Linphone/view/Control/Button/Button.qml +++ b/Linphone/view/Control/Button/Button.qml @@ -52,7 +52,7 @@ Control.Button { property real keyboardFocusedBorderWidth: Utils.getSizeWithScreenRatio(3) // Image properties property var contentImageColor: style?.image? style.image.normal : DefaultStyle.main2_600 - property var hoveredImageColor: style?.image? style.image.pressed : Qt.darker(contentImageColor, 1.05) + property var hoveredImageColor: style?.image? style.image.hovered : Qt.darker(contentImageColor, 1.05) property var checkedImageColor: style?.image? style.image.checked : Qt.darker(contentImageColor, 1.1) property var pressedImageColor: style?.image? style.image.pressed : Qt.darker(contentImageColor, 1.1) icon.source: style?.iconSource || "" diff --git a/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml b/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml index 8eb72692e..ad50a401e 100644 --- a/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml +++ b/Linphone/view/Page/Layout/Chat/GroupChatInfoParticipants.qml @@ -18,9 +18,7 @@ ColumnLayout { property var chatCore signal manageParticipantsRequested() - function isGroupEditable() { - return chatCore && chatCore.meAdmin && !chatCore.isReadOnly - } + property bool isGroupEditable: chatCore && chatCore.meAdmin && !chatCore.isReadOnly RowLayout { Text { @@ -139,7 +137,7 @@ ColumnLayout { } } IconLabelButton { - visible: mainItem.isGroupEditable() + visible: mainItem.isGroupEditable Layout.fillWidth: true text: participantCore.isAdmin ? qsTr("group_infos_remove_admin_rights") : qsTr("group_infos_give_admin_rights") icon.source: AppIcons.profile @@ -163,7 +161,7 @@ ColumnLayout { } } Rectangle { - visible: mainItem.isGroupEditable() + visible: mainItem.isGroupEditable color: DefaultStyle.main2_200 Layout.fillWidth: true height: Utils.getSizeWithScreenRatio(1) @@ -171,7 +169,7 @@ ColumnLayout { Layout.leftMargin: Utils.getSizeWithScreenRatio(17) } IconLabelButton { - visible: mainItem.isGroupEditable() + visible: mainItem.isGroupEditable Layout.fillWidth: true text: qsTr("group_infos_remove_participant") icon.source: AppIcons.trashCan @@ -199,7 +197,7 @@ ColumnLayout { MediumButton { id: manageParticipants - visible: mainItem.isGroupEditable() + visible: mainItem.isGroupEditable height: Utils.getSizeWithScreenRatio(40) icon.source: AppIcons.plusCircle icon.width: Utils.getSizeWithScreenRatio(16)