@@ -19,6 +19,7 @@
19#include "AccountsService.h"
19#include "AccountsService.h"
20#include "AccountsServiceDBusAdaptor.h"
20#include "AccountsServiceDBusAdaptor.h"
22+#include <QDBusInterface>
22#include <QFile>
23#include <QFile>
23#include <QStringList>
24#include <QStringList>
24#include <QDebug>
25#include <QDebug>
@@ -35,6 +36,11 @@ AccountsService::AccountsService(QObject* parent, const QString &user)
35 m_hereEnabled(false),
36 m_hereEnabled(false),
36 m_hereLicensePath() // null means not set yet
37 m_hereLicensePath() // null means not set yet
39+ m_unityInput = new QDBusInterface(QStringLiteral("com.canonical.Unity.Input"),
40+ QStringLiteral("/com/canonical/Unity/Input"),
41+ QStringLiteral("com.canonical.Unity.Input"),
42+ QDBusConnection::SM_BUSNAME(), this);
38 connect(m_service, &AccountsServiceDBusAdaptor::propertiesChanged, this, &AccountsService::onPropertiesChanged);
44 connect(m_service, &AccountsServiceDBusAdaptor::propertiesChanged, this, &AccountsService::onPropertiesChanged);
39 connect(m_service, &AccountsServiceDBusAdaptor::maybeChanged, this, &AccountsService::onMaybeChanged);
45 connect(m_service, &AccountsServiceDBusAdaptor::maybeChanged, this, &AccountsService::onMaybeChanged);
@@ -58,6 +64,8 @@ void AccountsService::setUser(const QString &user)
58 updateEnableLauncherWhileLocked(false);
64 updateEnableLauncherWhileLocked(false);
59 updateEnableIndicatorsWhileLocked(false);
65 updateEnableIndicatorsWhileLocked(false);
60 updateBackgroundFile(false);
66 updateBackgroundFile(false);
67+ updateMouseCursorSpeed();
68+ updateTouchpadCursorSpeed();
61 updateStatsWelcomeScreen(false);
69 updateStatsWelcomeScreen(false);
62 updatePasswordDisplayHint(false);
70 updatePasswordDisplayHint(false);
63 updateFailedLogins(false);
71 updateFailedLogins(false);
@@ -246,6 +254,52 @@ void AccountsService::updateBackgroundFile(bool async)
257+void AccountsService::updateMouseCursorSpeed()
259+ QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
260+ QStringLiteral("com.ubuntu.AccountsService.Input"),
261+ QStringLiteral("MouseCursorSpeed"));
262+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
264+ connect(watcher, &QDBusPendingCallWatcher::finished,
265+ this, [this](QDBusPendingCallWatcher* watcher) {
267+ QDBusPendingReply<QVariant> reply = *watcher;
268+ watcher->deleteLater();
269+ if (reply.isError()) {
270+ qWarning() << "Failed to get 'MouseCursorSpeed' property - " << reply.error().message();
274+ // Merely proxy this along to USC. We don't care about keeping a copy
275+ // or exporting it internally.
276+ m_unityInput->asyncCall(QStringLiteral("setMouseCursorSpeed"), reply.value());
280+void AccountsService::updateTouchpadCursorSpeed()
282+ QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
283+ QStringLiteral("com.ubuntu.AccountsService.Input"),
284+ QStringLiteral("TouchpadCursorSpeed"));
285+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(pendingReply, this);
287+ connect(watcher, &QDBusPendingCallWatcher::finished,
288+ this, [this](QDBusPendingCallWatcher* watcher) {
290+ QDBusPendingReply<QVariant> reply = *watcher;
291+ watcher->deleteLater();
292+ if (reply.isError()) {
293+ qWarning() << "Failed to get 'TouchpadCursorSpeed' property - " << reply.error().message();
297+ // Merely proxy this along to USC. We don't care about keeping a copy
298+ // or exporting it internally.
299+ m_unityInput->asyncCall(QStringLiteral("setTouchpadCursorSpeed"), reply.value());
249void AccountsService::updateStatsWelcomeScreen(bool async)
303void AccountsService::updateStatsWelcomeScreen(bool async)
251 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
305 QDBusPendingCall pendingReply = m_service->getUserPropertyAsync(m_user,
@@ -423,6 +477,13 @@ void AccountsService::onPropertiesChanged(const QString &user, const QString &in
423 if (changed.contains(QStringLiteral("FailedLogins"))) {
477 if (changed.contains(QStringLiteral("FailedLogins"))) {
424 updateFailedLogins();
478 updateFailedLogins();
480+ } else if (interface == QLatin1String("com.ubuntu.AccountsService.Input")) {
481+ if (changed.contains(QStringLiteral("MouseCursorSpeed"))) {
482+ updateMouseCursorSpeed();
484+ if (changed.contains(QStringLiteral("TouchpadCursorSpeed"))) {
485+ updateTouchpadCursorSpeed();
426 } else if (interface == QLatin1String("com.ubuntu.touch.AccountsService.SecurityPrivacy")) {
487 } else if (interface == QLatin1String("com.ubuntu.touch.AccountsService.SecurityPrivacy")) {
427 if (changed.contains(QStringLiteral("StatsWelcomeScreen"))) {
488 if (changed.contains(QStringLiteral("StatsWelcomeScreen"))) {
428 updateStatsWelcomeScreen();
489 updateStatsWelcomeScreen();