fix: improve fingerprint handling
This commit is contained in:
parent
74392eea6c
commit
1995423cb8
2 changed files with 22 additions and 7 deletions
|
|
@ -352,9 +352,13 @@ void MainWindow::settingsChanged(const QString &key)
|
||||||
|
|
||||||
if ((key == Settings::Security::Certificate) || (key == Settings::Security::KeySize) ||
|
if ((key == Settings::Security::Certificate) || (key == Settings::Security::KeySize) ||
|
||||||
(key == Settings::Security::TlsEnabled) || (key == Settings::Security::CheckPeers)) {
|
(key == Settings::Security::TlsEnabled) || (key == Settings::Security::CheckPeers)) {
|
||||||
if (TlsUtility::isEnabled() && !TlsUtility::isCertValid()) {
|
if (TlsUtility::isEnabled()) {
|
||||||
qWarning() << tr("invalid certificate, generating a new one");
|
if (!TlsUtility::isCertValid()) {
|
||||||
TlsUtility::generateCertificate();
|
qWarning() << tr("invalid certificate, generating a new one");
|
||||||
|
TlsUtility::generateCertificate();
|
||||||
|
}
|
||||||
|
m_fingerprint = {QCryptographicHash::Sha256, TlsUtility::certFingerprint()};
|
||||||
|
updateFingerprintButton();
|
||||||
}
|
}
|
||||||
updateSecurityIcon(m_statusBar->securityIconVisible());
|
updateSecurityIcon(m_statusBar->securityIconVisible());
|
||||||
return;
|
return;
|
||||||
|
|
@ -1188,7 +1192,6 @@ bool MainWindow::generateCertificate()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_fingerprint = {QCryptographicHash::Sha256, TlsUtility::certFingerprint()};
|
m_fingerprint = {QCryptographicHash::Sha256, TlsUtility::certFingerprint()};
|
||||||
|
|
||||||
updateFingerprintButton();
|
updateFingerprintButton();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
#include "FingerprintPreview.h"
|
#include "FingerprintPreview.h"
|
||||||
#include "common/PlatformInfo.h"
|
#include "common/PlatformInfo.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
@ -23,10 +24,21 @@ FingerprintPreview::FingerprintPreview(
|
||||||
setFrameStyle(QFrame::Sunken);
|
setFrameStyle(QFrame::Sunken);
|
||||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||||
|
|
||||||
setLayout(
|
if (fingerprint.type == QCryptographicHash::Sha256) {
|
||||||
fingerprint.type == QCryptographicHash::Sha256 ? sha256Layout(fingerprint, titleText, hashMode) : emptyLayout()
|
setLayout(sha256Layout(fingerprint, titleText, hashMode));
|
||||||
);
|
} else {
|
||||||
|
qWarning() << "cannot render fingerprint, unsupported type:" << Fingerprint::typeToString(fingerprint.type);
|
||||||
|
setLayout(emptyLayout());
|
||||||
|
}
|
||||||
|
|
||||||
adjustSize();
|
adjustSize();
|
||||||
|
|
||||||
|
if (!m_lblArt) {
|
||||||
|
qDebug() << "sizing preview without art padding, no art label";
|
||||||
|
setFixedSize(size());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int artPadding = 48;
|
int artPadding = 48;
|
||||||
if (deskflow::platform::isMac())
|
if (deskflow::platform::isMac())
|
||||||
artPadding = 32;
|
artPadding = 32;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue