From 6dce3bd123c783ff61114ba1d2941befc8812d01 Mon Sep 17 00:00:00 2001
From: Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com>
Date: Wed, 24 Mar 2010 14:31:13 -0400
Subject: [PATCH] Backport security settings from master (need testing, master
 bugs apply here too)

---
 sflphone-client-kde/src/conf/dlgaccounts.cpp  | 128 +++--
 sflphone-client-kde/src/conf/dlgaccounts.h    |   2 +-
 .../src/conf/dlgaccountsbase.ui               | 467 +++++++++++++++++-
 sflphone-client-kde/src/sflphone_const.h      |   2 +
 4 files changed, 553 insertions(+), 46 deletions(-)

diff --git a/sflphone-client-kde/src/conf/dlgaccounts.cpp b/sflphone-client-kde/src/conf/dlgaccounts.cpp
index e2518dec1b..a46c4028f2 100644
--- a/sflphone-client-kde/src/conf/dlgaccounts.cpp
+++ b/sflphone-client-kde/src/conf/dlgaccounts.cpp
@@ -40,33 +40,61 @@ DlgAccounts::DlgAccounts(KConfigDialog *parent)
 	accountList = new AccountList(false);
 	loadAccountList();
 	accountListHasChanged = false;
-	toolButton_accountsApply->setEnabled(false);
+	//toolButton_accountsApply->setEnabled(false);
 	
-	connect(edit1_alias,           SIGNAL(textEdited(const QString &)),
-	        this,                  SLOT(changedAccountList()));
-	connect(edit2_protocol,        SIGNAL(activated(int)),
-	        this,                  SLOT(changedAccountList()));
-	connect(edit3_server,          SIGNAL(textEdited(const QString &)),
-	        this,                  SLOT(changedAccountList()));
-	connect(edit4_user,            SIGNAL(textEdited(const QString &)),
-	        this,                  SLOT(changedAccountList()));
-	connect(edit5_password,        SIGNAL(textEdited(const QString &)),
-	        this,                  SLOT(changedAccountList()));
-	connect(edit6_mailbox,         SIGNAL(textEdited(const QString &)),
-	        this,                  SLOT(changedAccountList()));
-	connect(checkbox_stun,         SIGNAL(toggled(bool)),
-		this,                  SLOT(changedAccountList()));
-	connect(checkbox_zrtp,         SIGNAL(toggled(bool)),
-		this,                  SLOT(changedAccountList()));       
-	connect(button_accountUp,      SIGNAL(clicked()),
-	        this,                  SLOT(changedAccountList()));
-	connect(button_accountDown,    SIGNAL(clicked()),
-	        this,                  SLOT(changedAccountList()));
-	connect(button_accountAdd,     SIGNAL(clicked()),
-	        this,                  SLOT(changedAccountList()));
-	connect(button_accountRemove,  SIGNAL(clicked()),
-	        this,                  SLOT(changedAccountList()));
-	        
+	connect(edit1_alias,                    SIGNAL(textEdited(const QString &)),
+	        this,                           SLOT(changedAccountList()));
+	connect(edit2_protocol,                 SIGNAL(activated(int)),
+	        this,                           SLOT(changedAccountList()));
+	connect(edit3_server,                   SIGNAL(textEdited(const QString &)),
+	        this,                           SLOT(changedAccountList()));
+	connect(edit4_user,                     SIGNAL(textEdited(const QString &)),
+	        this,                           SLOT(changedAccountList()));
+	connect(edit5_password,                 SIGNAL(textEdited(const QString &)),
+	        this,                           SLOT(changedAccountList()));
+	connect(edit6_mailbox,                  SIGNAL(textEdited(const QString &)),
+	        this,                           SLOT(changedAccountList()));
+	connect(checkbox_stun,                  SIGNAL(toggled(bool)),
+		this,                           SLOT(changedAccountList()));
+	connect(checkbox_zrtp,                  SIGNAL(toggled(bool)),
+		this,                           SLOT(changedAccountList()));       
+	connect(button_accountUp,               SIGNAL(clicked()),
+	        this,                           SLOT(changedAccountList()));
+	connect(button_accountDown,             SIGNAL(clicked()),
+	        this,                           SLOT(changedAccountList()));
+	connect(button_accountAdd,              SIGNAL(clicked()),
+	        this,                           SLOT(changedAccountList()));
+	connect(button_accountRemove,           SIGNAL(clicked()),
+	        this,                           SLOT(changedAccountList()));
+        connect(edit_tls_private_key_password_2,  SIGNAL(textEdited(const QString &)),
+                this,                           SLOT(changedAccountList()));
+        connect(spinbox_tls_listener_2,           SIGNAL(editingFinished()),
+                this,                           SLOT(changedAccountList()));
+        connect(file_tls_authority_2,             SIGNAL(textChanged(const QString &)),
+                this,                           SLOT(changedAccountList()));
+        connect(file_tls_endpoint_2,              SIGNAL(textChanged(const QString &)),
+                this,                           SLOT(changedAccountList()));
+        connect(file_tls_private_key_2,           SIGNAL(textChanged(const QString &)),
+                this,                           SLOT(changedAccountList()));
+        connect(combo_tls_method_2,               SIGNAL(currentIndexChanged(int)),
+                this,                           SLOT(changedAccountList()));
+        connect(edit_tls_cipher_2,                SIGNAL(textEdited(const QString &)),
+                this,                           SLOT(changedAccountList()));
+        connect(edit_tls_outgoing_2,              SIGNAL(textEdited(const QString &)),
+                this,                           SLOT(changedAccountList()));
+        connect(spinbox_tls_timeout_sec_2,        SIGNAL(editingFinished()),
+                this,                           SLOT(changedAccountList()));
+        connect(spinbox_tls_timeout_msec_2,       SIGNAL(editingFinished()),
+                this,                           SLOT(changedAccountList()));
+        connect(check_tls_incoming_2,             SIGNAL(clicked(bool)),
+                this,                           SLOT(changedAccountList()));
+        connect(check_tls_answer_2,               SIGNAL(clicked(bool)),
+                this,                           SLOT(changedAccountList()));
+        connect(check_tls_requier_cert_2,         SIGNAL(clicked(bool)),
+                this,                           SLOT(changedAccountList()));
+        connect(group_security_tls,             SIGNAL(clicked(bool)),
+                this,                           SLOT(changedAccountList()));
+                
 	connect(&configurationManager, SIGNAL(accountsChanged()),
 	        this,                  SLOT(updateAccountStates()));
 	        
@@ -169,6 +197,24 @@ void DlgAccounts::saveAccount(QListWidgetItem * item)
 	account->setAccountDetail(ACCOUNT_PASSWORD, edit5_password->text());
 	account->setAccountDetail(ACCOUNT_MAILBOX, edit6_mailbox->text());
 	account->setAccountDetail(ACCOUNT_ENABLED, account->isChecked() ? ACCOUNT_ENABLED_TRUE : ACCOUNT_ENABLED_FALSE);
+        
+        //Security
+        account->setAccountDetail(TLS_PASSWORD,edit_tls_private_key_password_2->text());
+        account->setAccountDetail(TLS_LISTENER_PORT,QString::number(spinbox_tls_listener_2->value()));
+        account->setAccountDetail(TLS_CA_LIST_FILE,file_tls_authority_2->text());
+        account->setAccountDetail(TLS_CERTIFICATE_FILE,file_tls_endpoint_2->text());
+        account->setAccountDetail(TLS_PRIVATE_KEY_FILE,file_tls_private_key_2->text());
+        qDebug() << "\n\n\n\nSET: " << combo_tls_method_2->currentText() << "\n\n\n";
+        account->setAccountDetail(TLS_METHOD,combo_tls_method_2->currentText());
+        account->setAccountDetail(TLS_CIPHERS,edit_tls_cipher_2->text());
+        account->setAccountDetail(TLS_SERVER_NAME,edit_tls_outgoing_2->text());
+        account->setAccountDetail(TLS_NEGOTIATION_TIMEOUT_SEC,QString::number(spinbox_tls_timeout_sec_2->value()));
+        account->setAccountDetail(TLS_NEGOTIATION_TIMEOUT_MSEC,QString::number(spinbox_tls_timeout_msec_2->value()));
+        account->setAccountDetail(TLS_VERIFY_SERVER,check_tls_incoming_2->isChecked()?"true":"false");
+        account->setAccountDetail(TLS_VERIFY_CLIENT,check_tls_answer_2->isChecked()?"true":"false");
+        account->setAccountDetail(TLS_REQUIRE_CLIENT_CERTIFICATE,check_tls_requier_cert_2->isChecked()?"true":"false");
+        account->setAccountDetail(TLS_ENABLE,group_security_tls->isChecked()?"true":"false");
+        account->setAccountDetail(TLS_METHOD, QString::number(combo_security_STRP->currentIndex()));
 }
 
 void DlgAccounts::loadAccount(QListWidgetItem * item)
@@ -196,6 +242,26 @@ void DlgAccounts::loadAccount(QListWidgetItem * item)
 	edit5_password->setText( account->getAccountDetail(ACCOUNT_PASSWORD));
 	edit6_mailbox->setText( account->getAccountDetail(ACCOUNT_MAILBOX));
 	
+        //Security
+        edit_tls_private_key_password_2->setText( account->getAccountDetail(TLS_PASSWORD ));
+        spinbox_tls_listener_2->setValue( account->getAccountDetail(TLS_LISTENER_PORT ).toInt());
+        file_tls_authority_2->setText( account->getAccountDetail(TLS_CA_LIST_FILE ));
+        file_tls_endpoint_2->setText( account->getAccountDetail(TLS_CERTIFICATE_FILE ));
+        file_tls_private_key_2->setText( account->getAccountDetail(TLS_PRIVATE_KEY_FILE ));
+        qDebug() << "\n\n\n\nTHIS: " << account->getAccountDetail(TLS_METHOD ) << "\n\n\n";
+        combo_tls_method_2->setCurrentIndex( combo_tls_method_2->findText(account->getAccountDetail(TLS_METHOD )));
+        edit_tls_cipher_2->setText( account->getAccountDetail(TLS_CIPHERS ));
+        edit_tls_outgoing_2->setText( account->getAccountDetail(TLS_SERVER_NAME ));
+        spinbox_tls_timeout_sec_2->setValue( account->getAccountDetail(TLS_NEGOTIATION_TIMEOUT_SEC ).toInt());
+        spinbox_tls_timeout_msec_2->setValue( account->getAccountDetail(TLS_NEGOTIATION_TIMEOUT_MSEC ).toInt());
+        check_tls_incoming_2->setChecked( (account->getAccountDetail(TLS_VERIFY_SERVER ) == "true")?1:0);
+        check_tls_answer_2->setChecked( (account->getAccountDetail(TLS_VERIFY_CLIENT ) == "true")?1:0);
+        check_tls_requier_cert_2->setChecked( (account->getAccountDetail(TLS_REQUIRE_CLIENT_CERTIFICATE ) == "true")?1:0);
+        group_security_tls->setChecked( (account->getAccountDetail(TLS_ENABLE ) == "true")?1:0);
+        
+        combo_security_STRP->setCurrentIndex(account->getAccountDetail(TLS_METHOD ).toInt());
+        
+        
 	if(protocolIndex == 0) // if sip selected
 	{
 		checkbox_stun->setChecked(account->getAccountDetail(ACCOUNT_SIP_STUN_ENABLED) == ACCOUNT_ENABLED_TRUE);
@@ -247,7 +313,7 @@ void DlgAccounts::changedAccountList()
 	qDebug() << "changedAccountList";
 	accountListHasChanged = true;
 	emit updateButtons();
-	toolButton_accountsApply->setEnabled(true);
+	//toolButton_accountsApply->setEnabled(true);
 	
 	int currentIndex = edit2_protocol->currentIndex();
 
@@ -327,12 +393,12 @@ void DlgAccounts::on_button_accountRemove_clicked()
 	listWidget_accountList->setCurrentRow( (r >= listWidget_accountList->count()) ? r-1 : r );
 }
 
-void DlgAccounts::on_toolButton_accountsApply_clicked()
+/*void DlgAccounts::on_toolButton_accountsApply_clicked()
 {
 	qDebug() << "on_toolButton_accountsApply_clicked";
 	updateSettings();
 	updateWidgets();
-}
+}*/
 
 void DlgAccounts::on_edit1_alias_textChanged(const QString & text)
 {
@@ -404,7 +470,7 @@ void DlgAccounts::updateSettings()
 	if(accountListHasChanged)
 	{
 		saveAccountList();
-		toolButton_accountsApply->setEnabled(false);
+		//toolButton_accountsApply->setEnabled(false);
 		accountListHasChanged = false;
 	}
 }
@@ -413,7 +479,7 @@ void DlgAccounts::updateWidgets()
 {
 	qDebug() << "DlgAccounts::updateWidgets";
 	loadAccountList();
-	toolButton_accountsApply->setEnabled(false);
+	//toolButton_accountsApply->setEnabled(false);
 	accountListHasChanged = false;
 }
 
diff --git a/sflphone-client-kde/src/conf/dlgaccounts.h b/sflphone-client-kde/src/conf/dlgaccounts.h
index 3274368917..ca89fa17ce 100644
--- a/sflphone-client-kde/src/conf/dlgaccounts.h
+++ b/sflphone-client-kde/src/conf/dlgaccounts.h
@@ -78,7 +78,7 @@ private slots:
 	void on_button_accountRemove_clicked();
 	void on_edit1_alias_textChanged(const QString & text);
 	void on_listWidget_accountList_currentItemChanged ( QListWidgetItem * current, QListWidgetItem * previous );
-	void on_toolButton_accountsApply_clicked();
+	//void on_toolButton_accountsApply_clicked();
 	void updateAccountStates();
 	void addAccountToAccountList(Account * account);
 	void updateAccountListCommands();
diff --git a/sflphone-client-kde/src/conf/dlgaccountsbase.ui b/sflphone-client-kde/src/conf/dlgaccountsbase.ui
index a5aef4fe3b..d477ac8da6 100644
--- a/sflphone-client-kde/src/conf/dlgaccountsbase.ui
+++ b/sflphone-client-kde/src/conf/dlgaccountsbase.ui
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>603</width>
+    <width>787</width>
     <height>455</height>
    </rect>
   </property>
@@ -29,7 +29,7 @@
       <item>
        <widget class="QFrame" name="frame1_accountList">
         <property name="sizePolicy">
-         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
           <horstretch>1</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
@@ -212,16 +212,6 @@
               </property>
              </spacer>
             </item>
-            <item>
-             <widget class="QToolButton" name="toolButton_accountsApply">
-              <property name="enabled">
-               <bool>true</bool>
-              </property>
-              <property name="text">
-               <string>Apply</string>
-              </property>
-             </widget>
-            </item>
            </layout>
           </widget>
          </item>
@@ -235,12 +225,12 @@
         </property>
         <property name="sizePolicy">
          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
-          <horstretch>1</horstretch>
+          <horstretch>3</horstretch>
           <verstretch>0</verstretch>
          </sizepolicy>
         </property>
         <property name="currentIndex">
-         <number>1</number>
+         <number>3</number>
         </property>
         <widget class="QWidget" name="tab_basic">
          <attribute name="title">
@@ -445,6 +435,445 @@
           </item>
          </layout>
         </widget>
+        <widget class="QWidget" name="tab">
+         <attribute name="title">
+          <string>Credential</string>
+         </attribute>
+         <layout class="QGridLayout" name="gridLayout">
+          <item row="0" column="0" colspan="3">
+           <widget class="QListWidget" name="list_credential">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="0">
+           <spacer name="horizontalSpacer_2">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>248</width>
+              <height>23</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+          <item row="1" column="1">
+           <widget class="QToolButton" name="button_add_credential">
+            <property name="text">
+             <string>Add</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="2">
+           <widget class="QToolButton" name="button_remove_credential">
+            <property name="text">
+             <string>Remove</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0" colspan="3">
+           <widget class="QGroupBox" name="group_credential">
+            <property name="title">
+             <string>Details</string>
+            </property>
+            <layout class="QGridLayout" name="gridLayout_2">
+             <item row="0" column="0">
+              <widget class="QLabel" name="label_credential_realm">
+               <property name="text">
+                <string>Realm</string>
+               </property>
+              </widget>
+             </item>
+             <item row="1" column="0">
+              <widget class="QLabel" name="labe_credential_auth">
+               <property name="text">
+                <string>Auth. name</string>
+               </property>
+              </widget>
+             </item>
+             <item row="2" column="0">
+              <widget class="QLabel" name="label_credential_password">
+               <property name="text">
+                <string>Password</string>
+               </property>
+              </widget>
+             </item>
+             <item row="0" column="1">
+              <widget class="KLineEdit" name="edit_credential_realm"/>
+             </item>
+             <item row="1" column="1">
+              <widget class="KLineEdit" name="edit_credential_auth"/>
+             </item>
+             <item row="2" column="1">
+              <widget class="KLineEdit" name="edit_credential_password"/>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="tab_2">
+         <attribute name="title">
+          <string>Security</string>
+         </attribute>
+         <layout class="QVBoxLayout" name="verticalLayout_2">
+          <item>
+           <widget class="QScrollArea" name="scrollArea">
+            <property name="widgetResizable">
+             <bool>true</bool>
+            </property>
+            <widget class="QWidget" name="scrollAreaWidgetContents">
+             <property name="geometry">
+              <rect>
+               <x>0</x>
+               <y>0</y>
+               <width>465</width>
+               <height>580</height>
+              </rect>
+             </property>
+             <layout class="QGridLayout" name="gridLayout_5">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_security_STRP">
+                <property name="text">
+                 <string>STRP key exchange</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QComboBox" name="combo_security_STRP">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <item>
+                 <property name="text">
+                  <string>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 row="0" column="2">
+               <widget class="QToolButton" name="button_security_STRP">
+                <property name="text">
+                 <string>Edit</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0" colspan="3">
+               <widget class="QLabel" name="label_tls_info">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="text">
+                 <string>TLS transport can be used along with UDP for those calls that would require secure sip transactions (aka SIPS). You can configure a different TLS transport for each account. However each of them will run on a dedicated port, different one from each other.</string>
+                </property>
+                <property name="wordWrap">
+                 <bool>true</bool>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0" colspan="3">
+               <widget class="QGroupBox" name="group_security_tls">
+                <property name="sizePolicy">
+                 <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+                  <horstretch>0</horstretch>
+                  <verstretch>0</verstretch>
+                 </sizepolicy>
+                </property>
+                <property name="title">
+                 <string>Enable TLS</string>
+                </property>
+                <property name="checkable">
+                 <bool>true</bool>
+                </property>
+                <property name="checked">
+                 <bool>false</bool>
+                </property>
+                <layout class="QGridLayout" name="gridLayout_6">
+                 <item row="0" column="0">
+                  <widget class="QLabel" name="label_tls_listener_2">
+                   <property name="text">
+                    <string>Global TLS listener*</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="1" colspan="3">
+                  <widget class="KIntSpinBox" name="spinbox_tls_listener_2">
+                   <property name="maximum">
+                    <number>65535</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="0" column="4" colspan="5">
+                  <spacer name="horizontalSpacer_6">
+                   <property name="orientation">
+                    <enum>Qt::Horizontal</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>40</width>
+                     <height>20</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                 <item row="1" column="0">
+                  <widget class="QLabel" name="label_tls_authority_2">
+                   <property name="text">
+                    <string>Authority certificate list</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="1" column="1" colspan="8">
+                  <widget class="KUrlRequester" name="file_tls_authority_2"/>
+                 </item>
+                 <item row="2" column="0">
+                  <widget class="QLabel" name="label_tls_endpoint_2">
+                   <property name="text">
+                    <string>Public endpoint certificate</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="2" column="1" colspan="8">
+                  <widget class="KUrlRequester" name="file_tls_endpoint_2"/>
+                 </item>
+                 <item row="3" column="0">
+                  <widget class="QLabel" name="label_tls_private_key_2">
+                   <property name="text">
+                    <string>Private key</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="3" column="1" colspan="8">
+                  <widget class="KUrlRequester" name="file_tls_private_key_2"/>
+                 </item>
+                 <item row="4" column="0">
+                  <widget class="QLabel" name="label_tls_private_key_password_2">
+                   <property name="text">
+                    <string>Private key password</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="4" column="1" colspan="8">
+                  <widget class="KLineEdit" name="edit_tls_private_key_password_2"/>
+                 </item>
+                 <item row="5" column="0">
+                  <widget class="QLabel" name="label_tls_method_2">
+                   <property name="text">
+                    <string>TLS protocol method</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="5" column="1" colspan="3">
+                  <widget class="QComboBox" name="combo_tls_method_2">
+                   <item>
+                    <property name="text">
+                     <string>Default</string>
+                    </property>
+                   </item>
+                   <item>
+                    <property name="text">
+                     <string>TLSv1</string>
+                    </property>
+                   </item>
+                   <item>
+                    <property name="text">
+                     <string>SSLv2</string>
+                    </property>
+                   </item>
+                   <item>
+                    <property name="text">
+                     <string>SSLv3</string>
+                    </property>
+                   </item>
+                   <item>
+                    <property name="text">
+                     <string>SSLv23</string>
+                    </property>
+                   </item>
+                  </widget>
+                 </item>
+                 <item row="5" column="4" colspan="5">
+                  <spacer name="horizontalSpacer_7">
+                   <property name="orientation">
+                    <enum>Qt::Horizontal</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>40</width>
+                     <height>20</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                 <item row="6" column="0">
+                  <widget class="QLabel" name="label_tls_cipher_2">
+                   <property name="text">
+                    <string>TLS cipher list</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="6" column="1" colspan="8">
+                  <widget class="KLineEdit" name="edit_tls_cipher_2"/>
+                 </item>
+                 <item row="7" column="0">
+                  <widget class="QLabel" name="label_tls_outgoing_2">
+                   <property name="text">
+                    <string>Outgoing TLS server name</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="7" column="1" colspan="8">
+                  <widget class="KLineEdit" name="edit_tls_outgoing_2"/>
+                 </item>
+                 <item row="8" column="0">
+                  <widget class="QLabel" name="label_tls_timeout_2">
+                   <property name="text">
+                    <string>Negotiation timeout (s:ms)</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="8" column="1">
+                  <widget class="KIntSpinBox" name="spinbox_tls_timeout_sec_2">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="minimumSize">
+                    <size>
+                     <width>50</width>
+                     <height>0</height>
+                    </size>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="9" column="0" colspan="5">
+                  <widget class="QCheckBox" name="check_tls_incoming_2">
+                   <property name="text">
+                    <string>Verify incoming certificates (server side)</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="10" column="0" colspan="5">
+                  <widget class="QCheckBox" name="check_tls_answer_2">
+                   <property name="text">
+                    <string>Verify answer certificates (client side)</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="11" column="0" colspan="5">
+                  <widget class="QCheckBox" name="check_tls_requier_cert_2">
+                   <property name="text">
+                    <string>Require a certificate for incoming TLS connections</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="12" column="0">
+                  <widget class="QLabel" name="label_tls_details_2">
+                   <property name="text">
+                    <string>*Apply to all accounts</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="13" column="0">
+                  <spacer name="verticalSpacer_2">
+                   <property name="orientation">
+                    <enum>Qt::Vertical</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>20</width>
+                     <height>40</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                 <item row="8" column="4" colspan="5">
+                  <spacer name="horizontalSpacer_8">
+                   <property name="orientation">
+                    <enum>Qt::Horizontal</enum>
+                   </property>
+                   <property name="sizeHint" stdset="0">
+                    <size>
+                     <width>40</width>
+                     <height>20</height>
+                    </size>
+                   </property>
+                  </spacer>
+                 </item>
+                 <item row="8" column="3">
+                  <widget class="KIntSpinBox" name="spinbox_tls_timeout_msec_2">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="minimumSize">
+                    <size>
+                     <width>50</width>
+                     <height>0</height>
+                    </size>
+                   </property>
+                  </widget>
+                 </item>
+                 <item row="8" column="2">
+                  <widget class="QLabel" name="label_timeout2_2">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="minimumSize">
+                    <size>
+                     <width>10</width>
+                     <height>0</height>
+                    </size>
+                   </property>
+                   <property name="maximumSize">
+                    <size>
+                     <width>10</width>
+                     <height>16777215</height>
+                    </size>
+                   </property>
+                   <property name="text">
+                    <string>&lt;center&gt;:&lt;/center&gt;</string>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </widget>
+          </item>
+         </layout>
+        </widget>
        </widget>
       </item>
      </layout>
@@ -453,6 +882,16 @@
   </layout>
  </widget>
  <customwidgets>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KUrlRequester</class>
+   <extends>QFrame</extends>
+   <header>kurlrequester.h</header>
+  </customwidget>
   <customwidget>
    <class>KLineEdit</class>
    <extends>QLineEdit</extends>
diff --git a/sflphone-client-kde/src/sflphone_const.h b/sflphone-client-kde/src/sflphone_const.h
index c6ccd80411..8993df27f9 100644
--- a/sflphone-client-kde/src/sflphone_const.h
+++ b/sflphone-client-kde/src/sflphone_const.h
@@ -132,6 +132,8 @@
 #define ZRTP                             "1"
 #define SDES                             "2"
 
+/** TLS */
+#define TLS_LISTENER_PORT                   "TLS.listenerPort"
 #define TLS_ENABLE                       "TLS.enable"
 #define TLS_PORT                         "TLS.port"
 #define TLS_CA_LIST_FILE                 "TLS.certificateListFile"
-- 
GitLab