Display security icon in conference.

Use a loader for zrtp authentification to avoid useless memory (and keep the case if athentication code need to be restarted)
This commit is contained in:
Julien Wadel 2022-10-14 11:47:14 +02:00
parent 96bbc2da9d
commit b6d4abe3ea
4 changed files with 41 additions and 24 deletions

View file

@ -1060,7 +1060,10 @@ bool CallModel::isSecured () const {
QString CallModel::getLocalSas () const {
if(mCall){
QString token = Utils::coreStringToAppString(mCall->getAuthenticationToken());
return mCall->getDir() == linphone::Call::Dir::Incoming ? token.left(2).toUpper() : token.right(2).toUpper();
if(token.isEmpty())
return "";
else
return mCall->getDir() == linphone::Call::Dir::Incoming ? token.left(2).toUpper() : token.right(2).toUpper();
}else
return "";
}
@ -1068,7 +1071,10 @@ QString CallModel::getLocalSas () const {
QString CallModel::getRemoteSas () const {
if(mCall){
QString token = Utils::coreStringToAppString(mCall->getAuthenticationToken());
return mCall->getDir() != linphone::Call::Dir::Incoming ? token.left(2).toUpper() : token.right(2).toUpper();
if(token.isEmpty())
return "";
else
return mCall->getDir() != linphone::Call::Dir::Incoming ? token.left(2).toUpper() : token.right(2).toUpper();
}else
return "";
}

View file

@ -374,20 +374,22 @@ Rectangle {
}
}
}
ZrtpTokenAuthentication {
Loader{
id: zrtp
active: call && !call.isSecured && call.encryption === CallModel.CallEncryptionZrtp
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: actionsButtons.top
anchors.leftMargin: CallStyle.container.margins
anchors.rightMargin: CallStyle.container.margins
anchors.bottomMargin: CallStyle.container.margins
height: visible ? implicitHeight : 0
call: callModel
visible: !call.isSecured && call.encryption !== CallModel.CallEncryptionNone
z: Constants.zPopup
height: active ? implicitHeight : 0
sourceComponent:Component{
ZrtpTokenAuthentication {
call: callModel
z: Constants.zPopup
onClose: {zrtp.active = false}
}
}
}
// -------------------------------------------------------------------------
// Action Buttons.
@ -396,7 +398,6 @@ Rectangle {
// Security
ActionButton{
id: securityButton
visible: callModel && !callModel.isConference
anchors.left: parent.left
anchors.verticalCenter: actionsButtons.verticalCenter
anchors.leftMargin: 25
@ -412,7 +413,7 @@ Rectangle {
: IncallStyle.buttons.secure
: IncallStyle.buttons.unsecure
onClicked: zrtp.visible = (callModel.encryption === CallModel.CallEncryptionZrtp)
onClicked: zrtp.active =(callModel.encryption === CallModel.CallEncryptionZrtp)
tooltipText: Logic.makeReadableSecuredString(callModel.securedString)
}

View file

@ -337,17 +337,21 @@ Window {
// -------------------------------------------------------------------------
// Action Buttons.
// -------------------------------------------------------------------------
ZrtpTokenAuthentication {
Loader{
id: zrtp
active: call && !call.isSecured && call.encryption === CallModel.CallEncryptionZrtp
anchors.horizontalCenter: parent.horizontalCenter
anchors.margins: CallStyle.container.margins
anchors.bottom: actionsButtons.top
height: visible ? implicitHeight : 0
call: callModel
visible: !call.isSecured && call.encryption !== CallModel.CallEncryptionNone
z: Constants.zPopup
anchors.margins: CallStyle.container.margins
height: active ? implicitHeight : 0
sourceComponent:Component{
ZrtpTokenAuthentication {
call: callModel
z: Constants.zPopup
onClose: {zrtp.active = false}
}
}
}
// Security
ActionButton{
@ -363,7 +367,7 @@ Window {
colorSet: callModel.isSecured ? IncallStyle.buttons.secure : IncallStyle.buttons.unsecure
onClicked: zrtp.visible = (callModel.encryption === CallModel.CallEncryptionZrtp)
onClicked: zrtp.active = (callModel.encryption === CallModel.CallEncryptionZrtp)
tooltipText: Logic.makeReadableSecuredString(callModel.securedString)
}

View file

@ -10,13 +10,17 @@ import App.Styles 1.0
Rectangle{
id: zrtp
property var call
visible: false
property alias localSas: localSasText.text
property alias remoteSas : remoteSasText.text
signal close()
color:"transparent"
implicitWidth: columnLayout.implicitWidth
implicitHeight: columnLayout.implicitHeight+CallStyle.container.margins
radius: 10
Component.onCompleted: if( !localSas || !remoteSas) zrtp.close()
ColumnLayout {
id:columnLayout
@ -70,6 +74,7 @@ Rectangle{
}
Text {
id: localSasText
color: CallStyle.zrtpArea.text.colorB
font {
@ -93,6 +98,7 @@ Rectangle{
}
Text {
id: remoteSasText
color: CallStyle.zrtpArea.text.colorB
font {
@ -116,16 +122,16 @@ Rectangle{
TextButtonA {
text: qsTr('deny')
onClicked: {
zrtp.visible = false
zrtp.call.verifyAuthenticationToken(false)
zrtp.close()
}
}
TextButtonB {
text: qsTr('accept')
onClicked: {
zrtp.visible = false
zrtp.call.verifyAuthenticationToken(true)
zrtp.close()
}
}
}