Revert "Add CMake flag to enable MDNS (off by default)"

This reverts commit cd2bff716e.
This commit is contained in:
Albert Vaca Cintora 2023-07-10 19:39:06 +02:00
parent cd2bff716e
commit 9b6c179e02
5 changed files with 5 additions and 35 deletions

View file

@ -65,7 +65,7 @@ else()
find_package(Qca-qt${QT_MAJOR_VERSION} ${QCA_MIN_VERSION} REQUIRED) find_package(Qca-qt${QT_MAJOR_VERSION} ${QCA_MIN_VERSION} REQUIRED)
set(Qca_LIBRARY qca-qt${QT_MAJOR_VERSION}) set(Qca_LIBRARY qca-qt${QT_MAJOR_VERSION})
set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons) set(KF5_REQUIRED_COMPONENTS I18n ConfigWidgets DBusAddons IconThemes Notifications KIO KCMUtils Service Solid Kirigami2 People WindowSystem GuiAddons DNSSD)
set(KF5_OPTIONAL_COMPONENTS DocTools) set(KF5_OPTIONAL_COMPONENTS DocTools)
set_package_properties(KF5Kirigami2 PROPERTIES set_package_properties(KF5Kirigami2 PROPERTIES

View file

@ -18,11 +18,6 @@ configure_file(dbushelper.h.in ${CMAKE_CURRENT_BINARY_DIR}/dbushelper.h)
add_subdirectory(backends/lan) add_subdirectory(backends/lan)
add_subdirectory(backends/loopback) add_subdirectory(backends/loopback)
option(MDNS_ENABLED "Use MDNS for device discovery" OFF)
if (MDNS_ENABLED)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS DNSSD)
endif()
option(BLUETOOTH_ENABLED "Bluetooth support for kdeconnect" OFF) option(BLUETOOTH_ENABLED "Bluetooth support for kdeconnect" OFF)
if(BLUETOOTH_ENABLED) if(BLUETOOTH_ENABLED)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Bluetooth) find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Bluetooth)
@ -68,6 +63,7 @@ PRIVATE
Qt${QT_MAJOR_VERSION}::DBus Qt${QT_MAJOR_VERSION}::DBus
KF5::I18n KF5::I18n
KF5::ConfigCore KF5::ConfigCore
KF5::DNSSD
) )
if(${KF5KIO_FOUND}) if(${KF5KIO_FOUND})
@ -83,11 +79,6 @@ if (LOOPBACK_ENABLED)
target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_LOOPBACK) target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_LOOPBACK)
endif() endif()
if (MDNS_ENABLED)
target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_MDNS)
target_link_libraries(kdeconnectcore PRIVATE KF5::DNSSD)
endif()
set_target_properties(kdeconnectcore PROPERTIES set_target_properties(kdeconnectcore PROPERTIES
VERSION ${KDECONNECT_VERSION} VERSION ${KDECONNECT_VERSION}
SOVERSION ${KDECONNECT_VERSION_MAJOR} SOVERSION ${KDECONNECT_VERSION_MAJOR}

View file

@ -1,21 +1,13 @@
set(backends_kdeconnect_SRCS set(backends_kdeconnect_SRCS
${backends_kdeconnect_SRCS} ${backends_kdeconnect_SRCS}
backends/lan/server.cpp backends/lan/server.cpp
backends/lan/lanlinkprovider.cpp backends/lan/lanlinkprovider.cpp
backends/lan/landevicelink.cpp backends/lan/landevicelink.cpp
backends/lan/compositeuploadjob.cpp backends/lan/compositeuploadjob.cpp
backends/lan/uploadjob.cpp backends/lan/uploadjob.cpp
) backends/lan/mdnsdiscovery.cpp
if (MDNS_ENABLED)
set(backends_kdeconnect_SRCS
${backends_kdeconnect_SRCS}
backends/lan/mdnsdiscovery.cpp
)
endif()
set(backends_kdeconnect_SRCS
${backends_kdeconnect_SRCS}
PARENT_SCOPE PARENT_SCOPE
) )

View file

@ -45,9 +45,7 @@ LanLinkProvider::LanLinkProvider(bool testMode, quint16 udpBroadcastPort, quint1
, m_udpListenPort(udpListenPort) , m_udpListenPort(udpListenPort)
, m_testMode(testMode) , m_testMode(testMode)
, m_combineBroadcastsTimer(this) , m_combineBroadcastsTimer(this)
#ifdef KDECONNET_MDNS
, m_mdnsDiscovery(this) , m_mdnsDiscovery(this)
#endif
{ {
m_combineBroadcastsTimer.setInterval(0); // increase this if waiting a single event-loop iteration is not enough m_combineBroadcastsTimer.setInterval(0); // increase this if waiting a single event-loop iteration is not enough
m_combineBroadcastsTimer.setSingleShot(true); m_combineBroadcastsTimer.setSingleShot(true);
@ -105,21 +103,16 @@ void LanLinkProvider::onStart()
} }
broadcastUdpIdentityPacket(); broadcastUdpIdentityPacket();
#ifdef KDECONNET_MDNS
m_mdnsDiscovery.startAnnouncing(); m_mdnsDiscovery.startAnnouncing();
m_mdnsDiscovery.startDiscovering(); m_mdnsDiscovery.startDiscovering();
#endif
qCDebug(KDECONNECT_CORE) << "LanLinkProvider started"; qCDebug(KDECONNECT_CORE) << "LanLinkProvider started";
} }
void LanLinkProvider::onStop() void LanLinkProvider::onStop()
{ {
#ifdef KDECONNET_MDNS
m_mdnsDiscovery.stopAnnouncing(); m_mdnsDiscovery.stopAnnouncing();
m_mdnsDiscovery.stopDiscovering(); m_mdnsDiscovery.stopDiscovering();
#endif
m_udpSocket.close(); m_udpSocket.close();
m_server->close(); m_server->close();
qCDebug(KDECONNECT_CORE) << "LanLinkProvider stopped"; qCDebug(KDECONNECT_CORE) << "LanLinkProvider stopped";
@ -145,10 +138,8 @@ void LanLinkProvider::broadcastToNetwork()
Q_ASSERT(m_tcpPort != 0); Q_ASSERT(m_tcpPort != 0);
broadcastUdpIdentityPacket(); broadcastUdpIdentityPacket();
#ifdef KDECONNET_MDNS
m_mdnsDiscovery.stopDiscovering(); m_mdnsDiscovery.stopDiscovering();
m_mdnsDiscovery.startDiscovering(); m_mdnsDiscovery.startDiscovering();
#endif
} }
void LanLinkProvider::broadcastUdpIdentityPacket() void LanLinkProvider::broadcastUdpIdentityPacket()

View file

@ -17,10 +17,8 @@
#include "backends/linkprovider.h" #include "backends/linkprovider.h"
#include "kdeconnectcore_export.h" #include "kdeconnectcore_export.h"
#include "landevicelink.h" #include "landevicelink.h"
#include "server.h"
#ifdef KDECONNET_MDNS
#include "mdnsdiscovery.h" #include "mdnsdiscovery.h"
#endif #include "server.h"
class KDECONNECTCORE_EXPORT LanLinkProvider : public LinkProvider class KDECONNECTCORE_EXPORT LanLinkProvider : public LinkProvider
{ {
@ -93,9 +91,7 @@ private:
const bool m_testMode; const bool m_testMode;
QTimer m_combineBroadcastsTimer; QTimer m_combineBroadcastsTimer;
#ifdef KDECONNET_MDNS
MdnsDiscovery m_mdnsDiscovery; MdnsDiscovery m_mdnsDiscovery;
#endif
}; };
#endif #endif