diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 906a5320c..ae9f0bec4 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -3693,9 +3693,10 @@ Klik her: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Bekræft følgende SAS med peer. @@ -3707,12 +3708,19 @@ Klik her: <a href="%1">%1</a> Din kontakt burde sige: - deny - STOP + Later + 'Later' : Button label to do something in another time. + - accept - BEKRÆFT + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index 6c354fb22..c96dc75eb 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -3693,9 +3693,10 @@ Klicken Sie hier: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Bestätige folgende SAS mit der Gegenstelle. @@ -3707,12 +3708,19 @@ Klicken Sie hier: <a href="%1">%1</a> Ihr Kontakt sollte sagen: - deny - ABLEHNEN + Later + 'Later' : Button label to do something in another time. + - accept - BESTÄTIGEN + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index bfa73b268..80206faa0 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -3716,10 +3716,11 @@ Click here: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas - Confirm the following SAS with peer. + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. + To raise the security level, you can check the following codes with your correspondent. codeA @@ -3730,12 +3731,19 @@ Click here: <a href="%1">%1</a> Your contact should say: - deny - DENY + Later + 'Later' : Button label to do something in another time. + Later - accept - CONFIRM + Correct + 'Correct' : Button label to confirm a code. + Correct + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + Communication security diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index 50ecfe350..cb563a2c5 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -3693,9 +3693,10 @@ Haga clic aquí: <a href="%1">%1 </a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Confirma la siguiente SAS con el compañero @@ -3707,12 +3708,19 @@ Haga clic aquí: <a href="%1">%1 </a> Su contacto debería decir: - deny - DENEGAR + Later + 'Later' : Button label to do something in another time. + - accept - CONFIRMAR + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 8268ea906..1adabbc10 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -173,7 +173,7 @@ usernameStatusInvalidCharacters - Caractères invalides détectés (regex : `%1`). + Caractères invalides détectés (regex : `%1`). usernameStatusInvalid @@ -189,7 +189,7 @@ passwordStatusInvalidCharacters - Caractères invalides détectés (regex : `%1`). + Caractères invalides détectés (regex : `%1`). passwordStatusMissingCharacters @@ -1236,7 +1236,7 @@ URL du serveur non configurée. ephemeralNotInConference! 'Ephemeral message is only supported in conference based chat room!' - Les messages éphémères ne sont disponibles que pour une conversation définie en mode conférence ! + Les messages éphémères ne sont disponibles que pour une conversation définie en mode conférence ! Warning about not being in conference based chat room. @@ -2020,7 +2020,7 @@ Cliquez ici : <a href="%1">%1</a> newConferenceScheduleTitle 'Would you like to schedule your meeting?' : Ask about setting the meeting as scheduled. - Voulez-vous programmer cette réunion ? + Voulez-vous programmer cette réunion ? newConferenceDate @@ -2600,7 +2600,7 @@ Cliquez ici : <a href="%1">%1</a> serverTooltip - Serveur LDAP. ie : ldap:// pour un serveur local ou ldap://ldap.example.org/ + Serveur LDAP. ie : ldap:// pour un serveur local ou ldap://ldap.example.org/ bindDNLabel @@ -3546,7 +3546,7 @@ Cliquez ici : <a href="%1">%1</a> deleteTimeline 'Are you sure you want to delete and leave this timeline?' - Êtes-vous certain de vouloir tout effacer et de quitter cette conversation ? + Êtes-vous certain de vouloir tout effacer et de quitter cette conversation ? deleteTimelineTooltip @@ -3693,9 +3693,10 @@ Cliquez ici : <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Confirmez le SAS suivant avec votre interlocuteur. @@ -3707,12 +3708,19 @@ Cliquez ici : <a href="%1">%1</a> Votre interlocuteur devrait dire : - deny - REFUSER + Later + 'Later' : Button label to do something in another time. + - accept - CONFIRMER + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index 3c48bc478..20c791ad1 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -3680,9 +3680,10 @@ Kattintson ide: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Erősítse meg a következő SAS-t a társsal. @@ -3694,12 +3695,19 @@ Kattintson ide: <a href="%1">%1</a> A kapcsolattartónak el kell mondania: - deny - Letiltás + Later + 'Later' : Button label to do something in another time. + - accept - Megerősít + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index f5fb0bad0..4bed6ddc9 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -3693,9 +3693,10 @@ Clicca: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Confermare il seguente SAS con la controparte. @@ -3707,12 +3708,19 @@ Clicca: <a href="%1">%1</a> Il tuo contatto dovrebbe dire: - deny - RIFIUTA + Later + 'Later' : Button label to do something in another time. + - accept - CONFERMA + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 2c4470b7d..8403b9013 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -3680,9 +3680,10 @@ - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. ピアと次のSASを確認します。 @@ -3694,12 +3695,19 @@ 連絡先の内容は次のとおりです。 - deny - 拒否 + Later + 'Later' : Button label to do something in another time. + - accept - 確認 + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 0efdb74ff..b6141819c 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -3706,9 +3706,10 @@ Spustelėkite čia: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Patvirtinkite šią SAS su kolega. @@ -3720,12 +3721,19 @@ Spustelėkite čia: <a href="%1">%1</a> Jūsų kontaktas turėtų sakyti: - deny - ATMESTI + Later + 'Later' : Button label to do something in another time. + - accept - PATVIRTINTI + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/pt.ts b/linphone-app/assets/languages/pt.ts index 1f7b2d246..f7f3e89ca 100644 --- a/linphone-app/assets/languages/pt.ts +++ b/linphone-app/assets/languages/pt.ts @@ -2881,7 +2881,7 @@ - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index 6480d0a71..d64a69244 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -3693,9 +3693,10 @@ Clique aqui: <a href="%1">%1 </a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Confirme o seguinte SAS com peer. @@ -3707,12 +3708,19 @@ Clique aqui: <a href="%1">%1 </a> Seu contato deve dizer: - deny - NEGAR + Later + 'Later' : Button label to do something in another time. + - accept - CONFIRMAR + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index 37bc2b37a..e7a848531 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -3706,9 +3706,10 @@ - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Подтвердите следующую строку аутентификации с контактом. @@ -3720,12 +3721,19 @@ Ваш контакт должен сказать: - deny - ОТКЛОНИТЬ + Later + 'Later' : Button label to do something in another time. + - accept - ПОДТВЕРДИТЬ + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index f0e325110..9961684a6 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -3693,9 +3693,10 @@ Klicka här: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Bekräfta följande SAS med partner @@ -3707,12 +3708,19 @@ Klicka här: <a href="%1">%1</a> Din kontaktperson bör säga: - deny - FÖRNEKA + Later + 'Later' : Button label to do something in another time. + - accept - BEKRÄFTA + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index 51f897499..06654ba07 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -3680,9 +3680,10 @@ Buraya tıklayın: <a href="%1">%1</a> - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Aşağıdaki kısa yetkilendirme dizgesini eşinizle onaylayın. @@ -3694,12 +3695,19 @@ Buraya tıklayın: <a href="%1">%1</a> Kişiniz şunu söylemeli: - deny - REDDET + Later + 'Later' : Button label to do something in another time. + - accept - ONAYLA + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index aab92854e..5d6aa1fe3 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -3706,9 +3706,10 @@ - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. Підтвердіть такий рядок автентифікації з контактом. @@ -3720,12 +3721,19 @@ Ваш контакт повинен сказати: - deny - ВІДХИЛИТИ + Later + 'Later' : Button label to do something in another time. + - accept - СХВАЛИТИ + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index 88d9978f9..9ba77d1a6 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -3680,9 +3680,10 @@ - ZrtpTokenAuthentication + ZrtpTokenAuthenticationDialog confirmSas + 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. 与同行确认以下 SAS。 @@ -3694,12 +3695,19 @@ 您的联系人应该说: - deny - 否认 + Later + 'Later' : Button label to do something in another time. + - accept - 确认 + Correct + 'Correct' : Button label to confirm a code. + + + + title + 'Communication security' : Title of popup for ZRTP confirmation. + diff --git a/linphone-app/resources.qrc b/linphone-app/resources.qrc index 8cc39f5fa..a5ff5052e 100644 --- a/linphone-app/resources.qrc +++ b/linphone-app/resources.qrc @@ -349,6 +349,7 @@ ui/modules/Linphone/Dialog/OnlineInstallerDialog.qml ui/modules/Linphone/Dialog/SipAddressDialog.qml ui/modules/Linphone/Dialog/MultimediaParametersDialog.qml + ui/modules/Linphone/Dialog/ZrtpTokenAuthenticationDialog.qml ui/modules/Linphone/File/FileView.qml ui/modules/Linphone/History/History.qml ui/modules/Linphone/History/History.js @@ -394,6 +395,7 @@ ui/modules/Linphone/Styles/Dialog/MultimediaParametersDialogStyle.qml ui/modules/Linphone/Styles/Dialog/OnlineInstallerDialogStyle.qml ui/modules/Linphone/Styles/Dialog/SipAddressDialogStyle.qml + ui/modules/Linphone/Styles/Dialog/ZrtpTokenAuthenticationDialogStyle.qml ui/modules/Linphone/Styles/History/HistoryStyle.qml ui/modules/Linphone/Styles/Menus/SipAddressesMenuStyle.qml ui/modules/Linphone/Styles/Menus/IncallMenuStyle.qml @@ -441,7 +443,6 @@ ui/views/App/Calls/IncallGrid.qml ui/views/App/Calls/IncomingCall.qml ui/views/App/Calls/WaitingRoom.qml - ui/views/App/Calls/ZrtpTokenAuthentication.qml ui/views/App/Dialog/NewConference.qml ui/views/App/Main/Assistant/ActivateAppSipAccountWithEmail.qml ui/views/App/Main/Assistant/ActivateAppSipAccountWithPhoneNumber.qml diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 63a8ed4a3..63225c720 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -61,6 +61,9 @@ CallModel::CallModel (shared_ptr call){ SettingsModel *settings = coreManager->getSettingsModel(); connect(this, &CallModel::callIdChanged, this, &CallModel::chatRoomModelChanged);// When the call Id change, the chat room change. + connect(this, &CallModel::encryptionChanged, this, &CallModel::securityUpdated); + connect(this, &CallModel::isPQZrtpChanged, this, &CallModel::securityUpdated); + mCall = call; if(mCall) mCall->setData("call-model", *this); @@ -70,6 +73,9 @@ CallModel::CallModel (shared_ptr call){ connectTo(mCallListener.get()); mCall->addListener(mCallListener); auto callParams = mCall->getParams(); + auto currentParams = mCall->getCurrentParams(); + if(currentParams) + mEncryption = static_cast(currentParams->getMediaEncryption()); mConferenceVideoLayout = LinphoneEnums::fromLinphone(callParams->getConferenceVideoLayout()); if(mConferenceVideoLayout == LinphoneEnums::ConferenceLayoutGrid && !callParams->videoEnabled()) mConferenceVideoLayout = LinphoneEnums::ConferenceLayoutAudioOnly; @@ -80,6 +86,7 @@ CallModel::CallModel (shared_ptr call){ settings->setCameraMode(settings->getActiveSpeakerCameraMode()); }else settings->setCameraMode(settings->getCallCameraMode()); + } // Deal with auto-answer. @@ -295,6 +302,8 @@ void CallModel::updateStats (const shared_ptr &callSt break; case linphone::StreamType::Audio: + if( callStats) + isPQZrtp(callStats->isZrtpKeyAgreementAlgoPostQuantum() ? CallPQStateOn : CallPQStateOff); updateStats(callStats, mAudioStats); updateEncrypionStats(callStats, mEncryptionStats); break; @@ -470,8 +479,10 @@ void CallModel::stopRecording () { // ----------------------------------------------------------------------------- void CallModel::handleCallEncryptionChanged (const shared_ptr &call) { - if (call == mCall) - emit securityUpdated(); + if (call == mCall){ + if(!setEncryption(static_cast(mCall->getCurrentParams()->getMediaEncryption()))) + emit securityUpdated(); + } } void CallModel::handleCallStateChanged (const shared_ptr &call, linphone::Call::State state) { @@ -504,6 +515,7 @@ void CallModel::handleCallStateChanged (const shared_ptr &call, mPausedByRemote = false; updateConferenceVideoLayout(); setCallId(QString::fromStdString(mCall->getCallLog()->getCallId())); + updateEncryption(); break; } case linphone::Call::State::Connected: getConferenceSharedModel(); @@ -1063,19 +1075,33 @@ void CallModel::updateConferenceVideoLayout(){ // ----------------------------------------------------------------------------- CallModel::CallEncryption CallModel::getEncryption () const { - if(mCall) - return static_cast(mCall->getCurrentParams()->getMediaEncryption()); - else - return CallEncryptionNone; + return mEncryption; +} + +bool CallModel::setEncryption(const CallModel::CallEncryption& encryption){ + if( encryption != mEncryption){ + mEncryption = encryption; + emit encryptionChanged(); + return true; + }else + return false; +} + +void CallModel::updateEncryption(){ + if(mCall){ + auto currentParams = mCall->getCurrentParams(); + if( currentParams){ + setEncryption(static_cast(currentParams->getMediaEncryption())); + } + } } bool CallModel::isSecured () const { if(mCall){ - shared_ptr params = mCall->getCurrentParams(); - linphone::MediaEncryption encryption = params->getMediaEncryption(); - return ( - encryption == linphone::MediaEncryption::ZRTP && mCall->getAuthenticationTokenVerified() - ) || encryption == linphone::MediaEncryption::SRTP || encryption == linphone::MediaEncryption::DTLS; + auto encryption = getEncryption(); + return (encryption == CallEncryptionZrtp && mCall->getAuthenticationTokenVerified()) + || encryption == CallEncryptionSrtp + || encryption == CallEncryptionDtls; }else return false; } @@ -1109,16 +1135,16 @@ QString CallModel::getRemoteSas () const { QString CallModel::getSecuredString (const shared_ptr &callStats) const { if(mCall){ - switch (mCall->getCurrentParams()->getMediaEncryption()) { - case linphone::MediaEncryption::SRTP: + switch (getEncryption()) { + case CallEncryptionSrtp: return QStringLiteral("SRTP"); - case linphone::MediaEncryption::ZRTP: - return (callStats && callStats->isZrtpKeyAgreementAlgoPostQuantum() || (!callStats && CoreManager::getInstance()->getCore()->getPostQuantumAvailable()) ) + case CallEncryptionZrtp: + return (callStats && callStats->isZrtpKeyAgreementAlgoPostQuantum() || (!callStats && mIsPQZrtp == CallPQStateOn) ) ? QStringLiteral("Post Quantum ZRTP") : QStringLiteral("ZRTP"); - case linphone::MediaEncryption::DTLS: + case CallEncryptionDtls: return QStringLiteral("DTLS"); - case linphone::MediaEncryption::None: + case CallEncryptionNone: break; } } @@ -1245,6 +1271,13 @@ void CallModel::updateEncrypionStats (const shared_ptr call); ~CallModel (); @@ -220,6 +228,8 @@ signals: void statusChanged (CallStatus status); void videoRequested (); void securityUpdated (); + void encryptionChanged(); + void isPQZrtpChanged(); void speakerVolumeGainChanged (float volume); void microVolumeGainChanged (float volume); @@ -283,6 +293,8 @@ public: bool getSnapshotEnabled() const; CallEncryption getEncryption () const; + bool setEncryption(const CallModel::CallEncryption& encryption);// true if changed + void updateEncryption(); bool isSecured () const; QString getLocalSas () const; @@ -295,6 +307,7 @@ public: QVariantList getEncryptionStats () const; void updateStats (const std::shared_ptr &callStats, QVariantList &statsList); void updateEncrypionStats (const std::shared_ptr &callStats, QVariantList &statsList); + void isPQZrtp(const CallPQState& isPQ); QString iceStateToString (linphone::IceState state) const; @@ -312,6 +325,8 @@ private: void connectTo(CallListener * listener); bool mIsInConference = false; + CallPQState mIsPQZrtp = CallPQStateNone; + CallEncryption mEncryption = CallEncryptionNone; bool mEndByUser = false; bool mPausedByRemote = false; diff --git a/linphone-app/ui/modules/Common/Form/ActionButton.qml b/linphone-app/ui/modules/Common/Form/ActionButton.qml index 4b2b20ae9..ba9856154 100644 --- a/linphone-app/ui/modules/Common/Form/ActionButton.qml +++ b/linphone-app/ui/modules/Common/Form/ActionButton.qml @@ -330,7 +330,7 @@ Item { hoverEnabled: true acceptedButtons: Qt.NoButton cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor - visible: !iconIsCustom + visible: !iconIsCustom && !tooltip.visible } } diff --git a/linphone-app/ui/modules/Linphone/Dialog/ZrtpTokenAuthenticationDialog.qml b/linphone-app/ui/modules/Linphone/Dialog/ZrtpTokenAuthenticationDialog.qml new file mode 100644 index 000000000..a0055accc --- /dev/null +++ b/linphone-app/ui/modules/Linphone/Dialog/ZrtpTokenAuthenticationDialog.qml @@ -0,0 +1,165 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.3 + +import Common 1.0 +import Linphone 1.0 + +import Linphone.Styles 1.0 + +// ============================================================================= +DialogPlus { + id: mainItem + + property var addressSelectedCallback + property var chatRoomSelectedCallback + + property var call + property alias localSas: localSasText.text + property alias remoteSas : remoteSasText.text + + buttons: [ + TextButtonA { + //: 'Later' : Button label to do something in another time. + text: qsTr('Later') + onClicked: { + if(mainItem.call) mainItem.call.verifyAuthenticationToken(false) + mainItem.exit(0) + } + }, + + TextButtonC { + //: 'Correct' : Button label to confirm a code. + text: qsTr('Correct') + onClicked: { + if(mainItem.call) mainItem.call.verifyAuthenticationToken(true) + mainItem.exit(1) + } + } + ] + + + + buttonsAlignment: Qt.AlignCenter + height: 400 + width: 350 + + radius: 10 + onCallChanged: if(!call) exit(0) + Component.onCompleted: if( !localSas || !remoteSas) mainItem.exit(0) + + ColumnLayout { + id:columnLayout + // --------------------------------------------------------------------------- + anchors.fill: parent + Layout.fillWidth: true + + Icon{ + Layout.alignment: Qt.AlignHCenter + Layout.bottomMargin: 5 + icon: mainItem.call.isPQZrtp === CallModel.CallPQStateOn + ? ZrtpTokenAuthenticationDialogStyle.pqIcon + : mainItem.call.isPQZrtp === CallModel.CallPQStateOff + ? ZrtpTokenAuthenticationDialogStyle.icon + : ZrtpTokenAuthenticationDialogStyle.secureIcon + iconSize: ZrtpTokenAuthenticationDialogStyle.iconSize + } + + // --------------------------------------------------------------------------- + // Main text. + // --------------------------------------------------------------------------- + Text { + Layout.fillWidth: true + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + //: 'Communication security' : Title of popup for ZRTP confirmation. + text: qsTr('title') + + color: ZrtpTokenAuthenticationDialogStyle.text.colorA + wrapMode: Text.WordWrap + + font { + bold: true + pointSize: ZrtpTokenAuthenticationDialogStyle.text.titlePointSize + } + } + Text { + Layout.fillWidth: true + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + //: 'To raise the security level, you can check the following codes with your correspondent.' : Explanation to do a security check. + text: qsTr('confirmSas') + + color: ZrtpTokenAuthenticationDialogStyle.text.colorA + wrapMode: Text.WordWrap + + font.pointSize: ZrtpTokenAuthenticationDialogStyle.text.pointSize + } + + // --------------------------------------------------------------------------- + // Rules. + // --------------------------------------------------------------------------- + + ColumnLayout { + Layout.fillHeight: true + Layout.fillWidth: true + Layout.alignment: Qt.AlignHCenter + + spacing: ZrtpTokenAuthenticationDialogStyle.text.wordsSpacing + + Text { + Layout.fillWidth: true + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: ZrtpTokenAuthenticationDialogStyle.text.colorA + font.pointSize: ZrtpTokenAuthenticationDialogStyle.text.pointSize + text: qsTr('codeA') + } + + Text { + id: localSasText + Layout.fillWidth: true + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: ZrtpTokenAuthenticationDialogStyle.text.colorB + + font { + bold: true + pointSize: ZrtpTokenAuthenticationDialogStyle.text.sasPointSize + } + + text: mainItem.call?mainItem.call.localSas:'' + } + + Text { + Layout.fillWidth: true + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: ZrtpTokenAuthenticationDialogStyle.text.colorA + font.pointSize: ZrtpTokenAuthenticationDialogStyle.text.pointSize + text: qsTr('codeB') + } + + Text { + id: remoteSasText + Layout.fillWidth: true + + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + color: ZrtpTokenAuthenticationDialogStyle.text.colorB + + font { + bold: true + pointSize: ZrtpTokenAuthenticationDialogStyle.text.sasPointSize + } + + text: mainItem.call?mainItem.call.remoteSas:'' + } + } + + } +} diff --git a/linphone-app/ui/modules/Linphone/Styles/Dialog/ZrtpTokenAuthenticationDialogStyle.qml b/linphone-app/ui/modules/Linphone/Styles/Dialog/ZrtpTokenAuthenticationDialogStyle.qml new file mode 100644 index 000000000..bf9943a63 --- /dev/null +++ b/linphone-app/ui/modules/Linphone/Styles/Dialog/ZrtpTokenAuthenticationDialogStyle.qml @@ -0,0 +1,31 @@ +pragma Singleton +import QtQml 2.2 + +import Units 1.0 +import ColorsList 1.0 + +// ============================================================================= + +QtObject { + property string sectionName : 'ZrtpTokenAuthenticationDialog' + + property int height: 50 + property string pqIcon: 'secure_pq_zrtp' + property string secureIcon: 'secure_on' + property string icon: 'secure_level_2' + + property int iconSize: 60 + + property QtObject buttons: QtObject { + property int spacing: 10 + } + + property QtObject text: QtObject { + property color colorA: ColorsList.add(sectionName+'_zrtp_text_a', 'j').color + property color colorB: ColorsList.add(sectionName+'_zrtp_text_b', 's').color + property int pointSize: Units.dp * 10 + property int titlePointSize: Units.dp * 12 + property int sasPointSize: Units.dp * 13 + property int wordsSpacing: 5 + } +} diff --git a/linphone-app/ui/modules/Linphone/Styles/qmldir b/linphone-app/ui/modules/Linphone/Styles/qmldir index e4e244429..1194c8319 100644 --- a/linphone-app/ui/modules/Linphone/Styles/qmldir +++ b/linphone-app/ui/modules/Linphone/Styles/qmldir @@ -34,6 +34,8 @@ singleton ContactStyle 1.0 Contact/ContactStyle.qml singleton MultimediaParametersDialogStyle 1.0 Dialog/MultimediaParametersDialogStyle.qml singleton OnlineInstallerDialogStyle 1.0 Dialog/OnlineInstallerDialogStyle.qml singleton SipAddressDialogStyle 1.0 Dialog/SipAddressDialogStyle.qml +singleton ZrtpTokenAuthenticationDialogStyle 1.0 Dialog/ZrtpTokenAuthenticationDialogStyle.qml + singleton HistoryStyle 1.0 History/HistoryStyle.qml diff --git a/linphone-app/ui/modules/Linphone/qmldir b/linphone-app/ui/modules/Linphone/qmldir index 768e7a5cd..6355ee26b 100644 --- a/linphone-app/ui/modules/Linphone/qmldir +++ b/linphone-app/ui/modules/Linphone/qmldir @@ -36,6 +36,7 @@ ContactDescription 1.0 Contact/ContactDescription.qml SipAddressDialog 1.0 Dialog/SipAddressDialog.qml MultimediaParametersDialog 1.0 Dialog/MultimediaParametersDialog.qml +ZrtpTokenAuthenticationDialog 1.0 Dialog/ZrtpTokenAuthenticationDialog.qml FileView 1.0 File/FileView.qml diff --git a/linphone-app/ui/views/App/Calls/Incall.js b/linphone-app/ui/views/App/Calls/Incall.js index 9f0f33eaa..66412755a 100644 --- a/linphone-app/ui/views/App/Calls/Incall.js +++ b/linphone-app/ui/views/App/Calls/Incall.js @@ -100,12 +100,12 @@ function handleVideoRequested (call) { }) } -function makeReadableSecuredString (securedString) { - if (!securedString || !securedString.length) { +function makeReadableSecuredString (isSecured, secureString) { + if (!isSecured) { return qsTr('callNotSecured') } - return qsTr('securedStringFormat').replace('%1', securedString) + return qsTr('securedStringFormat').replace('%1', secureString) } function openCallStatistics () { diff --git a/linphone-app/ui/views/App/Calls/Incall.qml b/linphone-app/ui/views/App/Calls/Incall.qml index 962fd6337..cd616f849 100644 --- a/linphone-app/ui/views/App/Calls/Incall.qml +++ b/linphone-app/ui/views/App/Calls/Incall.qml @@ -57,6 +57,7 @@ Rectangle { } onParticipantCountChanged: Qt.callLater(function (){delayMessageBanner.restart()}) onIsReadyChanged: Qt.callLater(function (){delayMessageBanner.restart()}) + // --------------------------------------------------------------------------- color: IncallStyle.backgroundColor @@ -69,6 +70,9 @@ Rectangle { delayMessageBanner.restart() } onVideoRequested: Logic.handleVideoRequested(callModel) + onEncryptionChanged: if(!callModel.isSecured && callModel.encryption === CallModel.CallEncryptionZrtp){ + window.attachVirtualWindow(Utils.buildLinphoneDialogUri('ZrtpTokenAuthenticationDialog'), {call:callModel}) + } } // --------------------------------------------------------------------------- Rectangle{ @@ -293,7 +297,7 @@ Rectangle { anchors.top: featuresRow.bottom anchors.left: parent.left anchors.right: parent.right - anchors.bottom: zrtp.top + anchors.bottom: actionsButtons.top anchors.topMargin: 15 anchors.bottomMargin: 20 @@ -372,23 +376,6 @@ Rectangle { } } } - 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: active ? implicitHeight : 0 - sourceComponent:Component{ - ZrtpTokenAuthentication { - call: callModel - z: Constants.zPopup - onClose: {zrtp.active = false} - } - } - } // ------------------------------------------------------------------------- // Action Buttons. // ------------------------------------------------------------------------- @@ -406,14 +393,16 @@ Rectangle { backgroundRadius: width/2 colorSet: callModel.isSecured - ? SettingsModel.isPostQuantumAvailable && callModel.encryption === CallModel.CallEncryptionZrtp + ? SettingsModel.isPostQuantumAvailable && callModel.encryption === CallModel.CallEncryptionZrtp && callModel.isPQZrtp == CallModel.CallPQStateOn ? IncallStyle.buttons.postQuantumSecure : IncallStyle.buttons.secure : IncallStyle.buttons.unsecure - onClicked: zrtp.active =(callModel.encryption === CallModel.CallEncryptionZrtp) + onClicked: if(callModel.encryption === CallModel.CallEncryptionZrtp){ + window.attachVirtualWindow(Utils.buildLinphoneDialogUri('ZrtpTokenAuthenticationDialog'), {call:callModel}) + } - tooltipText: Logic.makeReadableSecuredString(callModel.securedString) + tooltipText: Logic.makeReadableSecuredString(callModel.isSecured, callModel.securedString) } RowLayout{ visible: callModel.remoteRecording diff --git a/linphone-app/ui/views/App/Calls/IncallFullscreen.qml b/linphone-app/ui/views/App/Calls/IncallFullscreen.qml index 20d9e4381..61c223364 100644 --- a/linphone-app/ui/views/App/Calls/IncallFullscreen.qml +++ b/linphone-app/ui/views/App/Calls/IncallFullscreen.qml @@ -83,6 +83,9 @@ Window { onCameraFirstFrameReceived: Logic.handleCameraFirstFrameReceived(width, height) onStatusChanged: Logic.handleStatusChanged (status, conference._fullscreen) onVideoRequested: Logic.handleVideoRequested(callModel) + onEncryptionChanged: if(!callModel.isSecured && callModel.encryption === CallModel.CallEncryptionZrtp){ + window.attachVirtualWindow(Utils.buildLinphoneDialogUri('ZrtpTokenAuthenticationDialog'), {call:callModel}) + } } // --------------------------------------------------------------------------- @@ -259,7 +262,7 @@ Window { anchors.top: featuresRow.bottom anchors.left: parent.left anchors.right: parent.right - anchors.bottom: zrtp.top + anchors.bottom: actionsButtons.top anchors.topMargin: window.hideButtons ? 0 : 15 anchors.bottomMargin: window.hideButtons ? 0 : 20 @@ -336,22 +339,6 @@ Window { // ------------------------------------------------------------------------- // Action Buttons. // ------------------------------------------------------------------------- - - Loader{ - id: zrtp - active: call && !call.isSecured && call.encryption === CallModel.CallEncryptionZrtp - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: actionsButtons.top - anchors.margins: CallStyle.container.margins - height: active ? implicitHeight : 0 - sourceComponent:Component{ - ZrtpTokenAuthentication { - call: callModel - z: Constants.zPopup - onClose: {zrtp.active = false} - } - } - } // Security ActionButton{ id: securityButton @@ -362,13 +349,20 @@ Window { height: IncallStyle.buttons.secure.buttonSize width: height isCustom: true + iconIsCustom: ! (callModel.isSecured && SettingsModel.isPostQuantumAvailable && callModel.encryption === CallModel.CallEncryptionZrtp) backgroundRadius: width/2 - colorSet: callModel.isSecured ? IncallStyle.buttons.secure : IncallStyle.buttons.unsecure + colorSet: callModel.isSecured + ? SettingsModel.isPostQuantumAvailable && callModel.encryption === CallModel.CallEncryptionZrtp && callModel.isPQZrtp == CallModel.CallPQStateOn + ? IncallStyle.buttons.postQuantumSecure + : IncallStyle.buttons.secure + : IncallStyle.buttons.unsecure - onClicked: zrtp.active = (callModel.encryption === CallModel.CallEncryptionZrtp) + onClicked: if(callModel.encryption === CallModel.CallEncryptionZrtp){ + window.attachVirtualWindow(Utils.buildLinphoneDialogUri('ZrtpTokenAuthenticationDialog'), {call:callModel}) + } - tooltipText: Logic.makeReadableSecuredString(callModel.securedString) + tooltipText: Logic.makeReadableSecuredString(callModel.isSecured, callModel.securedString) } RowLayout{ visible: callModel && callModel.remoteRecording diff --git a/linphone-app/ui/views/App/Calls/ZrtpTokenAuthentication.qml b/linphone-app/ui/views/App/Calls/ZrtpTokenAuthentication.qml deleted file mode 100644 index 75f7cff09..000000000 --- a/linphone-app/ui/views/App/Calls/ZrtpTokenAuthentication.qml +++ /dev/null @@ -1,139 +0,0 @@ -import QtQuick 2.7 -import QtQuick.Layouts 1.3 - -import Common 1.0 -import Linphone 1.0 - -import App.Styles 1.0 - -// ============================================================================= -Rectangle{ - id: zrtp - property var call - 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 - // --------------------------------------------------------------------------- - - Layout.fillWidth: true - anchors.bottom: parent.bottom - - Icon{ - Layout.alignment: Qt.AlignHCenter - Layout.bottomMargin: 5 - visible: SettingsModel.isPostQuantumAvailable - icon: CallStyle.zrtpArea.pqIcon - iconSize: CallStyle.zrtpArea.iconSize - } - - // --------------------------------------------------------------------------- - // Main text. - // --------------------------------------------------------------------------- - - Text { - Layout.fillWidth: true - - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - - text: qsTr('confirmSas') - - color: CallStyle.zrtpArea.text.colorA - elide: Text.ElideRight - - font { - bold: true - pointSize: CallStyle.zrtpArea.text.pointSize - } - } - - // --------------------------------------------------------------------------- - // Rules. - // --------------------------------------------------------------------------- - - Row { - Layout.alignment: Qt.AlignHCenter - - spacing: CallStyle.zrtpArea.text.wordsSpacing - - Text { - color: CallStyle.zrtpArea.text.colorA - font.pointSize: CallStyle.zrtpArea.text.pointSize - text: qsTr('codeA') - } - - Text { - id: localSasText - color: CallStyle.zrtpArea.text.colorB - - font { - bold: true - pointSize: CallStyle.zrtpArea.text.pointSize - } - - text: zrtp.call?zrtp.call.localSas:'' - } - - Text { - color: CallStyle.zrtpArea.text.colorA - font.pointSize: CallStyle.zrtpArea.text.pointSize - text: '-' - } - - Text { - color: CallStyle.zrtpArea.text.colorA - font.pointSize: CallStyle.zrtpArea.text.pointSize - text: qsTr('codeB') - } - - Text { - id: remoteSasText - color: CallStyle.zrtpArea.text.colorB - - font { - bold: true - pointSize: CallStyle.zrtpArea.text.pointSize - } - - text: zrtp.call?zrtp.call.remoteSas:'' - } - } - - // --------------------------------------------------------------------------- - // Buttons. - // --------------------------------------------------------------------------- - - Row { - Layout.alignment: Qt.AlignHCenter - - spacing: CallStyle.zrtpArea.buttons.spacing - - TextButtonA { - text: qsTr('deny') - onClicked: { - zrtp.call.verifyAuthenticationToken(false) - zrtp.close() - } - } - - TextButtonB { - text: qsTr('accept') - onClicked: { - zrtp.call.verifyAuthenticationToken(true) - zrtp.close() - } - } - } - } -}