diff --git a/Linphone/tool/Utils.cpp b/Linphone/tool/Utils.cpp index 79e192b7a..c0a6e50be 100644 --- a/Linphone/tool/Utils.cpp +++ b/Linphone/tool/Utils.cpp @@ -466,6 +466,25 @@ VariantObject *Utils::findFriendByAddress(const QString &address) { return data; } +VariantObject *Utils::getFriendSecurityLevel(const QString &address) { + VariantObject *data = new VariantObject("getFriendAddressSecurityLevel"); + if (!data) return nullptr; + data->makeRequest([address]() { + auto defaultFriendList = ToolModel::getAppFriendList(); + if (!defaultFriendList) return QVariant(); + auto linphoneAddr = ToolModel::interpretUrl(address); + auto linFriend = CoreModel::getInstance()->getCore()->findFriend(linphoneAddr); + if (!linFriend) return QVariant(); + auto linAddr = ToolModel::interpretUrl(address); + if (!linAddr) return QVariant(); + auto devices = linFriend->getDevicesForAddress(linphoneAddr); + int verified = 0; + return QVariant::fromValue(LinphoneEnums::fromLinphone(linFriend->getSecurityLevel())); + }); + data->requestValue(); + return data; +} + VariantObject *Utils::getFriendAddressSecurityLevel(const QString &address) { VariantObject *data = new VariantObject("getFriendAddressSecurityLevel"); if (!data) return nullptr; diff --git a/Linphone/tool/Utils.hpp b/Linphone/tool/Utils.hpp index 01c3949dd..4ce76d7c8 100644 --- a/Linphone/tool/Utils.hpp +++ b/Linphone/tool/Utils.hpp @@ -133,6 +133,7 @@ public: Q_INVOKABLE static VariantObject *findAvatarByAddress(const QString &address); Q_INVOKABLE static VariantObject *findFriendByAddress(const QString &address); Q_INVOKABLE static VariantObject *getFriendAddressSecurityLevel(const QString &address); + Q_INVOKABLE static VariantObject *getFriendSecurityLevel(const QString &address); static QString generateSavedFilename(const QString &from, const QString &to); Q_INVOKABLE static VariantObject *isMe(const QString &address); Q_INVOKABLE static VariantObject *isLocal(const QString &address); diff --git a/Linphone/view/Control/Display/Call/CallListView.qml b/Linphone/view/Control/Display/Call/CallListView.qml index 093812cf1..73bb0a2b4 100644 --- a/Linphone/view/Control/Display/Call/CallListView.qml +++ b/Linphone/view/Control/Display/Call/CallListView.qml @@ -32,6 +32,7 @@ ListView { Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) _address: modelData.core.remoteAddress + secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified isConference: modelData.core.isConference shadowEnabled: false } diff --git a/Linphone/view/Control/Display/Contact/Avatar.qml b/Linphone/view/Control/Display/Contact/Avatar.qml index e390b1b26..aeb544e63 100644 --- a/Linphone/view/Control/Display/Contact/Avatar.qml +++ b/Linphone/view/Control/Display/Contact/Avatar.qml @@ -40,6 +40,11 @@ Loader{ : computedAvatarUri.length != 0 property var avatarObj: UtilsCpp.findAvatarByAddress(_address) property string computedAvatarUri: avatarObj ? avatarObj.value : '' + + // To get the secured property for a friend using an address to find it, + // override it as secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified + property var friendSecurityLevelObj: UtilsCpp.getFriendSecurityLevel(_address) + property var friendSecurityLevel: friendSecurityLevelObj ? securityLevelObj.value : LinphoneEnums.SecurityLevel.None // To get the secured property for a specific address, // override it as secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified diff --git a/Linphone/view/Control/Display/Contact/ContactListItem.qml b/Linphone/view/Control/Display/Contact/ContactListItem.qml index b28a35575..e4b681a2e 100644 --- a/Linphone/view/Control/Display/Contact/ContactListItem.qml +++ b/Linphone/view/Control/Display/Contact/ContactListItem.qml @@ -33,8 +33,8 @@ FocusScope { // Use directly previous initial property real itemsRightMargin: Math.round(39 * DefaultStyle.dp) - property string displayName: searchResultItem? searchResultItem.core.fullName : "" - property string initial: displayName != "" ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : '' + property var displayName: searchResultItem? searchResultItem.core.fullName : "" + property var initial: displayName != "" ? displayName[0].toLocaleLowerCase(ConstantsCpp.DefaultLocale) : '' signal clicked(var mouse) signal contactDeletionRequested(FriendGui contact) diff --git a/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml b/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml index 2151b2800..813043770 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantDeviceListView.qml @@ -47,6 +47,7 @@ ListView { Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) _address: modelData.core.address + secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false } Text { diff --git a/Linphone/view/Control/Display/Participant/ParticipantListView.qml b/Linphone/view/Control/Display/Participant/ParticipantListView.qml index b97e7f3e3..adb575d9f 100644 --- a/Linphone/view/Control/Display/Participant/ParticipantListView.qml +++ b/Linphone/view/Control/Display/Participant/ParticipantListView.qml @@ -52,6 +52,7 @@ ListView { Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) _address: modelData.core.sipAddress + secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false } Text { diff --git a/Linphone/view/Control/Display/Sticker.qml b/Linphone/view/Control/Display/Sticker.qml index 4bcaba636..ce4ef86d7 100644 --- a/Linphone/view/Control/Display/Sticker.qml +++ b/Linphone/view/Control/Display/Sticker.qml @@ -114,6 +114,7 @@ Item { call: !mainItem.previewEnabled ? mainItem.call : null displayNameVal: mainItem.displayName securityBreach: mainItem.securityBreach ? mainItem.securityBreach : securityLevel === LinphoneEnums.SecurityLevel.Unsafe + secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified } ColumnLayout{ id: joiningView diff --git a/Linphone/view/Control/Display/Text.qml b/Linphone/view/Control/Display/Text.qml index e302daef3..fa0b9df4b 100644 --- a/Linphone/view/Control/Display/Text.qml +++ b/Linphone/view/Control/Display/Text.qml @@ -10,7 +10,6 @@ Quick.Text { family: DefaultStyle.defaultFont pixelSize: Math.round(10 * DefaultStyle.dp) weight: Typography.p1.weight - bold: true } color: DefaultStyle.main2_600 wrapMode: Quick.Text.Wrap diff --git a/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml b/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml index a489d2e9b..796ed39a3 100644 --- a/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml +++ b/Linphone/view/Control/Popup/Notification/NotificationReceivedCall.qml @@ -66,6 +66,7 @@ Notification { Layout.preferredHeight: Math.round(60 * DefaultStyle.dp) Layout.alignment: Qt.AlignHCenter call: mainItem.call + secured: securityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified isConference: mainItem.call && mainItem.call.core.isConference } ColumnLayout { diff --git a/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml b/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml index 0c5e8cacf..b7a6c93d3 100644 --- a/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml +++ b/Linphone/view/Page/Form/Meeting/AddParticipantsForm.qml @@ -76,6 +76,7 @@ FocusScope{ anchors.fill: parent _address: modelData shadowEnabled: false + secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified } Button { Layout.preferredWidth: Math.round(17 * DefaultStyle.dp) diff --git a/Linphone/view/Page/Form/Meeting/MeetingForm.qml b/Linphone/view/Page/Form/Meeting/MeetingForm.qml index aa6de003c..f74116a4c 100644 --- a/Linphone/view/Page/Form/Meeting/MeetingForm.qml +++ b/Linphone/view/Page/Form/Meeting/MeetingForm.qml @@ -287,6 +287,7 @@ FocusScope { Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) _address: modelData.address + secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false } Text { diff --git a/Linphone/view/Page/Main/Meeting/MeetingPage.qml b/Linphone/view/Page/Main/Meeting/MeetingPage.qml index 61a796ae9..66cf635cf 100644 --- a/Linphone/view/Page/Main/Meeting/MeetingPage.qml +++ b/Linphone/view/Page/Main/Meeting/MeetingPage.qml @@ -775,6 +775,7 @@ AbstractMainPage { Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) _address: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.organizerAddress : "" + secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified } Text { text: mainItem.selectedConference && mainItem.selectedConference.core ? mainItem.selectedConference.core.organizerName : "" @@ -812,6 +813,7 @@ AbstractMainPage { Layout.preferredWidth: Math.round(45 * DefaultStyle.dp) Layout.preferredHeight: Math.round(45 * DefaultStyle.dp) _address: modelData.address + secured: friendSecurityLevel === LinphoneEnums.SecurityLevel.EndToEndEncryptedAndVerified shadowEnabled: false } Text {