Added warning for enable encryption #4584

This commit is contained in:
Jerry (Xinyu Hou) 2015-06-08 15:39:33 -07:00
parent 756000d8a9
commit 8e15b77db3
2 changed files with 19 additions and 2 deletions

View File

@ -37,7 +37,8 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::SettingsDialogBase(), Ui::SettingsDialogBase(),
m_AppConfig(config), m_AppConfig(config),
m_SuppressElevateWarning(false) m_SuppressElevateWarning(false),
m_SuppressEncryptionWarning(false)
{ {
setupUi(this); setupUi(this);
@ -68,7 +69,9 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
m_pCheckBoxEnableCrypto->setChecked(false); m_pCheckBoxEnableCrypto->setChecked(false);
} }
else { else {
m_SuppressEncryptionWarning = true;
m_pCheckBoxEnableCrypto->setChecked(m_AppConfig.getCryptoEnabled()); m_pCheckBoxEnableCrypto->setChecked(m_AppConfig.getCryptoEnabled());
m_SuppressEncryptionWarning = false;
} }
} }
@ -83,6 +86,7 @@ void SettingsDialog::accept()
appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString()); appConfig().setLanguage(m_pComboLanguage->itemData(m_pComboLanguage->currentIndex()).toString());
appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked()); appConfig().setElevateMode(m_pCheckBoxElevateMode->isChecked());
appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked()); appConfig().setAutoHide(m_pCheckBoxAutoHide->isChecked());
appConfig().setCryptoEnabled(m_pCheckBoxEnableCrypto->isChecked());
appConfig().saveSettings(); appConfig().saveSettings();
QDialog::accept(); QDialog::accept();
} }
@ -164,5 +168,17 @@ void SettingsDialog::on_m_pCheckBoxElevateMode_toggled(bool checked)
void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked) void SettingsDialog::on_m_pCheckBoxEnableCrypto_toggled(bool checked)
{ {
m_AppConfig.setCryptoEnabled(checked); if (checked && !m_SuppressEncryptionWarning) {
int r = QMessageBox::warning(
this, tr("Synergy SSL Encryption"),
tr("Are you sure you want to enable SSL encryption?\n\n"
"This allows Synergy to establish a secure connection, "
"but can slow down the data transfer of clipboard and file."),
QMessageBox::Yes | QMessageBox::No);
if (r != QMessageBox::Yes) {
m_pCheckBoxEnableCrypto->setChecked(false);
return;
}
}
} }

View File

@ -47,6 +47,7 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
SynergyLocale m_Locale; SynergyLocale m_Locale;
CoreInterface m_CoreInterface; CoreInterface m_CoreInterface;
bool m_SuppressElevateWarning; bool m_SuppressElevateWarning;
bool m_SuppressEncryptionWarning;
private slots: private slots:
void on_m_pCheckBoxEnableCrypto_toggled(bool checked); void on_m_pCheckBoxEnableCrypto_toggled(bool checked);