From 742cd70f986cdeb5a4d6df7aa865857782aaf649 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Thu, 6 Oct 2016 11:29:34 +0100 Subject: [PATCH] #5627 Toggle fingerprint visibility when toggling SSL state --- src/gui/res/MainWindowBase.ui | 2 +- src/gui/src/AppConfig.cpp | 5 ++++- src/gui/src/AppConfig.h | 7 ++++--- src/gui/src/MainWindow.cpp | 13 ++++++++++++- src/gui/src/MainWindow.h | 1 + src/gui/src/VersionChecker.cpp | 6 ++++-- 6 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/gui/res/MainWindowBase.ui b/src/gui/res/MainWindowBase.ui index 5a852c8c..87144cd1 100644 --- a/src/gui/res/MainWindowBase.ui +++ b/src/gui/res/MainWindowBase.ui @@ -128,7 +128,7 @@ - Fingerprint: + SSL Fingerprint: diff --git a/src/gui/src/AppConfig.cpp b/src/gui/src/AppConfig.cpp index a6d081f9..9848e6b4 100644 --- a/src/gui/src/AppConfig.cpp +++ b/src/gui/src/AppConfig.cpp @@ -281,7 +281,10 @@ ElevateMode AppConfig::elevateMode() return m_ElevateMode; } -void AppConfig::setCryptoEnabled(bool e) { m_CryptoEnabled = e; } +void AppConfig::setCryptoEnabled(bool e) { + m_CryptoEnabled = e; + emit sslToggled(e); +} bool AppConfig::getCryptoEnabled() const { return (edition() == Pro) && m_CryptoEnabled; diff --git a/src/gui/src/AppConfig.h b/src/gui/src/AppConfig.h index 3d15ec6e..271ef683 100644 --- a/src/gui/src/AppConfig.h +++ b/src/gui/src/AppConfig.h @@ -98,14 +98,15 @@ class AppConfig: public QObject void setCryptoEnabled(bool e); bool getCryptoEnabled() const; + void setAutoHide(bool b); bool getAutoHide(); - void saveSettings(); - bool activationHasRun() const; AppConfig& activationHasRun(bool value); + void saveSettings(); + protected: QSettings& settings(); void setScreenName(const QString& s); @@ -118,7 +119,6 @@ class AppConfig: public QObject void setLanguage(const QString language); void setStartedBefore(bool b); void setElevateMode(ElevateMode em); - void loadSettings(); private: @@ -150,6 +150,7 @@ class AppConfig: public QObject signals: void editionSet(int); + void sslToggled(bool enabled); }; #endif diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 64271c14..f9903a12 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -140,6 +140,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pLabelPadlock->hide(); connect (this, SIGNAL(windowShown()), this, SLOT(on_windowShown()), Qt::QueuedConnection); connect (&m_AppConfig, SIGNAL(editionSet(int)), this, SLOT(setEdition(int)), Qt::QueuedConnection); + connect (&m_AppConfig, SIGNAL(sslToggled(bool)), this, SLOT(sslToggled(bool)), Qt::QueuedConnection); } MainWindow::~MainWindow() @@ -497,7 +498,7 @@ void MainWindow::restartSynergy() void MainWindow::proofreadInfo() { - setEdition(m_AppConfig.edition()); + setEdition(m_AppConfig.edition()); // Why is this here? int oldState = m_SynergyState; m_SynergyState = synergyDisconnected; @@ -628,6 +629,16 @@ void MainWindow::startSynergy() } } +void +MainWindow::sslToggled (bool enabled) +{ + if (enabled) { + m_pSslCertificate = new SslCertificate(this); + m_pSslCertificate->generateCertificate(); + } + updateLocalFingerprint(); +} + bool MainWindow::clientArgs(QStringList& args, QString& app) { app = appPath(appConfig().synergycName()); diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 2f0b2c5b..efd83dcc 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -126,6 +126,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void startSynergy(); protected slots: + void sslToggled(bool enabled); void on_m_pGroupClient_toggled(bool on); void on_m_pGroupServer_toggled(bool on); bool on_m_pButtonBrowseConfigFile_clicked(); diff --git a/src/gui/src/VersionChecker.cpp b/src/gui/src/VersionChecker.cpp index 1f6980fc..4ce27433 100644 --- a/src/gui/src/VersionChecker.cpp +++ b/src/gui/src/VersionChecker.cpp @@ -51,8 +51,10 @@ void VersionChecker::replyFinished(QNetworkReply* reply) if (!newestVersion.isEmpty()) { QString currentVersion = getVersion(); - if (compareVersions(currentVersion, newestVersion) > 0) - emit updateFound(newestVersion); + if (currentVersion != "Unknown") { + if (compareVersions(currentVersion, newestVersion) > 0) + emit updateFound(newestVersion); + } } }