[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [sflphone-kde] src: [ #30839 ] Better handling of KeyExchnage categories
From:       Emmanuel Lepage Vallee <emmanuel.lepage () savoirfairelinux ! com>
Date:       2013-09-30 19:50:51
Message-ID: E1VQjUZ-0006P3-IV () scm ! kde ! org
[Download RAW message or body]

Git commit 255047f94652ea4fe87aa671f8c0d242068e571a by Emmanuel Lepage Vallee.
Committed on 30/09/2013 at 16:35.
Pushed by lepagevalleeemmanuel into branch 'master'.

[ #30839 ] Better handling of KeyExchnage categories

This helped discover a serious bug in security handling. It cannot
be explpoited because the feature is downright broken. Will be fixed
next.

M  +6    -6    src/accountwizard.cpp
M  +36   -33   src/conf/dlgaccounts.cpp
M  +0    -15   src/conf/dlgaccountsbase.ui
M  +2    -0    src/lib/CMakeLists.txt
M  +54   -51   src/lib/account.cpp
M  +36   -35   src/lib/account.h
M  +6    -6    src/lib/accountlistmodel.cpp
M  +1    -1    src/lib/call.cpp
A  +77   -0    src/lib/keyexchangemodel.cpp     [License: LGPL (v2.1+)]
A  +65   -0    src/lib/keyexchangemodel.h     [License: LGPL (v2.1+)]
M  +2    -2    src/lib/sflphone_const.h
M  +5    -5    src/sflphoneview.cpp
M  +2    -2    src/widgets/bookmarkdock.cpp

http://commits.kde.org/sflphone-kde/255047f94652ea4fe87aa671f8c0d242068e571a

diff --git a/src/accountwizard.cpp b/src/accountwizard.cpp
index b457eb5..63de55b 100644
--- a/src/accountwizard.cpp
+++ b/src/accountwizard.cpp
@@ -302,12 +302,12 @@ void AccountWizard::accept()
       }
 
       if(field(FIELD_ZRTP_ENABLED).toBool()) {
-         srtp_enabled          = QString( REGISTRATION_ENABLED_TRUE  );
-         key_exchange          = QString( ZRTP                       );
-         zrtp_display_sas      = QString( REGISTRATION_ENABLED_TRUE  );
-         zrtp_not_supp_warning = QString( REGISTRATION_ENABLED_TRUE  );
-         zrtp_hello_hash       = QString( REGISTRATION_ENABLED_TRUE  );
-         display_sas_once      = QString( REGISTRATION_ENABLED_FALSE );
+         srtp_enabled          = QString( REGISTRATION_ENABLED_TRUE       );
+         key_exchange          = QString( KeyExchangeModel::Name::ZRTP );
+         zrtp_display_sas      = QString( REGISTRATION_ENABLED_TRUE       );
+         zrtp_not_supp_warning = QString( REGISTRATION_ENABLED_TRUE       );
+         zrtp_hello_hash       = QString( REGISTRATION_ENABLED_TRUE       );
+         display_sas_once      = QString( REGISTRATION_ENABLED_FALSE      );
       }
 
       QStringList ifaceList = configurationManager.getAllIpInterface();
diff --git a/src/conf/dlgaccounts.cpp b/src/conf/dlgaccounts.cpp
index a2ab4ad..ce72f36 100644
--- a/src/conf/dlgaccounts.cpp
+++ b/src/conf/dlgaccounts.cpp
@@ -42,6 +42,7 @@
 #include "lib/credentialmodel.h"
 #include "lib/audiocodecmodel.h"
 #include "lib/accountlistmodel.h"
+#include "lib/keyexchangemodel.h"
 
 //OS
 #ifdef Q_WS_WIN // MS Windows version
@@ -80,6 +81,8 @@ DlgAccounts::DlgAccounts(KConfigDialog* parent)
    loadAccountList();
    accountListHasChanged = false;
 
+   combo_security_STRP->setModel(KeyExchangeModel::instance());
+
    //SLOTS
    //                     SENDER                            SIGNAL                   \
RECEIVER              SLOT                          /  /**/connect(edit1_alias,       \
SIGNAL(textEdited(QString))            , this   , SLOT(changedAccountList())          \
); @@ -194,24 +197,24 @@ void DlgAccounts::saveAccount(QModelIndex item)
       return;
    }
    m_IsLoading++;
-   
+
    if (!m_pProxyCK->isChecked()) {
       m_pProxyLE->setText("");
    }
-   
+
    QString protocolsTab[] = ACCOUNT_TYPES_TAB;
-   
+
    //ACCOUNT DETAILS
    //                                                                     WIDGET \
                VALUE                                     /
-   /**/account->setAccountType                 ( \
protocolsTab[edit2_protocol->currentIndex()]                             ); +   \
/**/account->setType                        ( \
protocolsTab[edit2_protocol->currentIndex()]                             );  \
/**/account->setAlias                       ( edit1_alias->text()                     \
);  /**/account->setHostname                    ( edit3_server->text()                \
);  /**/account->setUsername                    ( edit4_user->text()                  \
                );
-   /**/account->setAccountPassword             ( edit5_password->text()              \
); +   /**/account->setPassword                    ( edit5_password->text()           \
);  /**/account->setMailbox                     ( edit6_mailbox->text()               \
);  /**/account->setProxy                       ( m_pProxyLE->text()                  \
);  /**/account->setEnabled                     ( \
                item.data(Qt::CheckStateRole).toBool()                                \
                );
-   /**/account->setAccountRegistrationExpire   ( spinbox_regExpire->value()          \
); +   /**/account->setRegistrationExpire          ( spinbox_regExpire->value()       \
);  /**/                                                                              \
/**/  /*                                            Security                          \
*/  /**/account->setTlsPassword                 ( \
edit_tls_private_key_password->text()                                    ); @@ -219,7 \
+222,7 @@ void DlgAccounts::saveAccount(QModelIndex item)  \
/**/account->setTlsCaListFile               ( file_tls_authority->text()              \
);  /**/account->setTlsCertificateFile          ( file_tls_endpoint->text()           \
);  /**/account->setTlsPrivateKeyFile           ( file_tls_private_key->text()        \
                );
-   /**/account->setTlsMethod                   ( combo_tls_method->currentIndex()    \
); +   /**/account->setTlsMethod                   ( \
static_cast<KeyExchangeModel::Type>(combo_tls_method->currentIndex())   );  \
/**/account->setTlsCiphers                  ( edit_tls_cipher->text()                 \
);  /**/account->setTlsServerName               ( edit_tls_outgoing->text()           \
);  /**/account->setTlsNegotiationTimeoutSec    ( spinbox_tls_timeout_sec->value()    \
); @@ -229,14 +232,14 @@ void DlgAccounts::saveAccount(QModelIndex item)
    /**/account->setTlsVerifyClient             ( check_tls_answer->isChecked()       \
);  /**/account->setTlsRequireClientCertificate ( check_tls_requier_cert->isChecked() \
);  /**/account->setTlsEnable                   ( group_security_tls->isChecked()     \
                );
-   /**/account->setAccountDisplaySasOnce       ( checkbox_ZRTP_Ask_user->isChecked() \
                );
-   /**/account->setAccountSrtpRtpFallback      ( \
                checkbox_SDES_fallback_rtp->isChecked()                               \
                );
-   /**/account->setAccountZrtpDisplaySas       ( \
                checkbox_ZRTP_display_SAS->isChecked()                                \
                );
-   /**/account->setAccountZrtpNotSuppWarning   ( \
                checkbox_ZRTP_warn_supported->isChecked()                             \
                );
-   /**/account->setAccountZrtpHelloHash        ( \
                checkbox_ZTRP_send_hello->isChecked()                                 \
                );
-   /**/account->setAccountSipStunEnabled       ( checkbox_stun->isChecked()          \
); +   /**/account->setDisplaySasOnce              ( \
checkbox_ZRTP_Ask_user->isChecked()                                      ); +   \
/**/account->setSrtpRtpFallback             ( checkbox_SDES_fallback_rtp->isChecked() \
); +   /**/account->setZrtpDisplaySas              ( \
checkbox_ZRTP_display_SAS->isChecked()                                   ); +   \
/**/account->setZrtpNotSuppWarning          ( \
checkbox_ZRTP_warn_supported->isChecked()                                ); +   \
/**/account->setZrtpHelloHash               ( checkbox_ZTRP_send_hello->isChecked()   \
); +   /**/account->setSipStunEnabled              ( checkbox_stun->isChecked()       \
);  /**/account->setPublishedSameAsLocal        ( \
                radioButton_pa_same_as_local->isChecked()                             \
                );
-   /**/account->setAccountSipStunServer        ( line_stun->text()                   \
); +   /**/account->setSipStunServer               ( line_stun->text()                \
);  /**/account->setPublishedPort               ( spinBox_pa_published_port->value()  \
);  /**/account->setPublishedAddress            ( lineEdit_pa_published_address \
->text()                                   );  /**/account->setLocalPort              \
( spinBox_pa_published_port->value()                                       ); @@ \
-299,8 +302,8 @@ void DlgAccounts::loadAccount(QModelIndex item)  \
protocolsList->append(protocolsTab[i]);  }
 
-   const QString accountName = account->accountType();
-   int protocolIndex = protocolsList->indexOf(accountName);
+   const QString accountType = account->type();
+   const int protocolIndex = protocolsList->indexOf(accountType);
    delete protocolsList;
 
 
@@ -317,21 +320,21 @@ void DlgAccounts::loadAccount(QModelIndex item)
    connect(account,SIGNAL(aliasChanged(QString)),this,SLOT(aliasChanged(QString)));
 
    switch (account->tlsMethod()) {
-      case 0: //KEY_EXCHANGE_NONE
+      case KeyExchangeModel::Type::NONE:
          checkbox_SDES_fallback_rtp->setVisible   ( false );
          checkbox_ZRTP_Ask_user->setVisible       ( false );
          checkbox_ZRTP_display_SAS->setVisible    ( false );
          checkbox_ZRTP_warn_supported->setVisible ( false );
          checkbox_ZTRP_send_hello->setVisible     ( false );
          break;
-      case 1: //ZRTP
+      case KeyExchangeModel::Type::ZRTP:
          checkbox_SDES_fallback_rtp->setVisible   ( false );
          checkbox_ZRTP_Ask_user->setVisible       ( true  );
          checkbox_ZRTP_display_SAS->setVisible    ( true  );
          checkbox_ZRTP_warn_supported->setVisible ( true  );
          checkbox_ZTRP_send_hello->setVisible     ( true  );
          break;
-      case 2: //SDES
+      case KeyExchangeModel::Type::SDES:
          checkbox_SDES_fallback_rtp->setVisible   ( true  );
          checkbox_ZRTP_Ask_user->setVisible       ( false );
          checkbox_ZRTP_display_SAS->setVisible    ( false );
@@ -346,14 +349,14 @@ void DlgAccounts::loadAccount(QModelIndex item)
    /**/edit4_user->setText                      (  account->username                 \
());  /**/edit6_mailbox->setText                   (  account->mailbox                \
());  /**/m_pProxyLE->setText                      (  account->proxy                  \
                ());
-   /**/checkbox_ZRTP_Ask_user->setChecked       (  account->isAccountDisplaySasOnce  \
                ());
-   /**/checkbox_SDES_fallback_rtp->setChecked   (  account->isAccountSrtpRtpFallback \
                ());
-   /**/checkbox_ZRTP_display_SAS->setChecked    (  account->isAccountZrtpDisplaySas  \
                ());
-   /**/checkbox_ZRTP_warn_supported->setChecked (  \
                account->isAccountZrtpNotSuppWarning    ());
-   /**/checkbox_ZTRP_send_hello->setChecked     (  account->isAccountZrtpHelloHash   \
                ());
-   /**/checkbox_stun->setChecked                (  account->isAccountSipStunEnabled  \
                ());
-   /**/line_stun->setText                       (  account->accountSipStunServer     \
                ());
-   /**/spinbox_regExpire->setValue              (  \
account->accountRegistrationExpire      ()); +   \
/**/checkbox_ZRTP_Ask_user->setChecked       (  account->isDisplaySasOnce             \
()); +   /**/checkbox_SDES_fallback_rtp->setChecked   (  account->isSrtpRtpFallback   \
()); +   /**/checkbox_ZRTP_display_SAS->setChecked    (  account->isZrtpDisplaySas    \
()); +   /**/checkbox_ZRTP_warn_supported->setChecked (  \
account->isZrtpNotSuppWarning           ()); +   \
/**/checkbox_ZTRP_send_hello->setChecked     (  account->isZrtpHelloHash              \
()); +   /**/checkbox_stun->setChecked                (  account->isSipStunEnabled    \
()); +   /**/line_stun->setText                       (  account->sipStunServer       \
()); +   /**/spinbox_regExpire->setValue              (  account->registrationExpire  \
());  /**/radioButton_pa_same_as_local->setChecked (  account->isPublishedSameAsLocal \
());  /**/radioButton_pa_custom->setChecked        ( !account->isPublishedSameAsLocal \
());  /**/lineEdit_pa_published_address->setText   (  account->publishedAddress       \
()); @@ -372,8 +375,8 @@ void DlgAccounts::loadAccount(QModelIndex item)
    /**/check_tls_answer->setChecked             (  account->isTlsVerifyClient        \
());  /**/check_tls_requier_cert->setChecked       (  \
account->isTlsRequireClientCertificate  ());  /**/group_security_tls->setChecked      \
                (  account->isTlsEnable                    ());
-   /**/combo_security_STRP->setCurrentIndex     (  account->tlsMethod                \
());  /**/m_pAutoAnswer->setChecked                (  account->isAutoAnswer           \
()); +   /**/combo_security_STRP->setCurrentIndex     (  \
KeyExchangeModel::instance()->toIndex(account->tlsMethod()).row());  /*               \
*/  
    m_pDTMFOverRTP->setChecked(account->DTMFType()==DtmfType::OverRtp);
@@ -435,7 +438,7 @@ void DlgAccounts::loadAccount(QModelIndex item)
    m_pRingTonePath->setUrl( ringtonePath );
 
 
-   combo_tls_method->setCurrentIndex( account->tlsMethod() );
+   combo_tls_method->setCurrentIndex( \
KeyExchangeModel::instance()->toIndex(account->tlsMethod()).row() );  \
ConfigurationManagerInterface& configurationManager = \
DBus::ConfigurationManager::instance();  
    m_pRingtoneListLW->clear();
@@ -480,8 +483,8 @@ void DlgAccounts::loadAccount(QModelIndex item)
       comboBox_ni_local_address->setCurrentIndex(0);
 
    if(protocolIndex == 0 || account->isNew()) { // if sip selected
-      checkbox_stun->setChecked(account->isAccountSipStunEnabled());
-      line_stun->setText( account->accountSipStunServer() );
+      checkbox_stun->setChecked(account->isSipStunEnabled());
+      line_stun->setText( account->sipStunServer() );
       //checkbox_zrtp->setChecked(account->accountDetail(ACCOUNT_SRTP_ENABLED) == \
REGISTRATION_ENABLED_TRUE);  
       tab_advanced->                setEnabled ( true                       );
@@ -492,7 +495,7 @@ void DlgAccounts::loadAccount(QModelIndex item)
    else {
       checkbox_stun->setChecked(false);
       tab_advanced->setEnabled (false);
-      line_stun->setText( account->accountSipStunServer() );
+      line_stun->setText( account->sipStunServer() );
       //checkbox_zrtp->setChecked(false);
    }
 
@@ -719,7 +722,7 @@ void DlgAccounts::updateStatusLabel(Account* account)
 {
    if(!account || AccountListModel::instance()->getAccountByModelIndex(listView_accountList->currentIndex()) \
!= account)  return;
-   const QString status = account->accountRegistrationStatus();
+   const QString status = account->registrationStatus();
    edit7_state->setText( "<FONT COLOR=\"" + account->stateColorName() + "\">" + \
status + "</FONT>" );  }
 
diff --git a/src/conf/dlgaccountsbase.ui b/src/conf/dlgaccountsbase.ui
index 22541b0..3206bbf 100644
--- a/src/conf/dlgaccountsbase.ui
+++ b/src/conf/dlgaccountsbase.ui
@@ -1322,21 +1322,6 @@
                      <verstretch>0</verstretch>
                     </sizepolicy>
                    </property>
-                   <item>
-                    <property name="text">
-                     <string comment="Disabled security">Disabled</string>
-                    </property>
-                   </item>
-                   <item>
-                    <property name="text">
-                     <string>ZRTP</string>
-                    </property>
-                   </item>
-                   <item>
-                    <property name="text">
-                     <string>SDES</string>
-                    </property>
-                   </item>
                   </widget>
                  </item>
                  <item>
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 465d437..6447521 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -65,6 +65,7 @@ set( qtsflphone_LIB_SRCS
   phonedirectorymodel.cpp
   historytimecategorymodel.cpp
   numbercategorymodel.cpp
+  keyexchangemodel.cpp
 
   #Communication
   dbus/configurationmanager.cpp
@@ -106,6 +107,7 @@ set( qtsflphone_LIB_HDRS
   historytimecategorymodel.h
   numbercategorymodel.h
   videocodec.h
+  keyexchangemodel.h
 )
 
 set( qtsflphone_extra_LIB_HDRS
diff --git a/src/lib/account.cpp b/src/lib/account.cpp
index ea70795..3c2f8a1 100644
--- a/src/lib/account.cpp
+++ b/src/lib/account.cpp
@@ -233,9 +233,9 @@ QModelIndex Account::index()
 ///Return status color name
 QString Account::stateColorName() const
 {
-   if(accountRegistrationStatus() == Account::State::UNREGISTERED)
+   if(registrationStatus() == Account::State::UNREGISTERED)
       return "black";
-   if(accountRegistrationStatus() == Account::State::REGISTERED || \
accountRegistrationStatus() == Account::State::READY) +   if(registrationStatus() == \
Account::State::REGISTERED || registrationStatus() == Account::State::READY)  return \
"darkGreen";  return "red";
 }
@@ -318,49 +318,49 @@ QString Account::proxy() const
 }
 
 ///
-bool Account::isAccountDisplaySasOnce() const
+bool Account::isDisplaySasOnce() const
 { 
    return (accountDetail(ACCOUNT_DISPLAY_SAS_ONCE)  == "true")?1:0 ;
 }
 
 ///Return the account security fallback
-bool Account::isAccountSrtpRtpFallback() const
+bool Account::isSrtpRtpFallback() const
 {
    return (accountDetail(ACCOUNT_SRTP_RTP_FALLBACK)  == "true")?1:0 ;
 }
 
 ///
-bool Account::isAccountZrtpDisplaySas         () const
+bool Account::isZrtpDisplaySas         () const
 {
    return (accountDetail(ACCOUNT_ZRTP_DISPLAY_SAS)  == "true")?1:0 ;
 }
 
 ///Return if the other side support warning
-bool Account::isAccountZrtpNotSuppWarning() const
+bool Account::isZrtpNotSuppWarning() const
 {
    return (accountDetail(ACCOUNT_ZRTP_NOT_SUPP_WARNING) == "true")?1:0 ;
 }
 
 ///
-bool Account::isAccountZrtpHelloHash() const
+bool Account::isZrtpHelloHash() const
 {
    return (accountDetail(ACCOUNT_ZRTP_HELLO_HASH)  == "true")?1:0 ;
 }
 
 ///Return if the account is using a STUN server
-bool Account::isAccountSipStunEnabled() const
+bool Account::isSipStunEnabled() const
 {
    return (accountDetail(ACCOUNT_SIP_STUN_ENABLED)  == "true")?1:0 ;
 }
 
 ///Return the account STUN server
-QString Account::accountSipStunServer() const
+QString Account::sipStunServer() const
 {
    return accountDetail(ACCOUNT_SIP_STUN_SERVER);
 }
 
 ///Return when the account expire (require renewal)
-int Account::accountRegistrationExpire() const
+int Account::registrationExpire() const
 {
    return accountDetail(Account::MapField::Registration::EXPIRE).toInt();
 }
@@ -462,9 +462,10 @@ bool Account::isTlsEnable() const
 }
 
 ///Return the account the TLS encryption method
-int Account::tlsMethod() const
+KeyExchangeModel::Type Account::tlsMethod() const
 {
-   return accountDetail(TLS_METHOD).toInt();
+   const int value = accountDetail(TLS_METHOD).toInt();
+   return value<=2?static_cast<KeyExchangeModel::Type>(value):KeyExchangeModel::Type::NONE;
  }
 
 ///Return if the ringtone are enabled
@@ -492,13 +493,13 @@ QString Account::localInterface() const
 }
 
 ///Return the account registration status
-QString Account::accountRegistrationStatus() const
+QString Account::registrationStatus() const
 {
    return accountDetail(Account::MapField::Registration::STATUS);
 }
 
 ///Return the account type
-QString Account::accountType() const
+QString Account::type() const
 {
    return accountDetail(Account::MapField::TYPE);
 }
@@ -527,7 +528,7 @@ QVariant Account::roleData(int role) const
       case Account::Role::Alias:
          return alias();
       case Account::Role::Type:
-         return accountType();
+         return type();
       case Account::Role::Hostname:
          return hostname();
       case Account::Role::Username:
@@ -551,7 +552,7 @@ QVariant Account::roleData(int role) const
       case Account::Role::TlsServerName:
          return tlsServerName();
       case Account::Role::SipStunServer:
-         return accountSipStunServer();
+         return sipStunServer();
       case Account::Role::PublishedAddress:
          return publishedAddress();
       case Account::Role::LocalInterface:
@@ -559,9 +560,9 @@ QVariant Account::roleData(int role) const
       case Account::Role::RingtonePath:
          return ringtonePath();
       case Account::Role::TlsMethod:
-         return tlsMethod();
-      case Account::Role::AccountRegistrationExpire:
-         return accountRegistrationExpire();
+         return static_cast<int>(tlsMethod());
+      case Account::Role::RegistrationExpire:
+         return registrationExpire();
       case Account::Role::TlsNegotiationTimeoutSec:
          return tlsNegotiationTimeoutSec();
       case Account::Role::TlsNegotiationTimeoutMsec:
@@ -585,17 +586,17 @@ QVariant Account::roleData(int role) const
       case Account::Role::TlsEnable:
          return isTlsEnable();
       case Account::Role::DisplaySasOnce:
-         return isAccountDisplaySasOnce();
+         return isDisplaySasOnce();
       case Account::Role::SrtpRtpFallback:
-         return isAccountSrtpRtpFallback();
+         return isSrtpRtpFallback();
       case Account::Role::ZrtpDisplaySas:
-         return isAccountZrtpDisplaySas();
+         return isZrtpDisplaySas();
       case Account::Role::ZrtpNotSuppWarning:
-         return isAccountZrtpNotSuppWarning();
+         return isZrtpNotSuppWarning();
       case Account::Role::ZrtpHelloHash:
-         return isAccountZrtpHelloHash();
+         return isZrtpHelloHash();
       case Account::Role::SipStunEnabled:
-         return isAccountSipStunEnabled();
+         return isSipStunEnabled();
       case Account::Role::PublishedSameAsLocal:
          return isPublishedSameAsLocal();
       case Account::Role::RingtoneEnabled:
@@ -610,7 +611,7 @@ QVariant Account::roleData(int role) const
          return var;
       }
       case Account::Role::TypeName:
-         return accountType();
+         return type();
       case Account::Role::PresenceStatus:
          return PresenceStatusModel::instance()->currentStatus();
       case Account::Role::PresenceMessage:
@@ -668,7 +669,7 @@ void Account::setId(const QString& id)
 }
 
 ///Set the account type, SIP or IAX
-void Account::setAccountType(const QString& detail)
+void Account::setType(const QString& detail)
 {
    setAccountDetail(Account::MapField::TYPE ,detail);
 }
@@ -701,7 +702,7 @@ void Account::setProxy(const QString& detail)
 }
 
 ///Set the main credential password
-void Account::setAccountPassword(const QString& detail)
+void Account::setPassword(const QString& detail)
 {
    setAccountDetail(Account::MapField::PASSWORD, detail);
 }
@@ -743,7 +744,7 @@ void Account::setTlsServerName(const QString& detail)
 }
 
 ///Set the stun server
-void Account::setAccountSipStunServer(const QString& detail)
+void Account::setSipStunServer(const QString& detail)
 {
    setAccountDetail(ACCOUNT_SIP_STUN_SERVER, detail);
 }
@@ -767,13 +768,13 @@ void Account::setRingtonePath(const QString& detail)
 }
 
 ///Set the Tls method
-void Account::setTlsMethod(int detail)
+void Account::setTlsMethod(KeyExchangeModel::Type detail)
 {
-   setAccountDetail(TLS_METHOD ,QString::number(detail));
+   setAccountDetail(TLS_METHOD ,QString::number(static_cast<int>(detail)));
 }
 
 ///Set the account timeout, it will be renegotiated when that timeout occur
-void Account::setAccountRegistrationExpire(int detail)
+void Account::setRegistrationExpire(int detail)
 {
    setAccountDetail(Account::MapField::Registration::EXPIRE, \
QString::number(detail));  }
@@ -844,32 +845,32 @@ void Account::setTlsEnable(bool detail)
    setAccountDetail(TLS_ENABLE ,detail?"true":"false");
 }
 
-void Account::setAccountDisplaySasOnce(bool detail)
+void Account::setDisplaySasOnce(bool detail)
 {
    setAccountDetail(ACCOUNT_DISPLAY_SAS_ONCE, detail?"true":"false");
 }
 
-void Account::setAccountSrtpRtpFallback(bool detail)
+void Account::setSrtpRtpFallback(bool detail)
 {
    setAccountDetail(ACCOUNT_SRTP_RTP_FALLBACK, detail?"true":"false");
 }
 
-void Account::setAccountZrtpDisplaySas(bool detail)
+void Account::setZrtpDisplaySas(bool detail)
 {
    setAccountDetail(ACCOUNT_ZRTP_DISPLAY_SAS, detail?"true":"false");
 }
 
-void Account::setAccountZrtpNotSuppWarning(bool detail)
+void Account::setZrtpNotSuppWarning(bool detail)
 {
    setAccountDetail(ACCOUNT_ZRTP_NOT_SUPP_WARNING, detail?"true":"false");
 }
 
-void Account::setAccountZrtpHelloHash(bool detail)
+void Account::setZrtpHelloHash(bool detail)
 {
    setAccountDetail(ACCOUNT_ZRTP_HELLO_HASH, detail?"true":"false");
 }
 
-void Account::setAccountSipStunEnabled(bool detail)
+void Account::setSipStunEnabled(bool detail)
 {
    setAccountDetail(ACCOUNT_SIP_STUN_ENABLED, detail?"true":"false");
 }
@@ -897,7 +898,7 @@ void Account::setRoleData(int role, const QVariant& value)
       case Account::Role::Alias:
          setAlias(value.toString());
       case Account::Role::Type:
-         setAccountType(value.toString());
+         setType(value.toString());
       case Account::Role::Hostname:
          setHostname(value.toString());
       case Account::Role::Username:
@@ -921,17 +922,19 @@ void Account::setRoleData(int role, const QVariant& value)
       case Account::Role::TlsServerName:
          setTlsServerName(value.toString());
       case Account::Role::SipStunServer:
-         setAccountSipStunServer(value.toString());
+         setSipStunServer(value.toString());
       case Account::Role::PublishedAddress:
          setPublishedAddress(value.toString());
       case Account::Role::LocalInterface:
          setLocalInterface(value.toString());
       case Account::Role::RingtonePath:
          setRingtonePath(value.toString());
-      case Account::Role::TlsMethod:
-         setTlsMethod(value.toInt());
-      case Account::Role::AccountRegistrationExpire:
-         setAccountRegistrationExpire(value.toInt());
+      case Account::Role::TlsMethod: {
+         const int method = value.toInt();
+         setTlsMethod(method<=2?static_cast<KeyExchangeModel::Type>(method):KeyExchangeModel::Type::NONE);
 +      }
+      case Account::Role::RegistrationExpire:
+         setRegistrationExpire(value.toInt());
       case Account::Role::TlsNegotiationTimeoutSec:
          setTlsNegotiationTimeoutSec(value.toInt());
       case Account::Role::TlsNegotiationTimeoutMsec:
@@ -955,17 +958,17 @@ void Account::setRoleData(int role, const QVariant& value)
       case Account::Role::TlsEnable:
          setTlsEnable(value.toBool());
       case Account::Role::DisplaySasOnce:
-         setAccountDisplaySasOnce(value.toBool());
+         setDisplaySasOnce(value.toBool());
       case Account::Role::SrtpRtpFallback:
-         setAccountSrtpRtpFallback(value.toBool());
+         setSrtpRtpFallback(value.toBool());
       case Account::Role::ZrtpDisplaySas:
-         setAccountZrtpDisplaySas(value.toBool());
+         setZrtpDisplaySas(value.toBool());
       case Account::Role::ZrtpNotSuppWarning:
-         setAccountZrtpNotSuppWarning(value.toBool());
+         setZrtpNotSuppWarning(value.toBool());
       case Account::Role::ZrtpHelloHash:
-         setAccountZrtpHelloHash(value.toBool());
+         setZrtpHelloHash(value.toBool());
       case Account::Role::SipStunEnabled:
-         setAccountSipStunEnabled(value.toBool());
+         setSipStunEnabled(value.toBool());
       case Account::Role::PublishedSameAsLocal:
          setPublishedSameAsLocal(value.toBool());
       case Account::Role::RingtoneEnabled:
@@ -1005,7 +1008,7 @@ bool Account::updateState()
       ConfigurationManagerInterface & configurationManager = \
                DBus::ConfigurationManager::instance();
       const MapStringString details       = \
                configurationManager.getAccountDetails(id()).value();
       const QString         status        = \
                details[Account::MapField::Registration::STATUS];
-      const QString         currentStatus = accountRegistrationStatus();
+      const QString         currentStatus = registrationStatus();
       setAccountDetail(Account::MapField::Registration::STATUS, status); //Update \
-internal- object state  return status == currentStatus;
    }
diff --git a/src/lib/account.h b/src/lib/account.h
index d83c0d3..63331c6 100644
--- a/src/lib/account.h
+++ b/src/lib/account.h
@@ -27,6 +27,7 @@ class QString;
 
 //SFLPhone
 #include "videocodecmodel.h"
+#include "keyexchangemodel.h"
 #include "sflphone_const.h"
 #include "typedefs.h"
 // #include "dbus/metatypes.h"
@@ -54,7 +55,7 @@ class LIB_EXPORT Account : public QObject {
 
    //Properties
    Q_PROPERTY(QString        alias                        READ alias                 \
                WRITE setAlias                       )
-   Q_PROPERTY(QString        type                         READ accountType           \
WRITE setAccountType                 ) +   Q_PROPERTY(QString        type             \
READ type                          WRITE setType                        )  \
Q_PROPERTY(QString        hostname                     READ hostname                  \
WRITE setHostname                    )  Q_PROPERTY(QString        username            \
READ username                      WRITE setUsername                    )  \
Q_PROPERTY(QString        mailbox                      READ mailbox                   \
WRITE setMailbox                     ) @@ -65,12 +66,12 @@ class LIB_EXPORT Account : \
public QObject {  Q_PROPERTY(QString        tlsPrivateKeyFile            READ \
tlsPrivateKeyFile             WRITE setTlsPrivateKeyFile           )  \
Q_PROPERTY(QString        tlsCiphers                   READ tlsCiphers                \
WRITE setTlsCiphers                  )  Q_PROPERTY(QString        tlsServerName       \
                READ tlsServerName                 WRITE setTlsServerName             \
                )
-   Q_PROPERTY(QString        sipStunServer                READ accountSipStunServer  \
WRITE setAccountSipStunServer        ) +   Q_PROPERTY(QString        sipStunServer    \
READ sipStunServer                 WRITE setSipStunServer               )  \
Q_PROPERTY(QString        publishedAddress             READ publishedAddress          \
WRITE setPublishedAddress            )  Q_PROPERTY(QString        localInterface      \
READ localInterface                WRITE setLocalInterface              )  \
Q_PROPERTY(QString        ringtonePath                 READ ringtonePath              \
                WRITE setRingtonePath                )
-   Q_PROPERTY(int            tlsMethod                    READ tlsMethod             \
                WRITE setTlsMethod                   )
-   Q_PROPERTY(int            accountRegistrationExpire    READ \
accountRegistrationExpire     WRITE setAccountRegistrationExpire   ) +   \
Q_PROPERTY(KeyExchangeModel::Type tlsMethod         READ tlsMethod                    \
WRITE setTlsMethod                   ) +   Q_PROPERTY(int            \
registrationExpire           READ registrationExpire            WRITE \
setRegistrationExpire   )  Q_PROPERTY(int            tlsNegotiationTimeoutSec     \
READ tlsNegotiationTimeoutSec      WRITE setTlsNegotiationTimeoutSec    )  \
Q_PROPERTY(int            tlsNegotiationTimeoutMsec    READ tlsNegotiationTimeoutMsec \
WRITE setTlsNegotiationTimeoutMsec   )  Q_PROPERTY(int            localPort           \
READ localPort                     WRITE setLocalPort                   ) @@ -82,16 \
+83,16 @@ class LIB_EXPORT Account : public QObject {  Q_PROPERTY(bool           \
tlsVerifyClient              READ isTlsVerifyClient             WRITE \
setTlsVerifyClient             )  Q_PROPERTY(bool           \
tlsRequireClientCertificate  READ isTlsRequireClientCertificate WRITE \
setTlsRequireClientCertificate )  Q_PROPERTY(bool           tlsEnable                 \
                READ isTlsEnable                   WRITE setTlsEnable                 \
                )
-   Q_PROPERTY(bool           displaySasOnce               READ \
                isAccountDisplaySasOnce       WRITE setAccountDisplaySasOnce       )
-   Q_PROPERTY(bool           srtpRtpFallback              READ \
                isAccountSrtpRtpFallback      WRITE setAccountSrtpRtpFallback      )
-   Q_PROPERTY(bool           zrtpDisplaySas               READ \
                isAccountZrtpDisplaySas       WRITE setAccountZrtpDisplaySas       )
-   Q_PROPERTY(bool           zrtpNotSuppWarning           READ \
                isAccountZrtpNotSuppWarning   WRITE setAccountZrtpNotSuppWarning   )
-   Q_PROPERTY(bool           zrtpHelloHash                READ \
                isAccountZrtpHelloHash        WRITE setAccountZrtpHelloHash        )
-   Q_PROPERTY(bool           sipStunEnabled               READ \
isAccountSipStunEnabled       WRITE setAccountSipStunEnabled       ) +   \
Q_PROPERTY(bool           displaySasOnce               READ isDisplaySasOnce          \
WRITE setDisplaySasOnce              ) +   Q_PROPERTY(bool           srtpRtpFallback  \
READ isSrtpRtpFallback             WRITE setSrtpRtpFallback             ) +   \
Q_PROPERTY(bool           zrtpDisplaySas               READ isZrtpDisplaySas          \
WRITE setZrtpDisplaySas              ) +   Q_PROPERTY(bool           \
zrtpNotSuppWarning           READ isZrtpNotSuppWarning          WRITE \
setZrtpNotSuppWarning          ) +   Q_PROPERTY(bool           zrtpHelloHash          \
READ isZrtpHelloHash               WRITE setZrtpHelloHash               ) +   \
Q_PROPERTY(bool           sipStunEnabled               READ isSipStunEnabled          \
WRITE setSipStunEnabled              )  Q_PROPERTY(bool           \
publishedSameAsLocal         READ isPublishedSameAsLocal        WRITE \
setPublishedSameAsLocal        )  Q_PROPERTY(bool           ringtoneEnabled           \
READ isRingtoneEnabled             WRITE setRingtoneEnabled             )  \
Q_PROPERTY(DtmfType       dTMFType                     READ DTMFType                  \
                WRITE setDTMFType                    )
-   Q_PROPERTY(QString        typeName                     READ accountType           \
WRITE setAccountType                 ) +   Q_PROPERTY(QString        typeName         \
READ type                          WRITE setType                        )  \
Q_PROPERTY(bool           presenceStatus               READ presenceStatus            \
)  Q_PROPERTY(QString        presenceMessage              READ presenceMessage        \
)  
@@ -154,7 +155,7 @@ class LIB_EXPORT Account : public QObject {
          LocalInterface              = 115,
          RingtonePath                = 116,
          TlsMethod                   = 117,
-         AccountRegistrationExpire   = 118,
+         RegistrationExpire   = 118,
          TlsNegotiationTimeoutSec    = 119,
          TlsNegotiationTimeoutMsec   = 120,
          LocalPort                   = 121,
@@ -248,14 +249,14 @@ class LIB_EXPORT Account : public QObject {
       QString username                     () const;
       QString mailbox                      () const;
       QString proxy                        () const;
-      bool    isAccountDisplaySasOnce      () const;
-      bool    isAccountSrtpRtpFallback     () const;
-      bool    isAccountZrtpDisplaySas      () const;
-      bool    isAccountZrtpNotSuppWarning  () const;
-      bool    isAccountZrtpHelloHash       () const;
-      bool    isAccountSipStunEnabled      () const;
-      QString accountSipStunServer         () const;
-      int     accountRegistrationExpire    () const;
+      bool    isDisplaySasOnce             () const;
+      bool    isSrtpRtpFallback            () const;
+      bool    isZrtpDisplaySas             () const;
+      bool    isZrtpNotSuppWarning         () const;
+      bool    isZrtpHelloHash              () const;
+      bool    isSipStunEnabled             () const;
+      QString sipStunServer                () const;
+      int     registrationExpire           () const;
       bool    isPublishedSameAsLocal       () const;
       QString publishedAddress             () const;
       int     publishedPort                () const;
@@ -272,39 +273,39 @@ class LIB_EXPORT Account : public QObject {
       bool    isTlsVerifyClient            () const;
       bool    isTlsRequireClientCertificate() const;
       bool    isTlsEnable                  () const;
-      int     tlsMethod                    () const;
       bool    isRingtoneEnabled            () const;
       QString ringtonePath                 () const;
       int     localPort                    () const;
       QString localInterface               () const;
-      QString accountRegistrationStatus    () const;
-      QString accountType                  () const;
+      QString registrationStatus           () const;
+      QString type                         () const;
       DtmfType DTMFType                    () const;
       bool    presenceStatus               () const;
       QString presenceMessage              () const;
+      KeyExchangeModel::Type tlsMethod  () const;
       QVariant roleData            (int role) const;
 
       //Setters
       void setId      (const QString& id);
       void setAlias                         (const QString& detail);
-      void setAccountType                   (const QString& detail);
+      void setType                          (const QString& detail);
       void setHostname                      (const QString& detail);
       void setUsername                      (const QString& detail);
       void setMailbox                       (const QString& detail);
       void setProxy                         (const QString& detail);
-      void setAccountPassword               (const QString& detail);
+      void setPassword                      (const QString& detail);
       void setTlsPassword                   (const QString& detail);
       void setTlsCaListFile                 (const QString& detail);
       void setTlsCertificateFile            (const QString& detail);
       void setTlsPrivateKeyFile             (const QString& detail);
       void setTlsCiphers                    (const QString& detail);
       void setTlsServerName                 (const QString& detail);
-      void setAccountSipStunServer          (const QString& detail);
+      void setSipStunServer                 (const QString& detail);
       void setPublishedAddress              (const QString& detail);
       void setLocalInterface                (const QString& detail);
       void setRingtonePath                  (const QString& detail);
-      void setTlsMethod                     (int  detail);
-      void setAccountRegistrationExpire     (int  detail);
+      void setTlsMethod                     (KeyExchangeModel::Type detail);
+      void setRegistrationExpire            (int  detail);
       void setTlsNegotiationTimeoutSec      (int  detail);
       void setTlsNegotiationTimeoutMsec     (int  detail);
       void setLocalPort                     (unsigned short detail);
@@ -315,15 +316,15 @@ class LIB_EXPORT Account : public QObject {
       void setTlsVerifyClient               (bool detail);
       void setTlsRequireClientCertificate   (bool detail);
       void setTlsEnable                     (bool detail);
-      void setAccountDisplaySasOnce         (bool detail);
-      void setAccountSrtpRtpFallback        (bool detail);
-      void setAccountZrtpDisplaySas         (bool detail);
-      void setAccountZrtpNotSuppWarning     (bool detail);
-      void setAccountZrtpHelloHash          (bool detail);
-      void setAccountSipStunEnabled         (bool detail);
+      void setDisplaySasOnce                (bool detail);
+      void setSrtpRtpFallback               (bool detail);
+      void setZrtpDisplaySas                (bool detail);
+      void setZrtpNotSuppWarning            (bool detail);
+      void setZrtpHelloHash                 (bool detail);
+      void setSipStunEnabled                (bool detail);
       void setPublishedSameAsLocal          (bool detail);
       void setRingtoneEnabled               (bool detail);
-      void setDTMFType                      (DtmfType type );
+      void setDTMFType                      (DtmfType type);
 
       void setRoleData(int role, const QVariant& value);
 
diff --git a/src/lib/accountlistmodel.cpp b/src/lib/accountlistmodel.cpp
index 6b0e307..a2b3c90 100644
--- a/src/lib/accountlistmodel.cpp
+++ b/src/lib/accountlistmodel.cpp
@@ -103,7 +103,7 @@ void AccountListModel::setupRoleName()
    roles.insert(Account::Role::LocalInterface           ,QByteArray("localInterface" \
));  roles.insert(Account::Role::RingtonePath             ,QByteArray("ringtonePath"  \
));  roles.insert(Account::Role::TlsMethod                ,QByteArray("tlsMethod"     \
                ));
-   roles.insert(Account::Role::AccountRegistrationExpire,QByteArray("accountRegistrationExpire" \
)); +   roles.insert(Account::Role::RegistrationExpire       \
,QByteArray("registrationExpire"            ));  \
roles.insert(Account::Role::TlsNegotiationTimeoutSec \
,QByteArray("tlsNegotiationTimeoutSec"      ));  \
roles.insert(Account::Role::TlsNegotiationTimeoutMsec,QByteArray("tlsNegotiationTimeoutMsec" \
));  roles.insert(Account::Role::LocalPort                ,QByteArray("localPort"     \
)); @@ -360,7 +360,7 @@ QVector<Account*> AccountListModel::getAccountsByState(const \
QString& state)  {
    QVector<Account *> v;
    for (int i = 0; i < m_lAccounts.size(); ++i) {
-      if (m_lAccounts[i]->accountRegistrationStatus() == state)
+      if (m_lAccounts[i]->registrationStatus() == state)
          v += m_lAccounts[i];
    }
    return v;
@@ -374,7 +374,7 @@ QVector<Account*> AccountListModel::registeredAccounts() const
    Account* current;
    for (int i = 0; i < m_lAccounts.count(); ++i) {
       current = m_lAccounts[i];
-      if(current->accountRegistrationStatus() == Account::State::REGISTERED) {
+      if(current->registrationStatus() == Account::State::REGISTERED) {
          qDebug() << current->alias() << " : " << current;
          registeredAccountsVector.append(current);
       }
@@ -388,9 +388,9 @@ Account* AccountListModel::firstRegisteredAccount() const
    Account* current;
    for (int i = 0; i < m_lAccounts.count(); ++i) {
       current = m_lAccounts[i];
-      if(current && current->accountRegistrationStatus() == \
Account::State::REGISTERED && current->isEnabled()) +      if(current && \
current->registrationStatus() == Account::State::REGISTERED && current->isEnabled())  \
                return current;
-      else if (current && (current->accountRegistrationStatus() == \
Account::State::READY) && m_lAccounts.count() == 1) +      else if (current && \
(current->registrationStatus() == Account::State::READY) && m_lAccounts.count() == 1) \
return current;  //       else if (current && \
!(current->accountRegistrationStatus()() == ACCOUNT_STATE_READY)) {  //          \
qDebug() << "Account " << ((current)?current->accountId():"") << " is not registered \
(" @@ -411,7 +411,7 @@ int AccountListModel::size() const
 Account* AccountListModel::currentAccount()
 {
    Account* priorAccount = m_spPriorAccount;
-   if(priorAccount && priorAccount->accountRegistrationStatus() == \
Account::State::REGISTERED && priorAccount->isEnabled() ) { +   if(priorAccount && \
priorAccount->registrationStatus() == Account::State::REGISTERED && \
priorAccount->isEnabled() ) {  return priorAccount;
    }
    else {
diff --git a/src/lib/call.cpp b/src/lib/call.cpp
index 2177ebc..e0a08f8 100644
--- a/src/lib/call.cpp
+++ b/src/lib/call.cpp
@@ -604,7 +604,7 @@ bool Call::isSecure() const {
       return false;
    }
 
-   return m_Account && ((m_Account->isTlsEnable()) || (m_Account->tlsMethod()));
+   return m_Account && ((m_Account->isTlsEnable()) || (m_Account->tlsMethod() != \
KeyExchangeModel::Type::NONE));  } //isSecure
 
 ///Return the renderer associated with this call or nullptr
diff --git a/src/lib/keyexchangemodel.cpp b/src/lib/keyexchangemodel.cpp
new file mode 100644
index 0000000..67938ae
--- /dev/null
+++ b/src/lib/keyexchangemodel.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************
+ *   Copyright (C) 2013 by Savoir-Faire Linux                               *
+ *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
+ *                                                                          *
+ *   This library is free software; you can redistribute it and/or          *
+ *   modify it under the terms of the GNU Lesser General Public             *
+ *   License as published by the Free Software Foundation; either           *
+ *   version 2.1 of the License, or (at your option) any later version.     *
+ *                                                                          *
+ *   This library is distributed in the hope that it will be useful,        *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
+ *   Lesser General Public License for more details.                        *
+ *                                                                          *
+ *   You should have received a copy of the GNU General Public License      *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
+ ***************************************************************************/
+#include "keyexchangemodel.h"
+
+#include <QtCore/QCoreApplication>
+
+KeyExchangeModel* KeyExchangeModel::m_spInstance = nullptr;
+
+KeyExchangeModel::KeyExchangeModel() : \
QAbstractListModel(QCoreApplication::instance()) {} +
+//Model functions
+QVariant KeyExchangeModel::data( const QModelIndex& index, int role) const
+{
+   if (!index.isValid()) return QVariant();
+   KeyExchangeModel::Type mathod = static_cast<KeyExchangeModel::Type>(index.row());
+   if (role == Qt::DisplayRole) {
+      switch (mathod) {
+         case KeyExchangeModel::Type::NONE:
+            return KeyExchangeModel::Name::NONE;
+            break;
+         case KeyExchangeModel::Type::ZRTP:
+            return KeyExchangeModel::Name::ZRTP;
+            break;
+         case KeyExchangeModel::Type::SDES:
+            return KeyExchangeModel::Name::SDES;
+            break;
+      };
+   }
+   return QVariant();
+}
+
+int KeyExchangeModel::rowCount( const QModelIndex& parent ) const
+{
+   return parent.isValid()?0:3;
+}
+
+Qt::ItemFlags KeyExchangeModel::flags( const QModelIndex& index ) const
+{
+   if (!index.isValid()) return Qt::NoItemFlags;
+   return Qt::ItemIsEnabled|Qt::ItemIsSelectable;
+}
+
+bool KeyExchangeModel::setData( const QModelIndex& index, const QVariant &value, int \
role) +{
+   Q_UNUSED(index)
+   Q_UNUSED(value)
+   Q_UNUSED(role )
+   return false;
+}
+
+KeyExchangeModel* KeyExchangeModel::instance()
+{
+   if (!m_spInstance)
+      m_spInstance = new KeyExchangeModel();
+   return m_spInstance;
+}
+
+///Translate enum type to QModelIndex
+QModelIndex KeyExchangeModel::toIndex(KeyExchangeModel::Type type)
+{
+   return index(static_cast<int>(type),0,QModelIndex());
+}
diff --git a/src/lib/keyexchangemodel.h b/src/lib/keyexchangemodel.h
new file mode 100644
index 0000000..2cf9e06
--- /dev/null
+++ b/src/lib/keyexchangemodel.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+ *   Copyright (C) 2013 by Savoir-Faire Linux                               *
+ *   Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
+ *                                                                          *
+ *   This library is free software; you can redistribute it and/or          *
+ *   modify it under the terms of the GNU Lesser General Public             *
+ *   License as published by the Free Software Foundation; either           *
+ *   version 2.1 of the License, or (at your option) any later version.     *
+ *                                                                          *
+ *   This library is distributed in the hope that it will be useful,        *
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *
+ *   Lesser General Public License for more details.                        *
+ *                                                                          *
+ *   You should have received a copy of the GNU General Public License      *
+ *   along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
+ ***************************************************************************/
+#ifndef KEYEXCHANGEMODEL_H
+#define KEYEXCHANGEMODEL_H
+
+#include "typedefs.h"
+#include <QtCore/QAbstractListModel>
+
+///Static model for handling encryption types
+class LIB_EXPORT KeyExchangeModel : public QAbstractListModel {
+   #pragma GCC diagnostic push
+   #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
+   Q_OBJECT
+   #pragma GCC diagnostic pop
+
+public:
+   ///@enum Type Every supported encryption types
+   enum class Type {
+      NONE = 0,
+      ZRTP = 1,
+      SDES = 2,
+   };
+
+   class Name {
+   public:
+      constexpr static const char* NONE = "none";
+      constexpr static const char* ZRTP = "zrtp";
+      constexpr static const char* SDES = "sdes";
+   };
+
+   //Private constructor, can only be called by 'Account'
+   explicit KeyExchangeModel();
+
+   //Model functions
+   QVariant      data     ( const QModelIndex& index, int role = Qt::DisplayRole     \
) const; +   int           rowCount ( const QModelIndex& parent = QModelIndex()       \
) const; +   Qt::ItemFlags flags    ( const QModelIndex& index                        \
) const; +   virtual bool  setData  ( const QModelIndex& index, const QVariant \
&value, int role)      ; +
+   //Getters
+   QModelIndex   toIndex  (KeyExchangeModel::Type type);
+
+   //Singleton
+   static KeyExchangeModel* instance();
+
+private:
+   static KeyExchangeModel* m_spInstance;
+};
+Q_DECLARE_METATYPE(KeyExchangeModel*)
+#endif
diff --git a/src/lib/sflphone_const.h b/src/lib/sflphone_const.h
index 7865df3..2289dd1 100644
--- a/src/lib/sflphone_const.h
+++ b/src/lib/sflphone_const.h
@@ -88,8 +88,8 @@
 #define ACCOUNT_ZRTP_HELLO_HASH            "ZRTP.helloHashEnable"
 #define ACCOUNT_DISPLAY_SAS_ONCE           "ZRTP.displaySasOnce"
 #define KEY_EXCHANGE_NONE                  "none"
-#define ZRTP                               "zrtp"
-#define SDES                               "sdes"
+// #define ZRTP                               "zrtp"
+// #define SDES                               "sdes"
 
 
 
diff --git a/src/sflphoneview.cpp b/src/sflphoneview.cpp
index 32ee0d1..b235ad9 100644
--- a/src/sflphoneview.cpp
+++ b/src/sflphoneview.cpp
@@ -117,12 +117,12 @@ public:
    }
 
    virtual QVariant getColor(const Account* a) {
-      if(a->accountRegistrationStatus() == Account::State::UNREGISTERED || \
!a->isEnabled()) +      if(a->registrationStatus() == Account::State::UNREGISTERED || \
!a->isEnabled())  return m_Pal.color(QPalette::Base);
-      if(a->accountRegistrationStatus() == Account::State::REGISTERED || \
a->accountRegistrationStatus() == Account::State::READY) { +      \
if(a->registrationStatus() == Account::State::REGISTERED || a->registrationStatus() \
== Account::State::READY) {  return m_Green;
       }
-      if(a->accountRegistrationStatus() == Account::State::TRYING)
+      if(a->registrationStatus() == Account::State::TRYING)
          return m_Yellow;
       return m_Red;
    }
@@ -900,14 +900,14 @@ void SFLPhoneView::updateDialpad()
 ///Change the statusbar message
 void SFLPhoneView::updateStatusMessage()
 {
-   Account * account = AccountListModel::currentAccount();
+   const Account* account = AccountListModel::currentAccount();
 
    if(!account) {
       emit statusMessageChangeAsked(i18n("No registered accounts"));
    }
    else {
       emit statusMessageChangeAsked(i18n("Using account \'%1\' (%2)",
-         account->alias(), account->accountRegistrationStatus()));
+         account->alias(), account->registrationStatus()));
    }
 }
 
diff --git a/src/widgets/bookmarkdock.cpp b/src/widgets/bookmarkdock.cpp
index 2557210..97251da 100644
--- a/src/widgets/bookmarkdock.cpp
+++ b/src/widgets/bookmarkdock.cpp
@@ -77,7 +77,7 @@ BookmarkDock::BookmarkDock(QWidget* parent) : QDockWidget(parent)
 
    m_pFilterLE->setPlaceholderText(i18n("Filter"));
 
-   m_pMostUsedCK->setChecked(ConfigurationSkeleton::displayContactCallHistory());
+   m_pMostUsedCK->setChecked(ConfigurationSkeleton::displayPopularAsBookmark());
 
    setWidget(mainWidget);
 
@@ -113,7 +113,7 @@ BookmarkDock::~BookmarkDock()
 ///Show the most popular items
 void BookmarkDock::reload()
 {
-   ConfigurationSkeleton::setDisplayContactCallHistory(m_pMostUsedCK->isChecked());
+   ConfigurationSkeleton::setDisplayPopularAsBookmark(m_pMostUsedCK->isChecked());
    BookmarkModel::instance()->reloadCategories();
 } //reload
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic