diff --git a/assets/languages/de.ts b/assets/languages/de.ts index 2a3934ede..7b77efdcb 100644 --- a/assets/languages/de.ts +++ b/assets/languages/de.ts @@ -1421,6 +1421,10 @@ Server URL ist nicht konfiguriert. fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/assets/languages/en.ts b/assets/languages/en.ts index 6d019361d..d06de96d4 100644 --- a/assets/languages/en.ts +++ b/assets/languages/en.ts @@ -1426,6 +1426,10 @@ your friend's SIP address or username. fetchRemoteConfigurationEnabledLabel Enable configuration fetch + + assistantSupportsPhoneNumbersLabel + Supports phone numbers + SettingsSipAccountsEdit diff --git a/assets/languages/fr_FR.ts b/assets/languages/fr_FR.ts index 99f94f41b..21acb118c 100644 --- a/assets/languages/fr_FR.ts +++ b/assets/languages/fr_FR.ts @@ -1424,6 +1424,10 @@ Cliquez ici : <a href="%1">%1</a> fetchRemoteConfigurationEnabledLabel Activer le téléchargement de conf. + + assistantSupportsPhoneNumbersLabel + Supporter les numéros de tél. + SettingsSipAccountsEdit diff --git a/assets/languages/ja.ts b/assets/languages/ja.ts index 22974bbdf..321a12653 100644 --- a/assets/languages/ja.ts +++ b/assets/languages/ja.ts @@ -1421,6 +1421,10 @@ fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/assets/languages/lt.ts b/assets/languages/lt.ts index ee9b74f57..4a25a5251 100644 --- a/assets/languages/lt.ts +++ b/assets/languages/lt.ts @@ -1423,6 +1423,10 @@ Tiesiog, įveskite savo draugo SIP adresą ar naudotojo vardą. fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/assets/languages/pt_BR.ts b/assets/languages/pt_BR.ts index caddaf764..46706556f 100644 --- a/assets/languages/pt_BR.ts +++ b/assets/languages/pt_BR.ts @@ -1426,6 +1426,10 @@ o endereço SIP ou nome de usuário do seu amigo. fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/assets/languages/ru.ts b/assets/languages/ru.ts index 6272b18ab..1e27d871d 100644 --- a/assets/languages/ru.ts +++ b/assets/languages/ru.ts @@ -1421,6 +1421,10 @@ fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/assets/languages/sv.ts b/assets/languages/sv.ts index 50e701cbe..322c38902 100644 --- a/assets/languages/sv.ts +++ b/assets/languages/sv.ts @@ -1423,6 +1423,10 @@ Klicka här: <a href="%1">%1</a> fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/assets/languages/tr.ts b/assets/languages/tr.ts index b6639ce42..23fa48781 100644 --- a/assets/languages/tr.ts +++ b/assets/languages/tr.ts @@ -1423,6 +1423,10 @@ arkadaşınızın SIP adresini veya kullanıcı adını girin. fetchRemoteConfigurationEnabledLabel + + assistantSupportsPhoneNumbersLabel + + SettingsSipAccountsEdit diff --git a/src/components/settings/SettingsModel.cpp b/src/components/settings/SettingsModel.cpp index 305910752..34de65205 100644 --- a/src/components/settings/SettingsModel.cpp +++ b/src/components/settings/SettingsModel.cpp @@ -85,6 +85,17 @@ SettingsModel::SettingsModel (QObject *parent) : QObject(parent) { emit fetchRemoteConfigurationEnabledChanged(status); } + // --------------------------------------------------------------------------- + + bool SettingsModel::getAssistantSupportsPhoneNumbers () const { + return !!mConfig->getInt(UiSection, "assistant_supports_phone_numbers", 1); + } + + void SettingsModel::setAssistantSupportsPhoneNumbers (bool status) { + mConfig->setInt(UiSection, "assistant_supports_phone_numbers", status); + emit assistantSupportsPhoneNumbersChanged(status); + } + // ============================================================================= // Audio. // ============================================================================= diff --git a/src/components/settings/SettingsModel.hpp b/src/components/settings/SettingsModel.hpp index 627cb926c..2e6884c50 100644 --- a/src/components/settings/SettingsModel.hpp +++ b/src/components/settings/SettingsModel.hpp @@ -42,6 +42,8 @@ class SettingsModel : public QObject { Q_PROPERTY(bool useAppSipAccountEnabled READ getUseAppSipAccountEnabled WRITE setUseAppSipAccountEnabled NOTIFY useAppSipAccountEnabledChanged); Q_PROPERTY(bool useOtherSipAccountEnabled READ getUseOtherSipAccountEnabled WRITE setUseOtherSipAccountEnabled NOTIFY useOtherSipAccountEnabledChanged); + Q_PROPERTY(bool assistantSupportsPhoneNumbers READ getAssistantSupportsPhoneNumbers WRITE setAssistantSupportsPhoneNumbers NOTIFY assistantSupportsPhoneNumbersChanged); + // Audio. -------------------------------------------------------------------- Q_PROPERTY(QStringList captureDevices READ getCaptureDevices CONSTANT); @@ -192,6 +194,9 @@ public: bool getUseOtherSipAccountEnabled () const; void setUseOtherSipAccountEnabled (bool status); + bool getAssistantSupportsPhoneNumbers () const; + void setAssistantSupportsPhoneNumbers (bool status); + // Audio. -------------------------------------------------------------------- QStringList getCaptureDevices () const; @@ -399,6 +404,8 @@ signals: void useAppSipAccountEnabledChanged (bool status); void useOtherSipAccountEnabledChanged (bool status); + void assistantSupportsPhoneNumbersChanged (bool status); + // Audio. -------------------------------------------------------------------- void captureDeviceChanged (const QString &device); diff --git a/ui/views/App/Main/Assistant/AssistantHome.qml b/ui/views/App/Main/Assistant/AssistantHome.qml index aeba186e7..2df49d3ef 100644 --- a/ui/views/App/Main/Assistant/AssistantHome.qml +++ b/ui/views/App/Main/Assistant/AssistantHome.qml @@ -90,35 +90,54 @@ ColumnLayout { margins: AssistantHomeStyle.buttons.spacing } + enabled: SettingsModel[$viewType.charAt(0).toLowerCase() + $viewType.slice(1) + "Enabled"] text: $text.replace('%1', Qt.application.name.toUpperCase()) - enabled: SettingsModel[$view.charAt(0).toLowerCase() + $view.slice(1) + "Enabled"]; onClicked: assistant.pushView($view) } } model: ListModel { - ListElement { - $text: qsTr('createAppSipAccount') - $view: 'CreateAppSipAccount' + Component.onCompleted: { + insert(0, { + $text: qsTr('createAppSipAccount'), + $view: SettingsModel.assistantSupportsPhoneNumbers + ? 'CreateAppSipAccount' + : 'CreateAppSipAccountWithEmail', + $viewType: 'CreateAppSipAccount' + }) } ListElement { $text: qsTr('useAppSipAccount') $view: 'UseAppSipAccount' + $viewType: 'UseAppSipAccount' } ListElement { $text: qsTr('useOtherSipAccount') $view: 'UseOtherSipAccount' + $viewType: 'UseOtherSipAccount' } ListElement { $text: qsTr('fetchRemoteConfiguration') $view: 'FetchRemoteConfiguration' + $viewType: 'FetchRemoteConfiguration' } } interactive: false + + Connections { + target: SettingsModel + onAssistantSupportsPhoneNumbersChanged: buttons.model.setProperty( + 0, + '$view', + SettingsModel.assistantSupportsPhoneNumbers ? + 'CreateAppSipAccount' : + 'CreateAppSipAccountWithEmail' + ); + } } } diff --git a/ui/views/App/Main/Assistant/UseAppSipAccount.qml b/ui/views/App/Main/Assistant/UseAppSipAccount.qml index db55a6a89..b2df2dc18 100644 --- a/ui/views/App/Main/Assistant/UseAppSipAccount.qml +++ b/ui/views/App/Main/Assistant/UseAppSipAccount.qml @@ -27,7 +27,9 @@ AssistantAbstractView { id: loader source: 'UseAppSipAccountWith' + ( - checkBox.checked ? 'Username' : 'PhoneNumber' + !SettingsModel.assistantSupportsPhoneNumbers || checkBox.checked + ? 'Username' + : 'PhoneNumber' ) + '.qml' width: parent.width } @@ -36,6 +38,7 @@ AssistantAbstractView { id: checkBox text: qsTr('useUsernameToLogin') + visible: SettingsModel.assistantSupportsPhoneNumbers width: UseAppSipAccountStyle.checkBox.width onClicked: { diff --git a/ui/views/App/Settings/SettingsSipAccounts.qml b/ui/views/App/Settings/SettingsSipAccounts.qml index b3b3a548a..ced920119 100644 --- a/ui/views/App/Settings/SettingsSipAccounts.qml +++ b/ui/views/App/Settings/SettingsSipAccounts.qml @@ -175,6 +175,18 @@ TabContainer { } } } + + FormLine { + FormGroup { + label: qsTr('assistantSupportsPhoneNumbersLabel') + + Switch { + checked: SettingsModel.assistantSupportsPhoneNumbers + + onClicked: SettingsModel.assistantSupportsPhoneNumbers = !checked + } + } + } } } }