Enable network security checkbox only when ns plugin exists #4540
This commit is contained in:
parent
59d013ac6a
commit
951cbe9a62
|
@ -74,6 +74,23 @@ PluginManager::~PluginManager()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PluginManager::exist(QString name)
|
||||||
|
{
|
||||||
|
CoreInterface coreInterface;
|
||||||
|
QString PluginDir = coreInterface.getPluginDir();
|
||||||
|
QString pluginName = getPluginOsSpecificName(name);
|
||||||
|
QString filename;
|
||||||
|
filename.append(PluginDir);
|
||||||
|
filename.append(QDir::separator()).append(pluginName);
|
||||||
|
QFile file(filename);
|
||||||
|
bool exist = false;
|
||||||
|
if (file.exists()) {
|
||||||
|
exist = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return exist;
|
||||||
|
}
|
||||||
|
|
||||||
void PluginManager::downloadPlugins()
|
void PluginManager::downloadPlugins()
|
||||||
{
|
{
|
||||||
if (m_DataDownloader.isFinished()) {
|
if (m_DataDownloader.isFinished()) {
|
||||||
|
@ -251,19 +268,6 @@ QString PluginManager::getOpenSslSetupUrl()
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString PluginManager::getPluginOsSpecificName(const QString& pluginName)
|
|
||||||
{
|
|
||||||
QString result = pluginName;
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
result.append(kWinPluginExt);
|
|
||||||
#elif defined(Q_OS_MAC)
|
|
||||||
result = kMacPluginPrefix + pluginName + kMacPluginExt;
|
|
||||||
#else
|
|
||||||
result = kLinuxPluginPrefix + pluginName + kLinuxPluginExt;
|
|
||||||
#endif
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PluginManager::checkOpenSslBinary()
|
bool PluginManager::checkOpenSslBinary()
|
||||||
{
|
{
|
||||||
// assume OpenSsl is unavailable on Windows,
|
// assume OpenSsl is unavailable on Windows,
|
||||||
|
@ -426,3 +430,16 @@ bool PluginManager::runProgram(
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString PluginManager::getPluginOsSpecificName(const QString& pluginName)
|
||||||
|
{
|
||||||
|
QString result = pluginName;
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
result.append(kWinPluginExt);
|
||||||
|
#elif defined(Q_OS_MAC)
|
||||||
|
result = kMacPluginPrefix + pluginName + kMacPluginExt;
|
||||||
|
#else
|
||||||
|
result = kLinuxPluginPrefix + pluginName + kLinuxPluginExt;
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
|
@ -35,6 +35,8 @@ public:
|
||||||
|
|
||||||
int downloadIndex() { return m_DownloadIndex; }
|
int downloadIndex() { return m_DownloadIndex; }
|
||||||
|
|
||||||
|
static bool exist(QString name);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void downloadPlugins();
|
void downloadPlugins();
|
||||||
void saveOpenSslSetup();
|
void saveOpenSslSetup();
|
||||||
|
@ -45,7 +47,6 @@ private:
|
||||||
void savePlugin();
|
void savePlugin();
|
||||||
QString getPluginUrl(const QString& pluginName);
|
QString getPluginUrl(const QString& pluginName);
|
||||||
QString getOpenSslSetupUrl();
|
QString getOpenSslSetupUrl();
|
||||||
QString getPluginOsSpecificName(const QString& pluginName);
|
|
||||||
bool checkOpenSslBinary();
|
bool checkOpenSslBinary();
|
||||||
void downloadOpenSslSetup();
|
void downloadOpenSslSetup();
|
||||||
bool runProgram(
|
bool runProgram(
|
||||||
|
@ -53,6 +54,8 @@ private:
|
||||||
const QStringList& args,
|
const QStringList& args,
|
||||||
const QStringList& env);
|
const QStringList& env);
|
||||||
|
|
||||||
|
static QString getPluginOsSpecificName(const QString& pluginName);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void error(QString e);
|
void error(QString e);
|
||||||
void downloadNext();
|
void downloadNext();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "SettingsDialog.h"
|
#include "SettingsDialog.h"
|
||||||
|
|
||||||
|
#include "PluginManager.h"
|
||||||
#include "CoreInterface.h"
|
#include "CoreInterface.h"
|
||||||
#include "SynergyLocale.h"
|
#include "SynergyLocale.h"
|
||||||
#include "QSynergyApplication.h"
|
#include "QSynergyApplication.h"
|
||||||
|
@ -30,6 +31,8 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
|
|
||||||
|
static const char networkSecurity[] = "ns";
|
||||||
|
|
||||||
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||||
Ui::SettingsDialogBase(),
|
Ui::SettingsDialogBase(),
|
||||||
|
@ -57,10 +60,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||||
m_pCheckBoxElevateMode->hide();
|
m_pCheckBoxElevateMode->hide();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString pluginDir = m_CoreInterface.getPluginDir();
|
if (!PluginManager::exist(networkSecurity)) {
|
||||||
QDir dir(pluginDir);
|
|
||||||
int fileNum = dir.entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries).count();
|
|
||||||
if (fileNum == 0) {
|
|
||||||
m_pGroupNetworkSecurity->setEnabled(false);
|
m_pGroupNetworkSecurity->setEnabled(false);
|
||||||
m_pCheckBoxEnableCrypto->setChecked(false);
|
m_pCheckBoxEnableCrypto->setChecked(false);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue