diff --git a/sflphone-client-kde/src/conf/dlgaccounts.cpp b/sflphone-client-kde/src/conf/dlgaccounts.cpp index 4ae3eed11acea7d5168140140b02f3080f93f776..582dd1c4b0c75619a17bdf0f65d3ff375bcff2e9 100644 --- a/sflphone-client-kde/src/conf/dlgaccounts.cpp +++ b/sflphone-client-kde/src/conf/dlgaccounts.cpp @@ -69,53 +69,57 @@ DlgAccounts::DlgAccounts(KConfigDialog *parent) this, SLOT(changedAccountList())); connect(button_accountRemove, SIGNAL(clicked()), this, SLOT(changedAccountList())); - connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)), - this, SLOT(changedAccountList())); - connect(spinbox_tls_listener, SIGNAL(editingFinished()), - this, SLOT(changedAccountList())); - connect(file_tls_authority, SIGNAL(textChanged(const QString &)), - this, SLOT(changedAccountList())); - connect(file_tls_endpoint, SIGNAL(textChanged(const QString &)), - this, SLOT(changedAccountList())); - connect(file_tls_private_key, SIGNAL(textChanged(const QString &)), - this, SLOT(changedAccountList())); - connect(combo_tls_method, SIGNAL(currentIndexChanged(int)), - this, SLOT(changedAccountList())); - connect(edit_tls_cipher, SIGNAL(textEdited(const QString &)), - this, SLOT(changedAccountList())); - connect(edit_tls_outgoing, SIGNAL(textEdited(const QString &)), - this, SLOT(changedAccountList())); - connect(spinbox_tls_timeout_sec, SIGNAL(editingFinished()), - this, SLOT(changedAccountList())); - connect(spinbox_tls_timeout_msec, SIGNAL(editingFinished()), - this, SLOT(changedAccountList())); - connect(check_tls_incoming, SIGNAL(clicked(bool)), - this, SLOT(changedAccountList())); - connect(check_tls_answer, SIGNAL(clicked(bool)), - this, SLOT(changedAccountList())); - connect(check_tls_requier_cert, SIGNAL(clicked(bool)), - this, SLOT(changedAccountList())); - connect(group_security_tls, SIGNAL(clicked(bool)), - this, SLOT(changedAccountList())); + connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)), + this, SLOT(changedAccountList())); + connect(spinbox_tls_listener, SIGNAL(editingFinished()), + this, SLOT(changedAccountList())); + connect(file_tls_authority, SIGNAL(textChanged(const QString &)), + this, SLOT(changedAccountList())); + connect(file_tls_endpoint, SIGNAL(textChanged(const QString &)), + this, SLOT(changedAccountList())); + connect(file_tls_private_key, SIGNAL(textChanged(const QString &)), + this, SLOT(changedAccountList())); + connect(combo_tls_method, SIGNAL(currentIndexChanged(int)), + this, SLOT(changedAccountList())); + connect(edit_tls_cipher, SIGNAL(textEdited(const QString &)), + this, SLOT(changedAccountList())); + connect(edit_tls_outgoing, SIGNAL(textEdited(const QString &)), + this, SLOT(changedAccountList())); + connect(spinbox_tls_timeout_sec, SIGNAL(editingFinished()), + this, SLOT(changedAccountList())); + connect(spinbox_tls_timeout_msec, SIGNAL(editingFinished()), + this, SLOT(changedAccountList())); + connect(check_tls_incoming, SIGNAL(clicked(bool)), + this, SLOT(changedAccountList())); + connect(check_tls_answer, SIGNAL(clicked(bool)), + this, SLOT(changedAccountList())); + connect(check_tls_requier_cert, SIGNAL(clicked(bool)), + this, SLOT(changedAccountList())); + connect(group_security_tls, SIGNAL(clicked(bool)), + this, SLOT(changedAccountList())); connect(&configurationManager, SIGNAL(accountsChanged()), this, SLOT(updateAccountStates())); - - connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)), - this, SLOT(changedAccountList())); + + connect(edit_tls_private_key_password, SIGNAL(textEdited(const QString &)), + this, SLOT(changedAccountList())); connect(this, SIGNAL(updateButtons()), parent, SLOT(updateButtons())); - connect(keditlistbox_codec->listView(), SIGNAL(clicked(QModelIndex)), - this, SLOT(codecClicked(QModelIndex))); - - connect(keditlistbox_codec->addButton(), SIGNAL(clicked()), - this, SLOT(addCodec())); - - connect(keditlistbox_codec, SIGNAL(changed()), - this, SLOT(codecChanged())); + connect(keditlistbox_codec->listView(), SIGNAL(clicked(QModelIndex)), + this, SLOT(codecClicked(QModelIndex))); + + connect(keditlistbox_codec->addButton(), SIGNAL(clicked()), + this, SLOT(addCodec())); + + connect(keditlistbox_codec, SIGNAL(changed()), + this, SLOT(codecChanged())); + + connect(combo_security_STRP, SIGNAL(currentIndexChanged(int)), + this, SLOT(updateCombo(int))); + } void DlgAccounts::saveAccountList() @@ -204,50 +208,59 @@ void DlgAccounts::saveAccount(QListWidgetItem * item) 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->text()); - account->setAccountDetail(TLS_LISTENER_PORT,QString::number(spinbox_tls_listener->value())); - account->setAccountDetail(TLS_CA_LIST_FILE,file_tls_authority->text()); - account->setAccountDetail(TLS_CERTIFICATE_FILE,file_tls_endpoint->text()); - account->setAccountDetail(TLS_PRIVATE_KEY_FILE,file_tls_private_key->text()); - //qDebug() << "\n\n\n\nSET: " << combo_tls_method->currentText() << "\n\n\n"; - account->setAccountDetail(TLS_METHOD,combo_tls_method->currentText()); - account->setAccountDetail(TLS_CIPHERS,edit_tls_cipher->text()); - account->setAccountDetail(TLS_SERVER_NAME,edit_tls_outgoing->text()); - account->setAccountDetail(TLS_NEGOTIATION_TIMEOUT_SEC,QString::number(spinbox_tls_timeout_sec->value())); - account->setAccountDetail(TLS_NEGOTIATION_TIMEOUT_MSEC,QString::number(spinbox_tls_timeout_msec->value())); - account->setAccountDetail(TLS_VERIFY_SERVER,check_tls_incoming->isChecked()?"true":"false"); - account->setAccountDetail(TLS_VERIFY_CLIENT,check_tls_answer->isChecked()?"true":"false"); - account->setAccountDetail(TLS_REQUIRE_CLIENT_CERTIFICATE,check_tls_requier_cert->isChecked()?"true":"false"); - account->setAccountDetail(TLS_ENABLE,group_security_tls->isChecked()?"true":"false"); - account->setAccountDetail(TLS_METHOD, QString::number(combo_security_STRP->currentIndex())); - - QStringList _codecList; - foreach (QString aCodec, keditlistbox_codec->items()) { - foreach (StringHash _aCodec, codecList) { - if (_aCodec["alias"] == aCodec) { - _codecList << _aCodec["id"]; - } - } - } - - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - configurationManager.setActiveCodecList(_codecList, account->getAccountDetail(ACCOUNT_ID)); - qDebug() << "Account codec have been saved" << _codecList << account->getAccountDetail(ACCOUNT_ID); + //Security + account->setAccountDetail(TLS_PASSWORD,edit_tls_private_key_password->text()); + account->setAccountDetail(TLS_LISTENER_PORT,QString::number(spinbox_tls_listener->value())); + account->setAccountDetail(TLS_CA_LIST_FILE,file_tls_authority->text()); + account->setAccountDetail(TLS_CERTIFICATE_FILE,file_tls_endpoint->text()); + account->setAccountDetail(TLS_PRIVATE_KEY_FILE,file_tls_private_key->text()); + //qDebug() << "\n\n\n\nSET: " << combo_tls_method->currentText() << "\n\n\n"; + account->setAccountDetail(TLS_METHOD,combo_tls_method->currentText()); + account->setAccountDetail(TLS_CIPHERS,edit_tls_cipher->text()); + account->setAccountDetail(TLS_SERVER_NAME,edit_tls_outgoing->text()); + account->setAccountDetail(TLS_NEGOTIATION_TIMEOUT_SEC,QString::number(spinbox_tls_timeout_sec->value())); + account->setAccountDetail(TLS_NEGOTIATION_TIMEOUT_MSEC,QString::number(spinbox_tls_timeout_msec->value())); + account->setAccountDetail(TLS_VERIFY_SERVER,check_tls_incoming->isChecked()?"true":"false"); + account->setAccountDetail(TLS_VERIFY_CLIENT,check_tls_answer->isChecked()?"true":"false"); + account->setAccountDetail(TLS_REQUIRE_CLIENT_CERTIFICATE,check_tls_requier_cert->isChecked()?"true":"false"); + account->setAccountDetail(TLS_ENABLE,group_security_tls->isChecked()?"true":"false"); + qDebug() << "ZRTP: " << combo_security_STRP->currentIndex(); + account->setAccountDetail(TLS_METHOD, QString::number(combo_security_STRP->currentIndex())); + + account->setAccountDetail(ACCOUNT_DISPLAY_SAS_ONCE, checkbox_ZRTP_Ask_user->isChecked()?"true":"false"); + account->setAccountDetail(ACCOUNT_SRTP_RTP_FALLBACK, checkbox_SDES_fallback_rtp->isChecked()?"true":"false"); + account->setAccountDetail(ACCOUNT_ZRTP_DISPLAY_SAS, checkbox_ZRTP_display_SAS->isChecked()?"true":"false"); + account->setAccountDetail(ACCOUNT_ZRTP_NOT_SUPP_WARNING, checkbox_ZRTP_warn_supported->isChecked()?"true":"false"); + account->setAccountDetail(ACCOUNT_ZRTP_HELLO_HASH, checkbox_ZTRP_send_hello->isChecked()?"true":"false"); + + + + QStringList _codecList; + foreach (QString aCodec, keditlistbox_codec->items()) { + foreach (StringHash _aCodec, codecList) { + if (_aCodec["alias"] == aCodec) { + _codecList << _aCodec["id"]; + } + } + } + + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + configurationManager.setActiveCodecList(_codecList, account->getAccountDetail(ACCOUNT_ID)); + qDebug() << "Account codec have been saved" << _codecList << account->getAccountDetail(ACCOUNT_ID); } void DlgAccounts::loadAccount(QListWidgetItem * item) { if(! item ) { - qDebug() << "Attempting to load details of an account from a NULL item"; - return; - } + qDebug() << "Attempting to load details of an account from a NULL item"; + return; + } Account * account = accountList->getAccountByItem(item); if(! account ) { - qDebug() << "Attempting to load details of an unexisting account"; - return; - } + qDebug() << "Attempting to load details of an unexisting account"; + return; + } edit1_alias->setText( account->getAccountDetail(ACCOUNT_ALIAS)); @@ -270,36 +283,66 @@ void DlgAccounts::loadAccount(QListWidgetItem * item) bool ok; int val = account->getAccountDetail(ACCOUNT_EXPIRE).toInt(&ok); spinbox_regExpire->setValue(ok ? val : ACCOUNT_EXPIRE_DEFAULT); - - //Security - edit_tls_private_key_password->setText( account->getAccountDetail(TLS_PASSWORD )); - spinbox_tls_listener->setValue( account->getAccountDetail(TLS_LISTENER_PORT ).toInt()); - file_tls_authority->setText( account->getAccountDetail(TLS_CA_LIST_FILE )); - file_tls_endpoint->setText( account->getAccountDetail(TLS_CERTIFICATE_FILE )); - file_tls_private_key->setText( account->getAccountDetail(TLS_PRIVATE_KEY_FILE )); - //qDebug() << "\n\n\n\nTHIS: " << account->getAccountDetail(TLS_METHOD ) << "\n\n\n"; - combo_tls_method->setCurrentIndex( combo_tls_method->findText(account->getAccountDetail(TLS_METHOD ))); - edit_tls_cipher->setText( account->getAccountDetail(TLS_CIPHERS )); - edit_tls_outgoing->setText( account->getAccountDetail(TLS_SERVER_NAME )); - spinbox_tls_timeout_sec->setValue( account->getAccountDetail(TLS_NEGOTIATION_TIMEOUT_SEC ).toInt()); - spinbox_tls_timeout_msec->setValue( account->getAccountDetail(TLS_NEGOTIATION_TIMEOUT_MSEC ).toInt()); - check_tls_incoming->setChecked( (account->getAccountDetail(TLS_VERIFY_SERVER ) == "true")?1:0); - check_tls_answer->setChecked( (account->getAccountDetail(TLS_VERIFY_CLIENT ) == "true")?1:0); - check_tls_requier_cert->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()); - - keditlistbox_codec->clear(); - ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); - QStringList activeCodecList = configurationManager.getActiveCodecList(account->getAccountDetail(ACCOUNT_ID)); - foreach (QString aCodec, activeCodecList) { - foreach (StringHash _aCodec, codecList) { - if (_aCodec["id"] == aCodec) - keditlistbox_codec->insertItem(_aCodec["alias"]); - } - } + + //Security + edit_tls_private_key_password->setText( account->getAccountDetail(TLS_PASSWORD )); + spinbox_tls_listener->setValue( account->getAccountDetail(TLS_LISTENER_PORT ).toInt()); + file_tls_authority->setText( account->getAccountDetail(TLS_CA_LIST_FILE )); + file_tls_endpoint->setText( account->getAccountDetail(TLS_CERTIFICATE_FILE )); + file_tls_private_key->setText( account->getAccountDetail(TLS_PRIVATE_KEY_FILE )); + //qDebug() << "\n\n\n\nTHIS: " << account->getAccountDetail(TLS_METHOD ) << "\n\n\n"; + combo_tls_method->setCurrentIndex( combo_tls_method->findText(account->getAccountDetail(TLS_METHOD ))); + edit_tls_cipher->setText( account->getAccountDetail(TLS_CIPHERS )); + edit_tls_outgoing->setText( account->getAccountDetail(TLS_SERVER_NAME )); + spinbox_tls_timeout_sec->setValue( account->getAccountDetail(TLS_NEGOTIATION_TIMEOUT_SEC ).toInt()); + spinbox_tls_timeout_msec->setValue( account->getAccountDetail(TLS_NEGOTIATION_TIMEOUT_MSEC ).toInt()); + check_tls_incoming->setChecked( (account->getAccountDetail(TLS_VERIFY_SERVER ) == "true")?1:0); + check_tls_answer->setChecked( (account->getAccountDetail(TLS_VERIFY_CLIENT ) == "true")?1:0); + check_tls_requier_cert->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()); + + switch (account->getAccountDetail(TLS_METHOD ).toInt()) { + case 0: //KEY_EXCHANGE_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 + 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 + checkbox_SDES_fallback_rtp->setVisible(true); + 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; + } + + checkbox_ZRTP_Ask_user->setChecked((account->getAccountDetail(ACCOUNT_DISPLAY_SAS_ONCE) == "true")?1:0); + checkbox_SDES_fallback_rtp->setChecked((account->getAccountDetail(ACCOUNT_SRTP_RTP_FALLBACK) == "true")?1:0); + checkbox_ZRTP_display_SAS->setChecked((account->getAccountDetail(ACCOUNT_ZRTP_DISPLAY_SAS) == "true")?1:0); + checkbox_ZRTP_warn_supported->setChecked((account->getAccountDetail(ACCOUNT_ZRTP_NOT_SUPP_WARNING) == "true")?1:0); + checkbox_ZTRP_send_hello->setChecked((account->getAccountDetail(ACCOUNT_ZRTP_HELLO_HASH) == "true")?1:0); + + keditlistbox_codec->clear(); + ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance(); + QStringList activeCodecList = configurationManager.getActiveCodecList(account->getAccountDetail(ACCOUNT_ID)); + foreach (QString aCodec, activeCodecList) { + foreach (StringHash _aCodec, codecList) { + if (_aCodec["id"] == aCodec) + keditlistbox_codec->insertItem(_aCodec["alias"]); + } + } @@ -604,4 +647,31 @@ void DlgAccounts::codecChanged() accountListHasChanged = true; emit updateButtons(); +} + +void DlgAccounts::updateCombo(int value) { + + switch (combo_security_STRP->currentIndex()) { + case 0: //KEY_EXCHANGE_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 + 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 + checkbox_SDES_fallback_rtp->setVisible(true); + 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; + } } \ No newline at end of file diff --git a/sflphone-client-kde/src/conf/dlgaccounts.h b/sflphone-client-kde/src/conf/dlgaccounts.h index c8d86398bd5ba29677cd709b2006f04b052988f8..7abfe60f99cc97cf4d1041c3424ebaf8b4b41a4b 100644 --- a/sflphone-client-kde/src/conf/dlgaccounts.h +++ b/sflphone-client-kde/src/conf/dlgaccounts.h @@ -130,9 +130,10 @@ private slots: void updateAccountListCommands(); void updateStatusLabel(QListWidgetItem * item); void updateStatusLabel(Account * account); - void codecClicked(const QModelIndex & model); - void addCodec(QString name = ""); - void codecChanged(); + void codecClicked(const QModelIndex & model); + void addCodec(QString name = ""); + void codecChanged(); + void updateCombo(int value); signals: diff --git a/sflphone-client-kde/src/conf/dlgaccountsbase.ui b/sflphone-client-kde/src/conf/dlgaccountsbase.ui index 99c7aab4d540d95771a38e3973460799b90d31d9..e2231cf501d5a9b1156931df1a54322ef0b1a45a 100644 --- a/sflphone-client-kde/src/conf/dlgaccountsbase.ui +++ b/sflphone-client-kde/src/conf/dlgaccountsbase.ui @@ -233,7 +233,7 @@ </sizepolicy> </property> <property name="currentIndex"> - <number>0</number> + <number>5</number> </property> <widget class="QWidget" name="tab_basic"> <attribute name="title"> @@ -635,51 +635,12 @@ <rect> <x>0</x> <y>0</y> - <width>386</width> - <height>588</height> + <width>536</width> + <height>758</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"> + <item row="2" column="0" colspan="2"> <widget class="QLabel" name="label_tls_info"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> @@ -695,7 +656,7 @@ </property> </widget> </item> - <item row="2" column="0" colspan="3"> + <item row="3" column="0" colspan="2"> <widget class="QGroupBox" name="group_security_tls"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> @@ -970,6 +931,75 @@ </layout> </widget> </item> + <item row="0" column="0" colspan="2"> + <widget class="QGroupBox" name="groupbox_STRP_keyexchange"> + <property name="title"> + <string>SRTP key exchange</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <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> + <widget class="QCheckBox" name="checkbox_ZTRP_send_hello"> + <property name="text"> + <string>Send Hello Hash in SDP</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkbox_ZRTP_warn_supported"> + <property name="text"> + <string>Ask user to confirm SAS</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkbox_ZRTP_Ask_user"> + <property name="text"> + <string>Warn if ZRTP is not supported</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkbox_ZRTP_display_SAS"> + <property name="text"> + <string>Display SAS once for hold events</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="checkbox_SDES_fallback_rtp"> + <property name="text"> + <string>Fallback on RTP on SDES failure</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> </layout> </widget> </widget>