diff --git a/src/account.cpp b/src/account.cpp index 839930f2681e5847e68d67cf4ea8227a353ab05c..d29cebd2794cd6543bdc34e755638265b87c90d8 100644 --- a/src/account.cpp +++ b/src/account.cpp @@ -858,6 +858,16 @@ bool Account::useDefaultPort() const return d_ptr->m_UseDefaultPort; } +bool Account::isTurnEnabled() const +{ + return d_ptr->accountDetail(DRing::Account::ConfProperties::TURN::ENABLED) IS_TRUE; +} + +QString Account::turnServer() const +{ + return d_ptr->accountDetail(DRing::Account::ConfProperties::TURN::SERVER); +} + #define CAST(item) static_cast<int>(item) QVariant Account::roleData(int role) const { @@ -971,6 +981,10 @@ QVariant Account::roleData(int role) const return trimesterCallCount(); case CAST(Account::Role::LastUsed): return (int)lastUsed(); + case CAST(Account::Role::SipTurnServer): + return turnServer(); + case CAST(Account::Role::SipTurnEnabled): + return isTurnEnabled(); default: return QVariant(); } @@ -1467,7 +1481,7 @@ void Account::setUseDefaultPort(bool value) switch (protocol()) { case Account::Protocol::SIP: case Account::Protocol::IAX: - setLocalPort(5060); + setLocalPort(5060); //FIXME check is TLS is used break; case Account::Protocol::RING: setLocalPort(5061); @@ -1479,6 +1493,16 @@ void Account::setUseDefaultPort(bool value) d_ptr->m_UseDefaultPort = value; } +void Account::setTurnEnabled(bool value) +{ + d_ptr->setAccountProperty(DRing::Account::ConfProperties::TURN::ENABLED, (value)TO_BOOL); +} + +void Account::setTurnServer(const QString& value) +{ + d_ptr->setAccountProperty(DRing::Account::ConfProperties::TURN::SERVER, value); +} + ///Set the DTMF type void Account::setDTMFType(DtmfType type) { diff --git a/src/account.h b/src/account.h index 3476be4ae4078fa5722e6df78a8ae158aadf850c..e84af502815d6e55a911a8671572045722fc54d3 100644 --- a/src/account.h +++ b/src/account.h @@ -230,6 +230,8 @@ class LIB_EXPORT Account : public QObject { WeekCallCount = 148, TrimesterCallCount = 149, LastUsed = 150, + SipTurnServer = 151, + SipTurnEnabled = 152, }; enum class Protocol { @@ -323,6 +325,8 @@ class LIB_EXPORT Account : public QObject { QString lastTransportErrorMessage () const; QString userAgent () const; bool useDefaultPort () const; + bool isTurnEnabled () const; + QString turnServer () const; RegistrationState registrationState () const; Protocol protocol () const; KeyExchangeModel::Type keyExchange () const; @@ -358,6 +362,7 @@ class LIB_EXPORT Account : public QObject { void setLocalInterface (const QString& detail ); void setRingtonePath (const QString& detail ); void setLastErrorMessage (const QString& message ); + void setTurnServer (const QString& value ); void setKeyExchange (KeyExchangeModel::Type detail); void setLastErrorCode (int code ); void setVoiceMailCount (int count ); @@ -391,6 +396,7 @@ class LIB_EXPORT Account : public QObject { void setUpnpEnabled (bool enable); void setHasCustomUserAgent (bool enable); void setUseDefaultPort (bool value ); + void setTurnEnabled (bool value ); void setRoleData(int role, const QVariant& value); diff --git a/src/accountmodel.cpp b/src/accountmodel.cpp index 87200504bf688ed777ad71df34534785c0041787..ac01f1da812aa3c35291174ffd3351806dcb2e0d 100644 --- a/src/accountmodel.cpp +++ b/src/accountmodel.cpp @@ -147,6 +147,8 @@ QHash<int,QByteArray> AccountModel::roleNames() const roles.insert(CAST(Account::Role::WeekCallCount ) ,QByteArray("weekCallCount" )); roles.insert(CAST(Account::Role::TrimesterCallCount ) ,QByteArray("trimesterCallCount" )); roles.insert(CAST(Account::Role::LastUsed ) ,QByteArray("lastUsed" )); + roles.insert(CAST(Account::Role::SipTurnServer ) ,QByteArray("sipTurnServer" )); + roles.insert(CAST(Account::Role::SipTurnEnabled ) ,QByteArray("sipTurnEnabled" )); } return roles; } diff --git a/src/keyexchangemodel.cpp b/src/keyexchangemodel.cpp index 270eb277d9b04b3be488f53fe93729be9634aaec..39b09f1db43333e08b97a208967e997caa8a3b5a 100644 --- a/src/keyexchangemodel.cpp +++ b/src/keyexchangemodel.cpp @@ -96,7 +96,7 @@ int KeyExchangeModel::rowCount( const QModelIndex& parent ) const Qt::ItemFlags KeyExchangeModel::flags( const QModelIndex& index ) const { if (!index.isValid()) return Qt::NoItemFlags; - return Qt::ItemIsEnabled|Qt::ItemIsSelectable; + return index.row()!=(int)KeyExchangeModel::Type::ZRTP?(Qt::ItemIsEnabled|Qt::ItemIsSelectable):Qt::NoItemFlags; } bool KeyExchangeModel::setData( const QModelIndex& index, const QVariant &value, int role)