From 458d8e4778d371d865cf66441186d96f59d7eea5 Mon Sep 17 00:00:00 2001 From: Andrew Nelless Date: Thu, 7 Jun 2018 16:23:35 +0100 Subject: [PATCH] #6301 Disable zeroconf for Enterprise builds --- src/gui/CMakeLists.txt | 6 ++++++ src/gui/src/MainWindow.cpp | 17 ++++++++++++++++- src/gui/src/MainWindow.h | 13 +++++++++++-- src/gui/src/SetupWizard.cpp | 10 ++++++---- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index 53dc95b7..bc8ba457 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -9,10 +9,12 @@ set (CMAKE_INCLUDE_CURRENT_DIR ON) file (GLOB LEGACY_GUI_SOURCE_FILES src/*.cpp src/*.h) file (GLOB LEGACY_GUI_UI_FILES src/*.ui) file (GLOB LEGACY_ACTIVATION_FILES src/*Activation* src/*License*) +file (GLOB LEGACY_ZEROCONF_FILES src/Zeroconf*) if (SYNERGY_ENTERPRISE) list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ACTIVATION_FILES}) list (REMOVE_ITEM LEGACY_GUI_UI_FILES ${LEGACY_ACTIVATION_FILES}) + list (REMOVE_ITEM LEGACY_GUI_SOURCE_FILES ${LEGACY_ZEROCONF_FILES}) endif () if (WIN32) @@ -29,6 +31,7 @@ add_executable (synergy WIN32 include_directories (./src) target_link_libraries (synergy shared) +if (NOT SYNERGY_ENTERPRISE) if (WIN32) include_directories ($ENV{BONJOUR_SDK_HOME}/Include) if (CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -44,13 +47,16 @@ if (WIN32) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") target_link_libraries (synergy dns_sd) endif() +endif() qt5_use_modules (synergy Core Widgets Network) target_compile_definitions (synergy PRIVATE -DSYNERGY_VERSION_STAGE="${SYNERGY_VERSION_STAGE}") target_compile_definitions (synergy PRIVATE -DSYNERGY_REVISION="${SYNERGY_REVISION}") if (WIN32) +if (NOT SYNERGY_ENTERPRISE) target_link_libraries (synergy ${DNSSD_LIB}) +endif () set_target_properties (synergy PROPERTIES LINK_FLAGS "/NODEFAULTLIB:LIBCMT") endif() diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 688f8c68..6036f67b 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -99,7 +99,9 @@ MainWindow::MainWindow (QSettings& settings, AppConfig& appConfig, m_pMenuEdit(NULL), m_pMenuWindow(NULL), m_pMenuHelp(NULL), +#ifndef SYNERGY_ENTERPRISE m_pZeroconfService(NULL), +#endif m_pDataDownloader(NULL), m_DownloadMessageBox(NULL), m_pCancelButton(NULL), @@ -183,6 +185,7 @@ MainWindow::MainWindow (QSettings& settings, AppConfig& appConfig, #ifdef SYNERGY_ENTERPRISE m_pActivate->setVisible(false); + m_pCheckBoxAutoConfig->setVisible(false); #endif } @@ -195,7 +198,9 @@ MainWindow::~MainWindow() saveSettings(); +#ifndef SYNERGY_ENTERPRISE delete m_pZeroconfService; +#endif if (m_DownloadMessageBox != NULL) { delete m_DownloadMessageBox; @@ -218,9 +223,11 @@ void MainWindow::open() m_VersionChecker.checkLatest(); +#ifndef SYNERGY_ENTERPRISE if (!appConfig().autoConfigPrompted()) { promptAutoConfig(); } +#endif // only start if user has previously started. this stops the gui from // auto hiding before the user has configured synergy (which of course @@ -729,6 +736,7 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) args << "--log" << appConfig().logFilenameCmd(); } +#ifndef SYNERGY_ENTERPRISE // check auto config first, if it is disabled or no server detected, // use line edit host name if it is not empty if (m_pCheckBoxAutoConfig->isChecked()) { @@ -738,6 +746,7 @@ bool MainWindow::clientArgs(QStringList& args, QString& app) return true; } } +#endif if (m_pLineEditHostname->text().isEmpty()) { show(); @@ -1051,6 +1060,7 @@ void MainWindow::changeEvent(QEvent* event) } } +#ifndef SYNERGY_ENTERPRISE void MainWindow::updateZeroconfService() { QMutexLocker locker(&m_UpdateZeroconfMutex); @@ -1068,6 +1078,7 @@ void MainWindow::updateZeroconfService() } } } +#endif void MainWindow::serverDetected(const QString name) { @@ -1171,17 +1182,21 @@ MainWindow::licenseManager() const void MainWindow::on_m_pGroupClient_toggled(bool on) { m_pGroupServer->setChecked(!on); +#ifndef SYNERGY_ENTERPRISE if (on) { updateZeroconfService(); } +#endif } void MainWindow::on_m_pGroupServer_toggled(bool on) { m_pGroupClient->setChecked(!on); +#ifndef SYNERGY_ENTERPRISE if (on) { updateZeroconfService(); } +#endif } bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() @@ -1321,6 +1336,7 @@ bool MainWindow::isServiceRunning() return false; } +#ifndef SYNERGY_ENTERPRISE bool MainWindow::isBonjourRunning() { bool result = false; @@ -1493,7 +1509,6 @@ void MainWindow::bonjourInstallFinished() m_pCheckBoxAutoConfig->setChecked(true); } -#ifndef SYNERGY_ENTERPRISE int MainWindow::raiseActivationDialog() { if (m_ActivationDialogRunning) { diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 10acc10c..eff397b1 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -119,10 +119,10 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void showConfigureServer(const QString& message); void showConfigureServer() { showConfigureServer(""); } void autoAddScreen(const QString name); - void updateZeroconfService(); void serverDetected(const QString name); void updateLocalFingerprint(); #ifndef SYNERGY_ENTERPRISE + void updateZeroconfService(); LicenseManager& licenseManager() const; int raiseActivationDialog(); #endif @@ -155,7 +155,9 @@ public slots: void logOutput(); void logError(); void updateFound(const QString& version); +#ifndef SYNERGY_ENTERPRISE void bonjourInstallFinished(); +#endif void saveSettings(); protected: @@ -187,9 +189,12 @@ public slots: #else bool isServiceRunning(); #endif + +#ifndef SYNERGY_ENTERPRISE bool isBonjourRunning(); void downloadBonjour(); void promptAutoConfig(); +#endif QString getProfileRootForArg(); void checkConnected(const QString& line); #ifndef SYNERGY_ENTERPRISE @@ -221,7 +226,9 @@ public slots: QMenu* m_pMenuEdit; QMenu* m_pMenuWindow; QMenu* m_pMenuHelp; +#ifndef SYNERGY_ENTERPRISE ZeroconfService* m_pZeroconfService; +#endif DataDownloader* m_pDataDownloader; QMessageBox* m_DownloadMessageBox; QAbstractButton* m_pCancelButton; @@ -238,10 +245,12 @@ public slots: #endif private slots: + void on_m_pButtonApply_clicked(); +#ifndef SYNERGY_ENTERPRISE void on_m_pCheckBoxAutoConfig_toggled(bool checked); void on_m_pComboServerList_currentIndexChanged(QString ); - void on_m_pButtonApply_clicked(); void installBonjour(); +#endif void on_windowShown(); signals: diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index c7af2547..f49a5000 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -1,11 +1,11 @@ /* * synergy -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. - * + * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. - * + * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ - + #include "SetupWizard.h" #include "MainWindow.h" #include "WebClient.h" @@ -61,7 +61,7 @@ SetupWizard::~SetupWizard() } bool SetupWizard::validateCurrentPage() -{ +{ QMessageBox message; message.setWindowTitle(tr("Setup Synergy")); message.setIcon(QMessageBox::Information); @@ -127,7 +127,9 @@ void SetupWizard::accept() if (m_StartMain) { +#ifndef SYNERGY_ENTERPRISE m_MainWindow.updateZeroconfService(); +#endif m_MainWindow.open(); } }