From a47d97d790be797a089f130606a78ba55937a321 Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Mon, 27 Mar 2023 16:07:47 +0200 Subject: [PATCH] - Fix interpretUrl to check internalization prefix option from account configuration. - Fix Layout label width if fitting label is requested (gui). - Fix a missing presence text in qml. --- CHANGELOG.md | 1 + linphone-app/assets/languages/cs.ts | 30 +++++++++++ linphone-app/assets/languages/da.ts | 30 +++++++++++ linphone-app/assets/languages/de.ts | 30 +++++++++++ linphone-app/assets/languages/en.ts | 30 +++++++++++ linphone-app/assets/languages/es.ts | 30 +++++++++++ linphone-app/assets/languages/fr_FR.ts | 30 +++++++++++ linphone-app/assets/languages/hu.ts | 30 +++++++++++ linphone-app/assets/languages/it.ts | 30 +++++++++++ linphone-app/assets/languages/ja.ts | 30 +++++++++++ linphone-app/assets/languages/lt.ts | 30 +++++++++++ linphone-app/assets/languages/pt_BR.ts | 30 +++++++++++ linphone-app/assets/languages/ru.ts | 30 +++++++++++ linphone-app/assets/languages/sv.ts | 30 +++++++++++ linphone-app/assets/languages/tr.ts | 30 +++++++++++ linphone-app/assets/languages/uk.ts | 30 +++++++++++ linphone-app/assets/languages/zh_CN.ts | 30 +++++++++++ .../src/components/call/CallModel.cpp | 2 +- .../src/components/calls/CallsListModel.cpp | 10 ++-- .../components/chat-room/ChatRoomModel.cpp | 4 +- .../conference/ConferenceAddModel.cpp | 4 +- .../settings/AccountSettingsModel.cpp | 22 +++++++- .../settings/AccountSettingsModel.hpp | 1 + .../sip-addresses/SipAddressesModel.cpp | 4 +- linphone-app/src/utils/LinphoneEnums.cpp | 15 ++++++ linphone-app/src/utils/LinphoneEnums.hpp | 16 ++++++ linphone-app/src/utils/Utils.cpp | 5 +- .../Common/Form/Placements/FormHGroup.qml | 2 +- linphone-app/ui/views/App/Main/Contacts.qml | 2 +- .../Dialogs/SettingsSipAccountsEdit.js | 8 +++ .../Dialogs/SettingsSipAccountsEdit.qml | 53 +++++++++++++++++++ 31 files changed, 609 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a3fe751d..bb952ad6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - New Chat Layout. - Display last seen for contacts. - New language support: Czech +- An option to set dial prefix and its use on numbers. ## 5.0.15 - undefined diff --git a/linphone-app/assets/languages/cs.ts b/linphone-app/assets/languages/cs.ts index 1e3b9dd23..90483c397 100644 --- a/linphone-app/assets/languages/cs.ts +++ b/linphone-app/assets/languages/cs.ts @@ -3337,6 +3337,36 @@ Klikněte zde: <a href="%1">%1</a> publishDurationLabel Délka publikování stavu (s) + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/da.ts b/linphone-app/assets/languages/da.ts index 6022b0e18..1e76bec4c 100644 --- a/linphone-app/assets/languages/da.ts +++ b/linphone-app/assets/languages/da.ts @@ -3300,6 +3300,36 @@ Klik her: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/de.ts b/linphone-app/assets/languages/de.ts index b2c5d12ff..dd74d13f2 100644 --- a/linphone-app/assets/languages/de.ts +++ b/linphone-app/assets/languages/de.ts @@ -3300,6 +3300,36 @@ Klicken Sie hier: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/en.ts b/linphone-app/assets/languages/en.ts index 8292832b9..44bc9956d 100644 --- a/linphone-app/assets/languages/en.ts +++ b/linphone-app/assets/languages/en.ts @@ -3324,6 +3324,36 @@ Click here: <a href="%1">%1</a> publishDurationLabel Publish duration (sec) + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + Prefix for your country + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + The prefix to use when using numbers without the '+' + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + Replace '+' by '00' + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + Replace '+' in addresses by '00' + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + Apply prefix for outgoing calls and chats + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + If a number is entered, apply the prefix to number + SettingsTunnel diff --git a/linphone-app/assets/languages/es.ts b/linphone-app/assets/languages/es.ts index 6f436e41d..f34dd5941 100644 --- a/linphone-app/assets/languages/es.ts +++ b/linphone-app/assets/languages/es.ts @@ -3300,6 +3300,36 @@ Haga clic aquí: <a href="%1">%1 </a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/fr_FR.ts b/linphone-app/assets/languages/fr_FR.ts index 400f510d0..243608499 100644 --- a/linphone-app/assets/languages/fr_FR.ts +++ b/linphone-app/assets/languages/fr_FR.ts @@ -3300,6 +3300,36 @@ Cliquez ici : <a href="%1">%1</a> publishDurationLabel Durée de présence (sec) + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + Préfixe de votre pays + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + Le préfixe à utiliser dans les numéros de téléphone sans le caractère '+' + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + Remplacer '+' par '00' + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + Remplacer le caractère '+' par '00' dans les numéros de téléphone + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + Applique le préfixe pour les appels sortants et les messages + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + Quand un nombre est saisi, applique le préfixe + SettingsTunnel diff --git a/linphone-app/assets/languages/hu.ts b/linphone-app/assets/languages/hu.ts index 02c9f3dc1..934f16451 100644 --- a/linphone-app/assets/languages/hu.ts +++ b/linphone-app/assets/languages/hu.ts @@ -3287,6 +3287,36 @@ Kattintson ide: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/it.ts b/linphone-app/assets/languages/it.ts index e26a867ec..0607b09b8 100644 --- a/linphone-app/assets/languages/it.ts +++ b/linphone-app/assets/languages/it.ts @@ -3300,6 +3300,36 @@ Clicca: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/ja.ts b/linphone-app/assets/languages/ja.ts index 619a14013..44b75ec40 100644 --- a/linphone-app/assets/languages/ja.ts +++ b/linphone-app/assets/languages/ja.ts @@ -3287,6 +3287,36 @@ publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/lt.ts b/linphone-app/assets/languages/lt.ts index 9450d94e1..34c68dba6 100644 --- a/linphone-app/assets/languages/lt.ts +++ b/linphone-app/assets/languages/lt.ts @@ -3313,6 +3313,36 @@ Spustelėkite čia: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/pt_BR.ts b/linphone-app/assets/languages/pt_BR.ts index c648e6c99..f4aaa8faa 100644 --- a/linphone-app/assets/languages/pt_BR.ts +++ b/linphone-app/assets/languages/pt_BR.ts @@ -3300,6 +3300,36 @@ Clique aqui: <a href="%1">%1 </a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/ru.ts b/linphone-app/assets/languages/ru.ts index 1826546f1..1b46e9498 100644 --- a/linphone-app/assets/languages/ru.ts +++ b/linphone-app/assets/languages/ru.ts @@ -3313,6 +3313,36 @@ publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/sv.ts b/linphone-app/assets/languages/sv.ts index b68d6d254..3cda32e05 100644 --- a/linphone-app/assets/languages/sv.ts +++ b/linphone-app/assets/languages/sv.ts @@ -3300,6 +3300,36 @@ Klicka här: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/tr.ts b/linphone-app/assets/languages/tr.ts index d4f44e567..93dcaff17 100644 --- a/linphone-app/assets/languages/tr.ts +++ b/linphone-app/assets/languages/tr.ts @@ -3287,6 +3287,36 @@ Buraya tıklayın: <a href="%1">%1</a> publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/uk.ts b/linphone-app/assets/languages/uk.ts index e78b50949..3523d7e5f 100644 --- a/linphone-app/assets/languages/uk.ts +++ b/linphone-app/assets/languages/uk.ts @@ -3313,6 +3313,36 @@ publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/assets/languages/zh_CN.ts b/linphone-app/assets/languages/zh_CN.ts index 59c5aa611..6130aebd7 100644 --- a/linphone-app/assets/languages/zh_CN.ts +++ b/linphone-app/assets/languages/zh_CN.ts @@ -3287,6 +3287,36 @@ publishDurationLabel + + dialPrefix + 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + + + + dialPrefixTooptip + "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + + + + dialEscapePlus + "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + + + + dialEscapePlusTooltip + 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + + + + dialPrefixCallChat + 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + + + + dialPrefixCallChatTooltip + 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + + SettingsTunnel diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 96179a553..cb441f0de 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -168,7 +168,7 @@ std::shared_ptr CallModel::getConferenceAddress () const{ if (mCall->getDir() == linphone::Call::Dir::Incoming){ if( remoteContact != "" ) - conferenceAddress = CoreManager::getInstance()->getCore()->interpretUrl(remoteContact); + conferenceAddress = Utils::interpretUrl(Utils::coreStringToAppString(remoteContact)); }else conferenceAddress = mCall->getRemoteAddress()->clone(); } diff --git a/linphone-app/src/components/calls/CallsListModel.cpp b/linphone-app/src/components/calls/CallsListModel.cpp index 8dad2c7cd..0b446080d 100644 --- a/linphone-app/src/components/calls/CallsListModel.cpp +++ b/linphone-app/src/components/calls/CallsListModel.cpp @@ -136,7 +136,7 @@ void CallsListModel::launchSecureAudioCall (const QString &sipAddress, LinphoneE CoreManager::getInstance()->getTimelineListModel()->mAutoSelectAfterCreation = true; shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr address = core->interpretUrl(Utils::appStringToCoreString(sipAddress)); + shared_ptr address = Utils::interpretUrl(sipAddress); if (!address) return; @@ -180,7 +180,7 @@ void CallsListModel::launchVideoCall (const QString &sipAddress, const QString& return; } - shared_ptr address = core->interpretUrl(Utils::appStringToCoreString(sipAddress)); + shared_ptr address = Utils::interpretUrl(sipAddress); if (!address) return; @@ -215,7 +215,7 @@ QVariantMap CallsListModel::launchChat(const QString &sipAddress, const int& sec ChatRoomModel* CallsListModel::createChat (const QString &participantAddress) const{ CoreManager::getInstance()->getTimelineListModel()->mAutoSelectAfterCreation = true; shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr address = core->interpretUrl(Utils::appStringToCoreString(participantAddress)); + shared_ptr address = Utils::interpretUrl(participantAddress); if (!address) return nullptr; @@ -248,7 +248,7 @@ ChatRoomModel* CallsListModel::createChat (CallModel * model){ bool CallsListModel::createSecureChat (const QString& subject, const QString &participantAddress) const{ CoreManager::getInstance()->getTimelineListModel()->mAutoSelectAfterCreation = true; shared_ptr core = CoreManager::getInstance()->getCore(); - shared_ptr address = core->interpretUrl(Utils::appStringToCoreString(participantAddress)); + shared_ptr address = Utils::interpretUrl(participantAddress); if (!address) return false; @@ -472,7 +472,7 @@ void CallsListModel::terminateAllCalls () const { } void CallsListModel::terminateCall (const QString& sipAddress) const{ auto coreManager = CoreManager::getInstance(); - shared_ptr address = coreManager->getCore()->interpretUrl(Utils::appStringToCoreString(sipAddress)); + shared_ptr address = Utils::interpretUrl(sipAddress); if (!address) qWarning() << "Cannot terminate Call. The address cannot be parsed : " << sipAddress; else{ diff --git a/linphone-app/src/components/chat-room/ChatRoomModel.cpp b/linphone-app/src/components/chat-room/ChatRoomModel.cpp index 3ab296a49..723baf764 100644 --- a/linphone-app/src/components/chat-room/ChatRoomModel.cpp +++ b/linphone-app/src/components/chat-room/ChatRoomModel.cpp @@ -1256,9 +1256,7 @@ void ChatRoomModel::handlePresenceStatusReceived(std::shared_ptrgetVcardModel()->getSipAddresses(); for(auto friendAddress = friendsAddresses.begin() ; !canUpdatePresence && friendAddress != friendsAddresses.end() ; ++friendAddress){ - shared_ptr lAddress = CoreManager::getInstance()->getCore()->interpretUrl( - Utils::appStringToCoreString(friendAddress->toString()) - ); + shared_ptr lAddress = Utils::interpretUrl(friendAddress->toString()); canUpdatePresence = lAddress->weakEqual(*itContactAddress); } } diff --git a/linphone-app/src/components/conference/ConferenceAddModel.cpp b/linphone-app/src/components/conference/ConferenceAddModel.cpp index 852b1c93d..e691e50bd 100644 --- a/linphone-app/src/components/conference/ConferenceAddModel.cpp +++ b/linphone-app/src/components/conference/ConferenceAddModel.cpp @@ -94,9 +94,7 @@ bool ConferenceHelperModel::ConferenceAddModel::addToConference (const QString & if (mSipAddresses.contains(sipAddress)) return false; - shared_ptr address = CoreManager::getInstance()->getCore()->interpretUrl( - Utils::appStringToCoreString(sipAddress) - ); + shared_ptr address = Utils::interpretUrl(sipAddress); if (!address) return false; diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 2e920cf17..9de62de80 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -172,6 +172,9 @@ QVariantMap AccountSettingsModel::getAccountDescription (const shared_ptrpublishEnabled(); map["avpfEnabled"] = accountParams->getAvpfMode() == linphone::AVPFMode::Enabled; map["registrationState"] = mapLinphoneRegistrationStateToUi(account->getState()); + map["dialPrefix"] = Utils::coreStringToAppString(accountParams->getInternationalPrefix()); + map["dialPrefixCallChat"] = accountParams->getUseInternationalPrefixForCallsAndChats(); + map["dialEscapePlus"] = accountParams->dialEscapePlusEnabled(); shared_ptr natPolicy = accountParams->getNatPolicy(); bool createdNat = !natPolicy; @@ -222,6 +225,16 @@ QString AccountSettingsModel::getLimeServerUrl() const{ return account ? Utils::coreStringToAppString(account->getParams()->getLimeServerUrl()) : ""; } +bool AccountSettingsModel::getUseInternationalPrefixForCallsAndChats() const{ + shared_ptr core = CoreManager::getInstance()->getCore(); + if(core){ + shared_ptr account = core->getDefaultAccount(); + if(account) + return account->getParams()->getUseInternationalPrefixForCallsAndChats(); + } + return false; +} + void AccountSettingsModel::setDefaultAccount (const shared_ptr &account) { shared_ptr core = CoreManager::getInstance()->getCore(); if (mSelectedAccount != account) { @@ -351,6 +364,13 @@ bool AccountSettingsModel::addOrUpdateAccount( ? linphone::AVPFMode::Enabled : linphone::AVPFMode::Default ); + if(data.contains("dialPrefix")) + accountParams->setInternationalPrefix(Utils::appStringToCoreString(data["dialPrefix"].toString())); + if(data.contains("dialPrefixCallChat")) + accountParams->setUseInternationalPrefixForCallsAndChats(data["dialPrefixCallChat"].toBool()); + if(data.contains("dialEscapePlus")) + accountParams->enableDialEscapePlus(data["dialEscapePlus"].toBool()); + shared_ptr natPolicy = accountParams->getNatPolicy(); bool createdNat = !natPolicy; @@ -401,7 +421,7 @@ bool AccountSettingsModel::addOrUpdateAccount ( ) { shared_ptr account; QString sipAddress = data["sipAddress"].toString(); - shared_ptr address = CoreManager::getInstance()->getCore()->interpretUrl(sipAddress.toStdString()); + shared_ptr address = Utils::interpretUrl(sipAddress); for (const auto &databaseAccount : CoreManager::getInstance()->getAccountList()) if (databaseAccount->getParams()->getIdentityAddress()->weakEqual(address)) { diff --git a/linphone-app/src/components/settings/AccountSettingsModel.hpp b/linphone-app/src/components/settings/AccountSettingsModel.hpp index 65ef2c1ec..3255c4f7e 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.hpp @@ -76,6 +76,7 @@ public: QString getConferenceUri() const; QString getVideoConferenceUri() const; QString getLimeServerUrl() const; + bool getUseInternationalPrefixForCallsAndChats() const; Q_INVOKABLE void setDefaultAccount (const std::shared_ptr &account = nullptr); Q_INVOKABLE void setDefaultAccountFromSipAddress (const QString &sipAddress); diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index 7de54dbda..c2fad8035 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -192,9 +192,7 @@ QString SipAddressesModel::addTransportToSipAddress (const QString &sipAddress, // ----------------------------------------------------------------------------- QString SipAddressesModel::interpretSipAddress (const QString &sipAddress, bool checkUsername) { - shared_ptr lAddress = CoreManager::getInstance()->getCore()->interpretUrl( - Utils::appStringToCoreString(sipAddress) - ); + shared_ptr lAddress = Utils::interpretUrl(sipAddress); if (lAddress && (!checkUsername || !lAddress->getUsername().empty())) return Utils::coreStringToAppString(lAddress->asStringUriOnly()); diff --git a/linphone-app/src/utils/LinphoneEnums.cpp b/linphone-app/src/utils/LinphoneEnums.cpp index 5b8aa6a7a..0341ab5e6 100644 --- a/linphone-app/src/utils/LinphoneEnums.cpp +++ b/linphone-app/src/utils/LinphoneEnums.cpp @@ -38,6 +38,21 @@ void LinphoneEnums::registerMetaTypes(){ qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); + + qRegisterMetaType>(); + qRegisterMetaType(); + qRegisterMetaType>(); + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType>(); + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType>(); + qRegisterMetaType>(); + qRegisterMetaType>(); + qRegisterMetaType>(); } linphone::MediaEncryption LinphoneEnums::toLinphone(const LinphoneEnums::MediaEncryption& data){ diff --git a/linphone-app/src/utils/LinphoneEnums.hpp b/linphone-app/src/utils/LinphoneEnums.hpp index 4fed4a75c..228fc1355 100644 --- a/linphone-app/src/utils/LinphoneEnums.hpp +++ b/linphone-app/src/utils/LinphoneEnums.hpp @@ -231,4 +231,20 @@ Q_DECLARE_METATYPE(LinphoneEnums::RecorderState) Q_DECLARE_METATYPE(LinphoneEnums::TunnelMode) Q_DECLARE_METATYPE(LinphoneEnums::TransportType) +Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(linphone::Call::State) +Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(linphone::ConfiguringState) +Q_DECLARE_METATYPE(std::string) +Q_DECLARE_METATYPE(linphone::GlobalState) +Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(linphone::ChatRoom::State) +Q_DECLARE_METATYPE(linphone::RegistrationState) +Q_DECLARE_METATYPE(linphone::VersionUpdateCheckResult) +Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(std::shared_ptr) +Q_DECLARE_METATYPE(std::shared_ptr) + + #endif diff --git a/linphone-app/src/utils/Utils.cpp b/linphone-app/src/utils/Utils.cpp index c6866c6a3..bab715376 100644 --- a/linphone-app/src/utils/Utils.cpp +++ b/linphone-app/src/utils/Utils.cpp @@ -64,12 +64,13 @@ constexpr int SafeFilePathLimit = 100; } std::shared_ptr Utils::interpretUrl(const QString& address){ - auto interpretedAddress = CoreManager::getInstance()->getCore()->interpretUrl(Utils::appStringToCoreString(address), true); + bool usePrefix = CoreManager::getInstance()->getAccountSettingsModel()->getUseInternationalPrefixForCallsAndChats(); + auto interpretedAddress = CoreManager::getInstance()->getCore()->interpretUrl(Utils::appStringToCoreString(address), usePrefix); if(!interpretedAddress){// Try by removing scheme. QStringList splitted = address.split(":"); if(splitted.size() > 0 && splitted[0] == "sip"){ splitted.removeFirst(); - interpretedAddress = CoreManager::getInstance()->getCore()->interpretUrl(Utils::appStringToCoreString(splitted.join(":")), true); + interpretedAddress = CoreManager::getInstance()->getCore()->interpretUrl(Utils::appStringToCoreString(splitted.join(":")), usePrefix); } } return interpretedAddress; diff --git a/linphone-app/ui/modules/Common/Form/Placements/FormHGroup.qml b/linphone-app/ui/modules/Common/Form/Placements/FormHGroup.qml index 58de9ea70..43b8bb8a8 100644 --- a/linphone-app/ui/modules/Common/Form/Placements/FormHGroup.qml +++ b/linphone-app/ui/modules/Common/Form/Placements/FormHGroup.qml @@ -23,7 +23,7 @@ RowLayout { id: label computeFitWidth: parent.fitLabel Layout.preferredHeight: FormHGroupStyle.legend.height - Layout.preferredWidth: fitLabel ? Math.min(label.fitWidth, FormHGroupStyle.legend.width) : FormHGroupStyle.legend.width + Layout.preferredWidth: fitLabel ? label.fitWidth : FormHGroupStyle.legend.width color: FormHGroupStyle.legend.colorModel.color elide: Text.ElideRight diff --git a/linphone-app/ui/views/App/Main/Contacts.qml b/linphone-app/ui/views/App/Main/Contacts.qml index 75bb237d9..6420d42ce 100644 --- a/linphone-app/ui/views/App/Main/Contacts.qml +++ b/linphone-app/ui/views/App/Main/Contacts.qml @@ -120,7 +120,7 @@ ColumnLayout { color: ContactsStyle.contact.presence.colorModel.color elide: Text.ElideRight font.pointSize: ContactsStyle.contact.presence.pointSize - text: presenceLevel.presenceText + text: presenceLevel.text visible: presenceLevel.visible } } diff --git a/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.js b/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.js index 94474f1b5..5944ef4ec 100644 --- a/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.js +++ b/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.js @@ -59,6 +59,11 @@ function initForm (account) { registerEnabled.checked = config.registerEnabled publishPresence.checked = config.publishPresence avpfEnabled.checked = config.avpfEnabled + + dialPrefixCallChat.checked = config.dialPrefixCallChat + dialPrefix.text = config.dialPrefix + dialEscapePlus.checked = config.dialEscapePlus + iceEnabled.checked = config.iceEnabled turnEnabled.checked = config.turnEnabled stunServer.text = config.stunServer @@ -95,6 +100,9 @@ function validAccount (account) { registerEnabled: registerEnabled.checked, publishPresence: publishPresence.checked, avpfEnabled: avpfEnabled.checked, + dialPrefix: dialPrefix.text, + dialPrefixCallChat: dialPrefixCallChat.checked, + dialEscapePlus: dialEscapePlus.checked, iceEnabled: iceEnabled.checked, turnEnabled: turnEnabled.checked, stunServer: stunServer.text, diff --git a/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.qml b/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.qml index dace6beee..e066c705a 100644 --- a/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.qml +++ b/linphone-app/ui/views/App/Settings/Dialogs/SettingsSipAccountsEdit.qml @@ -1,4 +1,5 @@ import QtQuick 2.7 +import QtQuick.Layouts 1.3 import Common 1.0 @@ -254,6 +255,58 @@ DialogPlus { } } } + FormLine { + FormGroup { + //: 'Prefix for your country' : Label for a text option to set the country code on the phone numbers. + label: qsTr('dialPrefix') + + NumericField { + id: dialPrefix + Keys.onEnterPressed: route.forceActiveFocus() + Keys.onReturnPressed: route.forceActiveFocus() + TooltipArea{ + tooltipParent: dialPrefix + //: "The prefix to use when using numbers without the '+'" : tooltip for a text option to set the country code on the phone numbers. + text: qsTr('dialPrefixTooptip') + } + } + } + FormGroup { + //: "Replace '+' by '00'" : Label to an option for escaping the '+' character when dialing. + label: qsTr('dialEscapePlus') + + Switch { + id: dialEscapePlus + + onClicked: checked = !checked + TooltipArea{ + tooltipParent: dialEscapePlus + //: 'Replace + in addresses by 00' : tooltip for an option that allow escaping the '+' character in phone number. + text: qsTr('dialEscapePlusTooltip') + } + } + } + + } + FormLine{ + maxItemWidth: width / 2 + FormGroup { + //: 'Apply prefix for outgoing calls and chats' : Label to set an option for applying the specified prefix to outgoings calls and chats. + label: qsTr('dialPrefixCallChat') + fitLabel: true + maxWidth: parent.width + Switch { + id: dialPrefixCallChat + + onClicked: checked = !checked + TooltipArea{ + tooltipParent: dialPrefixCallChat + //: 'If a number is entered, apply the prefix to number' : tooltip for an option to applying the country prefix to numbers. + text: qsTr('dialPrefixCallChatTooltip') + } + } + } + } } // -----------------------------------------------------------------------