#5627 Toggle fingerprint visibility when toggling SSL state

This commit is contained in:
Andrew Nelless 2016-10-06 11:29:34 +01:00
parent c288918d68
commit 742cd70f98
6 changed files with 26 additions and 8 deletions

View File

@ -128,7 +128,7 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="text"> <property name="text">
<string>Fingerprint:</string> <string>SSL Fingerprint:</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -281,7 +281,10 @@ ElevateMode AppConfig::elevateMode()
return m_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 { bool AppConfig::getCryptoEnabled() const {
return (edition() == Pro) && m_CryptoEnabled; return (edition() == Pro) && m_CryptoEnabled;

View File

@ -98,14 +98,15 @@ class AppConfig: public QObject
void setCryptoEnabled(bool e); void setCryptoEnabled(bool e);
bool getCryptoEnabled() const; bool getCryptoEnabled() const;
void setAutoHide(bool b); void setAutoHide(bool b);
bool getAutoHide(); bool getAutoHide();
void saveSettings();
bool activationHasRun() const; bool activationHasRun() const;
AppConfig& activationHasRun(bool value); AppConfig& activationHasRun(bool value);
void saveSettings();
protected: protected:
QSettings& settings(); QSettings& settings();
void setScreenName(const QString& s); void setScreenName(const QString& s);
@ -118,7 +119,6 @@ class AppConfig: public QObject
void setLanguage(const QString language); void setLanguage(const QString language);
void setStartedBefore(bool b); void setStartedBefore(bool b);
void setElevateMode(ElevateMode em); void setElevateMode(ElevateMode em);
void loadSettings(); void loadSettings();
private: private:
@ -150,6 +150,7 @@ class AppConfig: public QObject
signals: signals:
void editionSet(int); void editionSet(int);
void sslToggled(bool enabled);
}; };
#endif #endif

View File

@ -140,6 +140,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pLabelPadlock->hide(); m_pLabelPadlock->hide();
connect (this, SIGNAL(windowShown()), this, SLOT(on_windowShown()), Qt::QueuedConnection); 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(editionSet(int)), this, SLOT(setEdition(int)), Qt::QueuedConnection);
connect (&m_AppConfig, SIGNAL(sslToggled(bool)), this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -497,7 +498,7 @@ void MainWindow::restartSynergy()
void MainWindow::proofreadInfo() void MainWindow::proofreadInfo()
{ {
setEdition(m_AppConfig.edition()); setEdition(m_AppConfig.edition()); // Why is this here?
int oldState = m_SynergyState; int oldState = m_SynergyState;
m_SynergyState = synergyDisconnected; 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) bool MainWindow::clientArgs(QStringList& args, QString& app)
{ {
app = appPath(appConfig().synergycName()); app = appPath(appConfig().synergycName());

View File

@ -126,6 +126,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void startSynergy(); void startSynergy();
protected slots: protected slots:
void sslToggled(bool enabled);
void on_m_pGroupClient_toggled(bool on); void on_m_pGroupClient_toggled(bool on);
void on_m_pGroupServer_toggled(bool on); void on_m_pGroupServer_toggled(bool on);
bool on_m_pButtonBrowseConfigFile_clicked(); bool on_m_pButtonBrowseConfigFile_clicked();

View File

@ -51,9 +51,11 @@ void VersionChecker::replyFinished(QNetworkReply* reply)
if (!newestVersion.isEmpty()) if (!newestVersion.isEmpty())
{ {
QString currentVersion = getVersion(); QString currentVersion = getVersion();
if (currentVersion != "Unknown") {
if (compareVersions(currentVersion, newestVersion) > 0) if (compareVersions(currentVersion, newestVersion) > 0)
emit updateFound(newestVersion); emit updateFound(newestVersion);
} }
}
} }
int VersionChecker::compareVersions(const QString& left, const QString& right) int VersionChecker::compareVersions(const QString& left, const QString& right)