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) ||
|
||||
(key == Settings::Security::TlsEnabled) || (key == Settings::Security::CheckPeers)) {
|
||||
if (TlsUtility::isEnabled() && !TlsUtility::isCertValid()) {
|
||||
qWarning() << tr("invalid certificate, generating a new one");
|
||||
TlsUtility::generateCertificate();
|
||||
if (TlsUtility::isEnabled()) {
|
||||
if (!TlsUtility::isCertValid()) {
|
||||
qWarning() << tr("invalid certificate, generating a new one");
|
||||
TlsUtility::generateCertificate();
|
||||
}
|
||||
m_fingerprint = {QCryptographicHash::Sha256, TlsUtility::certFingerprint()};
|
||||
updateFingerprintButton();
|
||||
}
|
||||
updateSecurityIcon(m_statusBar->securityIconVisible());
|
||||
return;
|
||||
|
|
@ -1188,7 +1192,6 @@ bool MainWindow::generateCertificate()
|
|||
}
|
||||
|
||||
m_fingerprint = {QCryptographicHash::Sha256, TlsUtility::certFingerprint()};
|
||||
|
||||
updateFingerprintButton();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#include "FingerprintPreview.h"
|
||||
#include "common/PlatformInfo.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFont>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
|
@ -23,10 +24,21 @@ FingerprintPreview::FingerprintPreview(
|
|||
setFrameStyle(QFrame::Sunken);
|
||||
setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
|
||||
setLayout(
|
||||
fingerprint.type == QCryptographicHash::Sha256 ? sha256Layout(fingerprint, titleText, hashMode) : emptyLayout()
|
||||
);
|
||||
if (fingerprint.type == QCryptographicHash::Sha256) {
|
||||
setLayout(sha256Layout(fingerprint, titleText, hashMode));
|
||||
} else {
|
||||
qWarning() << "cannot render fingerprint, unsupported type:" << Fingerprint::typeToString(fingerprint.type);
|
||||
setLayout(emptyLayout());
|
||||
}
|
||||
|
||||
adjustSize();
|
||||
|
||||
if (!m_lblArt) {
|
||||
qDebug() << "sizing preview without art padding, no art label";
|
||||
setFixedSize(size());
|
||||
return;
|
||||
}
|
||||
|
||||
int artPadding = 48;
|
||||
if (deskflow::platform::isMac())
|
||||
artPadding = 32;
|
||||
|
|
|
|||
Loading…
Reference in a new issue