Show fingerprint only when file exists #4526
This commit is contained in:
parent
88538e5ee6
commit
59d013ac6a
|
@ -88,6 +88,26 @@ bool Fingerprint::exists(const QString& fingerprintText)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Fingerprint::localFingerprintExists()
|
||||||
|
{
|
||||||
|
CoreInterface coreInterface;
|
||||||
|
QString profileDir = coreInterface.getProfileDir();
|
||||||
|
|
||||||
|
QString dirName = QString("%1/%2")
|
||||||
|
.arg(profileDir)
|
||||||
|
.arg(kDirName);
|
||||||
|
|
||||||
|
QString path = QString("%1/%2").arg(dirName).arg(kLocalFilename);
|
||||||
|
QFile file(path);
|
||||||
|
|
||||||
|
bool exist = false;
|
||||||
|
if (file.exists()) {
|
||||||
|
exist = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return exist;
|
||||||
|
}
|
||||||
|
|
||||||
Fingerprint Fingerprint::local()
|
Fingerprint Fingerprint::local()
|
||||||
{
|
{
|
||||||
return Fingerprint(kLocalFilename);
|
return Fingerprint(kLocalFilename);
|
||||||
|
|
|
@ -34,6 +34,7 @@ public:
|
||||||
static Fingerprint trustedClients();
|
static Fingerprint trustedClients();
|
||||||
|
|
||||||
static QString localFingerprint();
|
static QString localFingerprint();
|
||||||
|
static bool localFingerprintExists();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_Filename;
|
QString m_Filename;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include "Fingerprint.h"
|
#include "Fingerprint.h"
|
||||||
|
#include "PluginManager.h"
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
#include "ServerConfigDialog.h"
|
#include "ServerConfigDialog.h"
|
||||||
#include "SettingsDialog.h"
|
#include "SettingsDialog.h"
|
||||||
|
@ -133,6 +134,17 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
||||||
updateEdition();
|
updateEdition();
|
||||||
|
|
||||||
m_pLabelPadlock->hide();
|
m_pLabelPadlock->hide();
|
||||||
|
|
||||||
|
if (Fingerprint::localFingerprintExists()) {
|
||||||
|
m_pLabelFingerprint->setVisible(true);
|
||||||
|
m_pLabelLocalFingerprint->setVisible(true);
|
||||||
|
m_pLabelLocalFingerprint->setText(
|
||||||
|
Fingerprint::localFingerprint());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_pLabelFingerprint->setVisible(false);
|
||||||
|
m_pLabelLocalFingerprint->setVisible(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -941,17 +953,6 @@ void MainWindow::setEdition(int type)
|
||||||
}
|
}
|
||||||
|
|
||||||
setWindowTitle(title);
|
setWindowTitle(title);
|
||||||
|
|
||||||
if (type == Pro) {
|
|
||||||
m_pLabelFingerprint->setVisible(true);
|
|
||||||
m_pLabelLocalFingerprint->setVisible(true);
|
|
||||||
m_pLabelLocalFingerprint->setText(
|
|
||||||
Fingerprint::localFingerprint());
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_pLabelFingerprint->setVisible(false);
|
|
||||||
m_pLabelLocalFingerprint->setVisible(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||||
|
|
Loading…
Reference in New Issue