diff --git a/linphone-desktop/assets/languages/en.ts b/linphone-desktop/assets/languages/en.ts index 8bacaaf34..6cc93e96b 100644 --- a/linphone-desktop/assets/languages/en.ts +++ b/linphone-desktop/assets/languages/en.ts @@ -12,7 +12,7 @@ ActivateLinphoneSipAccountWithEmail activateLinphoneSipAccount - CREATE A LINPHONE ACCOUNT + ACTIVATE A LINPHONE ACCOUNT confirmAction @@ -27,7 +27,7 @@ ActivateLinphoneSipAccountWithPhoneNumber activateLinphoneSipAccount - CREATE A LINPHONE ACCOUNT + ACTIVATE A LINPHONE ACCOUNT confirmAction @@ -159,7 +159,7 @@ smsActivationFailed - + SMS activation failed! emailActivationFailed @@ -181,6 +181,10 @@ phoneNumberStatusInvalidCountryCode Invalid country code! + + loginWithPhoneNumberFailed + Login failed. Please check your phone number. + AuthenticationRequest @@ -1341,6 +1345,10 @@ your friend's SIP address or username. useUsernameToLogin Use username and password rather than your phone number. + + quitWarning + Your account has been created but is not yet validated. Are you sure you want to quit this view? + UseLinphoneSipAccountWithPhoneNumber diff --git a/linphone-desktop/assets/languages/fr.ts b/linphone-desktop/assets/languages/fr.ts index c1fca045d..d416057a8 100644 --- a/linphone-desktop/assets/languages/fr.ts +++ b/linphone-desktop/assets/languages/fr.ts @@ -12,7 +12,7 @@ ActivateLinphoneSipAccountWithEmail activateLinphoneSipAccount - CRÉER UN COMPTE LINPHONE + ACTIVER UN COMPTE LINPHONE confirmAction @@ -27,7 +27,7 @@ ActivateLinphoneSipAccountWithPhoneNumber activateLinphoneSipAccount - CRÉER UN COMPTE LINPHONE + ACTIVER UN COMPTE LINPHONE confirmAction @@ -159,7 +159,7 @@ smsActivationFailed - + L'activation par SMS a échoué ! emailActivationFailed @@ -181,6 +181,10 @@ phoneNumberStatusInvalidCountryCode Indicatif tél. invalide ! + + loginWithPhoneNumberFailed + La connection a échouée. Merci de vérifier votre numéro de tél. + AuthenticationRequest @@ -1340,6 +1344,10 @@ un chat ou ajouter un contact. useUsernameToLogin Utiliser un nom et mot de passe plutôt que votre numéro de téléphone. + + quitWarning + Votre compte a été crée mais il n'a pas été validé. Êtes-vous sûr de vouloir quitter cette vue ? + UseLinphoneSipAccountWithPhoneNumber diff --git a/linphone-desktop/src/components/assistant/AssistantModel.cpp b/linphone-desktop/src/components/assistant/AssistantModel.cpp index fddbb3790..cfdd6486f 100644 --- a/linphone-desktop/src/components/assistant/AssistantModel.cpp +++ b/linphone-desktop/src/components/assistant/AssistantModel.cpp @@ -75,16 +75,21 @@ private: } void onActivateAccount ( - const shared_ptr &, + const shared_ptr &creator, linphone::AccountCreatorStatus status, const string & ) override { if ( status == linphone::AccountCreatorStatusAccountActivated || status == linphone::AccountCreatorStatusAccountAlreadyActivated - ) + ) { + if (creator->getEmail().empty()) { + shared_ptr proxyConfig = creator->createProxyConfig(); + Q_ASSERT(proxyConfig != nullptr); + } + emit mAssistant->activateStatusChanged(""); - else { + } else { if (status == linphone::AccountCreatorStatusRequestFailed) emit mAssistant->activateStatusChanged(tr("requestFailed")); else @@ -110,6 +115,23 @@ private: } } + void onRecoverAccount ( + const shared_ptr &, + linphone::AccountCreatorStatus status, + const string & + ) override { + if (status == linphone::AccountCreatorStatusRequestOk) { + emit mAssistant->recoverStatusChanged(""); + } else { + if (status == linphone::AccountCreatorStatusRequestFailed) + emit mAssistant->recoverStatusChanged(tr("requestFailed")); + else if (status == linphone::AccountCreatorStatusServerError) + emit mAssistant->recoverStatusChanged(tr("cannotSendSms")); + else + emit mAssistant->recoverStatusChanged(tr("loginWithPhoneNumberFailed")); + } + } + private: AssistantModel *mAssistant; }; @@ -140,7 +162,10 @@ void AssistantModel::create () { } void AssistantModel::login () { - mAccountCreator->isAccountExist(); + if (mAccountCreator->getEmail().empty()) + mAccountCreator->recoverAccount(); + else + mAccountCreator->isAccountExist(); } void AssistantModel::reset () { diff --git a/linphone-desktop/src/components/assistant/AssistantModel.hpp b/linphone-desktop/src/components/assistant/AssistantModel.hpp index de70271ed..d449a51e7 100644 --- a/linphone-desktop/src/components/assistant/AssistantModel.hpp +++ b/linphone-desktop/src/components/assistant/AssistantModel.hpp @@ -63,6 +63,7 @@ signals: void activateStatusChanged (const QString &error); void createStatusChanged (const QString &error); void loginStatusChanged (const QString &error); + void recoverStatusChanged (const QString &error); void configFilenameChanged (const QString &configFilename); diff --git a/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithEmail.qml b/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithEmail.qml index cb82968af..cd9ff41f0 100644 --- a/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithEmail.qml +++ b/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithEmail.qml @@ -97,13 +97,7 @@ AssistantAbstractView { RequestBlock { id: requestBlock - action: function () { - window.lockView({ - descriptionText: qsTr('quitWarning') - }) - assistantModel.create() - } - + action: assistantModel.create width: parent.width } } @@ -123,13 +117,16 @@ AssistantAbstractView { onCreateStatusChanged: { requestBlock.stop(error) - if (!error.length) { - assistant.pushView('ActivateLinphoneSipAccountWithEmail', { - assistantModel: assistantModel - }) - } else { - window.unlockView() + if (error.length) { + return } + + window.lockView({ + descriptionText: qsTr('quitWarning') + }) + assistant.pushView('ActivateLinphoneSipAccountWithEmail', { + assistantModel: assistantModel + }) } } } diff --git a/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithPhoneNumber.qml b/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithPhoneNumber.qml index e07c63259..a87d11818 100644 --- a/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithPhoneNumber.qml +++ b/linphone-desktop/ui/views/App/Main/Assistant/CreateLinphoneSipAccountWithPhoneNumber.qml @@ -96,13 +96,7 @@ AssistantAbstractView { RequestBlock { id: requestBlock - action: function () { - window.lockView({ - descriptionText: qsTr('quitWarning') - }) - assistantModel.create() - } - + action: assistantModel.create width: parent.width } } @@ -123,13 +117,16 @@ AssistantAbstractView { onCreateStatusChanged: { requestBlock.stop(error) - if (!error.length) { - assistant.pushView('ActivateLinphoneSipAccountWithPhoneNumber', { - assistantModel: assistantModel - }) - } else { - window.unlockView() + if (error.length) { + return } + + window.lockView({ + descriptionText: qsTr('quitWarning') + }) + assistant.pushView('ActivateLinphoneSipAccountWithPhoneNumber', { + assistantModel: assistantModel + }) } } } diff --git a/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccount.qml b/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccount.qml index adda4d7d3..de1fb53d1 100644 --- a/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccount.qml +++ b/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccount.qml @@ -58,14 +58,27 @@ AssistantAbstractView { AssistantModel { id: assistantModel + function setCountryCode (index) { + var model = telephoneNumbersModel + assistantModel.countryCode = model.data(model.index(index, 0)).countryCode + } + configFilename: 'use-linphone-sip-account.rc' + countryCode: setCountryCode(telephoneNumbersModel.defaultIndex) + onPasswordChanged: { if (checkBox.checked) { loader.item.passwordError = error } } + onPhoneNumberChanged: { + if (!checkBox.checked) { + loader.item.phoneNumberError = error + } + } + onUsernameChanged: { if (checkBox.checked) { loader.item.usernameError = error @@ -78,5 +91,26 @@ AssistantAbstractView { window.setView('Home') } } + + onRecoverStatusChanged: { + if (checkBox.checked) { + requestBlock.stop('') + return + } + + requestBlock.stop(error) + if (!error.length) { + window.lockView({ + descriptionText: qsTr('quitWarning') + }) + assistant.pushView('ActivateLinphoneSipAccountWithPhoneNumber', { + assistantModel: assistantModel + }) + } + } + } + + TelephoneNumbersModel { + id: telephoneNumbersModel } } diff --git a/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccountWithPhoneNumber.qml b/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccountWithPhoneNumber.qml index 06f8f605b..686364d87 100644 --- a/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccountWithPhoneNumber.qml +++ b/linphone-desktop/ui/views/App/Main/Assistant/UseLinphoneSipAccountWithPhoneNumber.qml @@ -1,9 +1,13 @@ import Common 1.0 +import Linphone 1.0 // ============================================================================= Form { - property bool mainActionEnabled: country.currentIndex !== -1 && phoneNumber.text + property alias phoneNumberError: phoneNumber.error + + property bool mainActionEnabled: phoneNumber.text.length && + !phoneNumberError.length dealWithErrors: true orientation: Qt.Vertical @@ -14,6 +18,18 @@ Form { ComboBox { id: country + + currentIndex: model.defaultIndex + model: telephoneNumbersModel + textRole: 'countryName' + + onActivated: { + assistantModel.setCountryCode(index) + var text = phoneNumber.text + if (text.length > 0) { + assistantModel.phoneNumber = text + } + } } } } @@ -24,6 +40,10 @@ Form { TextField { id: phoneNumber + + inputMethodHints: Qt.ImhDialableCharactersOnly + + onTextChanged: assistantModel.phoneNumber = text } } } diff --git a/submodules/ortp b/submodules/ortp index 4b0eb84c8..bd792338c 160000 --- a/submodules/ortp +++ b/submodules/ortp @@ -1 +1 @@ -Subproject commit 4b0eb84c8e738a606cfd5da35d2a673853b4b13a +Subproject commit bd792338c47c3849cce3661d4e693df0177873c0