Don't use KDBusAddons on Windows

It's only used for KDBusService, which likely doesn't work properly on Windows
This commit is contained in:
Nicolas Fella
2021-01-27 15:36:55 +01:00
parent 9603811a6d
commit e6f2b5ea7f
3 changed files with 14 additions and 10 deletions

View File

@@ -60,11 +60,10 @@ else()
TYPE REQUIRED TYPE REQUIRED
PURPOSE "Secure storage of account secrets" PURPOSE "Secure storage of account secrets"
) )
find_package(KF5DBusAddons ${KF5_MIN_VERSION}) endif()
set_package_properties(KF5DBusAddons PROPERTIES
TYPE REQUIRED if (NOT ANDROID AND NOT WIN32)
PURPOSE "DBus convenience functions" find_package(KF5DBusAddons ${KF5_MIN_VERSION} REQUIRED)
)
endif() endif()
find_package(Quotient 0.7) find_package(Quotient 0.7)

View File

@@ -76,7 +76,12 @@ if(ANDROID)
"network-connect" "network-connect"
) )
else() else()
target_link_libraries(neochat PRIVATE Qt5::Widgets KF5::DBusAddons ${QTKEYCHAIN_LIBRARIES}) target_link_libraries(neochat PRIVATE Qt5::Widgets ${QTKEYCHAIN_LIBRARIES})
endif()
if(TARGET KF5::DBusAddons)
target_link_libraries(neochat PRIVATE KF5::DBusAddons)
target_compile_definitions(neochat PRIVATE -DHAVE_KDBUSADDONS)
endif() endif()
install(TARGETS neochat ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) install(TARGETS neochat ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})

View File

@@ -14,7 +14,7 @@
#include <QQuickWindow> #include <QQuickWindow>
#include <KAboutData> #include <KAboutData>
#ifndef Q_OS_ANDROID #ifdef HAVE_KDBUSADDONS
#include <KDBusService> #include <KDBusService>
#endif #endif
#include <KLocalizedContext> #include <KLocalizedContext>
@@ -83,8 +83,8 @@ int main(int argc, char *argv[])
KAboutData::setApplicationData(about); KAboutData::setApplicationData(about);
QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("org.kde.neochat"))); QApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("org.kde.neochat")));
#ifndef Q_OS_ANDROID #ifdef HAVE_KDBUSADDONS
KDBusService service(KDBusService::Unique); KDBusService service(KDBusService::Unique)
#endif #endif
#ifdef NEOCHAT_FLATPAK #ifdef NEOCHAT_FLATPAK
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
#ifndef Q_OS_ANDROID #ifdef HAVE_KDBUSADDONS
QObject::connect(&service, &KDBusService::activateRequested, &engine, [&engine](const QStringList & /*arguments*/, const QString & /*workingDirectory*/) { QObject::connect(&service, &KDBusService::activateRequested, &engine, [&engine](const QStringList & /*arguments*/, const QString & /*workingDirectory*/) {
const auto rootObjects = engine.rootObjects(); const auto rootObjects = engine.rootObjects();
for (auto obj : rootObjects) { for (auto obj : rootObjects) {