diff --git a/src/inputserviceclient.cpp b/src/inputserviceclient.cpp index 48e9388..15ed844 100644 --- a/src/inputserviceclient.cpp +++ b/src/inputserviceclient.cpp @@ -3,11 +3,13 @@ #include "inputserviceclient.h" +#include "input1interface.h" + #include #include #include #include -#include +#include #include #include #include @@ -243,17 +245,21 @@ void InputServiceClient::refreshControllers() return; } - QDBusInterface i(kInputService, kInputPath, kInputInterface, QDBusConnection::sessionBus()); - i.setTimeout(2000); + org::kde::ALaKarte::Input1 iface(kInputService, kInputPath, QDBusConnection::sessionBus()); + iface.setTimeout(2000); - const QDBusReply rescanReply = i.call(QStringLiteral("Rescan")); - if (!rescanReply.isValid()) { - setLastError(rescanReply.error().message()); + { + QDBusPendingReply rescanReply = iface.Rescan(); + rescanReply.waitForFinished(); + if (rescanReply.isError()) { + setLastError(rescanReply.error().message()); + } } - const QDBusReply reply = i.call(QStringLiteral("ListControllers")); + QDBusPendingReply reply = iface.ListControllers(); + reply.waitForFinished(); - if (!reply.isValid()) { + if (reply.isError()) { setLastError(reply.error().message()); return; } @@ -274,11 +280,13 @@ void InputServiceClient::refreshProfiles() return; } - QDBusInterface i(kInputService, kInputPath, kInputInterface, QDBusConnection::sessionBus()); - i.setTimeout(2000); - const QDBusReply reply = i.call(QStringLiteral("ListProfiles")); + org::kde::ALaKarte::Input1 iface(kInputService, kInputPath, QDBusConnection::sessionBus()); + iface.setTimeout(2000); - if (!reply.isValid()) { + QDBusPendingReply reply = iface.ListProfiles(); + reply.waitForFinished(); + + if (reply.isError()) { setLastError(reply.error().message()); return; } @@ -300,11 +308,13 @@ bool InputServiceClient::setActiveProfile(const QString &controllerId, const QSt return false; } - QDBusInterface i(kInputService, kInputPath, kInputInterface, QDBusConnection::sessionBus()); - i.setTimeout(2000); - const QDBusReply reply = i.call(QStringLiteral("SetActiveProfile"), controllerId, profileId); + org::kde::ALaKarte::Input1 iface(kInputService, kInputPath, QDBusConnection::sessionBus()); + iface.setTimeout(2000); - if (!reply.isValid()) { + QDBusPendingReply reply = iface.SetActiveProfile(controllerId, profileId); + reply.waitForFinished(); + + if (reply.isError()) { setLastError(reply.error().message()); return false; } @@ -319,11 +329,13 @@ QString InputServiceClient::createProfile(const QString &name) return {}; } - QDBusInterface i(kInputService, kInputPath, kInputInterface, QDBusConnection::sessionBus()); - i.setTimeout(2000); - const QDBusReply reply = i.call(QStringLiteral("CreateProfile"), name); + org::kde::ALaKarte::Input1 iface(kInputService, kInputPath, QDBusConnection::sessionBus()); + iface.setTimeout(2000); - if (!reply.isValid()) { + QDBusPendingReply reply = iface.CreateProfile(name); + reply.waitForFinished(); + + if (reply.isError()) { setLastError(reply.error().message()); return {}; } @@ -339,11 +351,13 @@ bool InputServiceClient::deleteProfile(const QString &profileId) return false; } - QDBusInterface i(kInputService, kInputPath, kInputInterface, QDBusConnection::sessionBus()); - i.setTimeout(2000); - const QDBusReply reply = i.call(QStringLiteral("DeleteProfile"), profileId); + org::kde::ALaKarte::Input1 iface(kInputService, kInputPath, QDBusConnection::sessionBus()); + iface.setTimeout(2000); - if (!reply.isValid()) { + QDBusPendingReply reply = iface.DeleteProfile(profileId); + reply.waitForFinished(); + + if (reply.isError()) { setLastError(reply.error().message()); return false; }