mirror of
https://github.com/debauchee/barrier.git
synced 2024-12-24 03:23:15 +03:00
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()
|
||||
{
|
||||
if (m_DataDownloader.isFinished()) {
|
||||
@ -251,19 +268,6 @@ QString PluginManager::getOpenSslSetupUrl()
|
||||
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()
|
||||
{
|
||||
// assume OpenSsl is unavailable on Windows,
|
||||
@ -426,3 +430,16 @@ bool PluginManager::runProgram(
|
||||
|
||||
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; }
|
||||
|
||||
static bool exist(QString name);
|
||||
|
||||
public slots:
|
||||
void downloadPlugins();
|
||||
void saveOpenSslSetup();
|
||||
@ -45,7 +47,6 @@ private:
|
||||
void savePlugin();
|
||||
QString getPluginUrl(const QString& pluginName);
|
||||
QString getOpenSslSetupUrl();
|
||||
QString getPluginOsSpecificName(const QString& pluginName);
|
||||
bool checkOpenSslBinary();
|
||||
void downloadOpenSslSetup();
|
||||
bool runProgram(
|
||||
@ -53,6 +54,8 @@ private:
|
||||
const QStringList& args,
|
||||
const QStringList& env);
|
||||
|
||||
static QString getPluginOsSpecificName(const QString& pluginName);
|
||||
|
||||
signals:
|
||||
void error(QString e);
|
||||
void downloadNext();
|
||||
|
@ -18,6 +18,7 @@
|
||||
|
||||
#include "SettingsDialog.h"
|
||||
|
||||
#include "PluginManager.h"
|
||||
#include "CoreInterface.h"
|
||||
#include "SynergyLocale.h"
|
||||
#include "QSynergyApplication.h"
|
||||
@ -30,6 +31,8 @@
|
||||
#include <QFileDialog>
|
||||
#include <QDir>
|
||||
|
||||
static const char networkSecurity[] = "ns";
|
||||
|
||||
SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
|
||||
Ui::SettingsDialogBase(),
|
||||
@ -57,10 +60,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
||||
m_pCheckBoxElevateMode->hide();
|
||||
#endif
|
||||
|
||||
QString pluginDir = m_CoreInterface.getPluginDir();
|
||||
QDir dir(pluginDir);
|
||||
int fileNum = dir.entryInfoList(QDir::NoDotAndDotDot|QDir::AllEntries).count();
|
||||
if (fileNum == 0) {
|
||||
if (!PluginManager::exist(networkSecurity)) {
|
||||
m_pGroupNetworkSecurity->setEnabled(false);
|
||||
m_pCheckBoxEnableCrypto->setChecked(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user