diff --git a/kioslave/desktop/CMakeLists.txt b/kioslave/desktop/CMakeLists.txt --- a/kioslave/desktop/CMakeLists.txt +++ b/kioslave/desktop/CMakeLists.txt @@ -4,7 +4,15 @@ add_subdirectory(tests) endif() -add_library(kio_desktop MODULE kio_desktop.cpp) +set(kio_desktop_SRCS kio_desktop.cpp) +qt5_add_dbus_interface( kio_desktop_SRCS ${KDED_DBUS_INTERFACE} kded_interface ) + +qt5_generate_dbus_interface( desktopnotifier.h ${CMAKE_CURRENT_BINARY_DIR}/desktopnotifier.xml ) +qt5_add_dbus_interface( kio_desktop_SRCS ${CMAKE_CURRENT_BINARY_DIR}/desktopnotifier.xml desktopnotifier_interface ) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_library(kio_desktop MODULE ${kio_desktop_SRCS}) target_link_libraries(kio_desktop Qt5::DBus Qt5::Gui KF5::KIOCore KF5::I18n Qt5::Network) diff --git a/kioslave/desktop/kio_desktop.cpp b/kioslave/desktop/kio_desktop.cpp --- a/kioslave/desktop/kio_desktop.cpp +++ b/kioslave/desktop/kio_desktop.cpp @@ -28,10 +28,12 @@ #include #include -#include #include #include +#include "kded_interface.h" +#include "desktopnotifier_interface.h" + extern "C" { int Q_DECL_EXPORT kdemain(int argc, char **argv) @@ -52,8 +54,11 @@ { checkLocalInstall(); - QDBusInterface kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/kded"), QStringLiteral("org.kde.kded5")); - kded.call(QStringLiteral("loadModule"), "desktopnotifier"); + org::kde::kded5 kded(QStringLiteral("org.kde.kded5"), + QStringLiteral("/kded"), + QDBusConnection::sessionBus()); + auto pending = kded.loadModule("desktopnotifier"); + pending.waitForFinished(); } DesktopProtocol::~DesktopProtocol() @@ -124,8 +129,8 @@ QUrl actual; rewriteUrl(url, actual); - QDBusInterface kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/desktopnotifier"), QStringLiteral("org.kde.DesktopNotifier")); - kded.call(QStringLiteral("watchDir"), actual.path()); + org::kde::DesktopNotifier kded(QStringLiteral("org.kde.kded5"), QStringLiteral("/modules/desktopnotifier"), QDBusConnection::sessionBus()); + kded.watchDir(actual.path()); } QString DesktopProtocol::desktopFile(KIO::UDSEntry &entry) const