fix(SettingsSipAccountsEdit): detect correctly sip addresses

This commit is contained in:
Ronan Abhamon 2017-07-19 16:00:55 +02:00
parent ff985c090c
commit 1a31ab06d7
3 changed files with 11 additions and 3 deletions

View file

@ -175,12 +175,19 @@ QString SipAddressesModel::interpretUrl (const QUrl &sipAddress) {
return sipAddress.toString();
}
bool SipAddressesModel::sipAddressIsValid (const QString &sipAddress) {
bool SipAddressesModel::addressIsValid (const QString &address) {
return !!linphone::Factory::get()->createAddress(
::Utils::appStringToCoreString(sipAddress)
::Utils::appStringToCoreString(address)
);
}
bool SipAddressesModel::sipAddressIsValid (const QString &sipAddress) {
shared_ptr<linphone::Address> address = linphone::Factory::get()->createAddress(
::Utils::appStringToCoreString(sipAddress)
);
return address && !address->getUsername().empty();
}
// -----------------------------------------------------------------------------
bool SipAddressesModel::removeRow (int row, const QModelIndex &parent) {

View file

@ -59,6 +59,7 @@ public:
Q_INVOKABLE static QString interpretUrl (const QString &sipAddress);
Q_INVOKABLE static QString interpretUrl (const QUrl &sipAddress);
Q_INVOKABLE static bool addressIsValid (const QString &address);
Q_INVOKABLE static bool sipAddressIsValid (const QString &sipAddress);
// ---------------------------------------------------------------------------

View file

@ -73,7 +73,7 @@ function validProxyConfig () {
// -----------------------------------------------------------------------------
function handleRouteChanged (route) {
dialog._routeOk = route.length === 0 || Linphone.SipAddressesModel.sipAddressIsValid(route)
dialog._routeOk = route.length === 0 || Linphone.SipAddressesModel.addressIsValid(route)
}
function handleServerAddressChanged (address) {