@@ -40,9 +40,32 @@
40#define PROP_LICENSE_ACCEPTED QStringLiteral("LicenseAccepted")
40#define PROP_LICENSE_ACCEPTED QStringLiteral("LicenseAccepted")
41#define PROP_LICENSE_BASE_PATH QStringLiteral("LicenseBasePath")
41#define PROP_LICENSE_BASE_PATH QStringLiteral("LicenseBasePath")
42#define PROP_MOUSE_CURSOR_SPEED QStringLiteral("MouseCursorSpeed")
42#define PROP_MOUSE_CURSOR_SPEED QStringLiteral("MouseCursorSpeed")
43+#define PROP_MOUSE_DOUBLE_CLICK_SPEED QStringLiteral("MouseDoubleClickSpeed")
44+#define PROP_MOUSE_PRIMARY_BUTTON QStringLiteral("MousePrimaryButton")
45+#define PROP_MOUSE_SCROLL_SPEED QStringLiteral("MouseScrollSpeed")
43#define PROP_PASSWORD_DISPLAY_HINT QStringLiteral("PasswordDisplayHint")
46#define PROP_PASSWORD_DISPLAY_HINT QStringLiteral("PasswordDisplayHint")
44#define PROP_STATS_WELCOME_SCREEN QStringLiteral("StatsWelcomeScreen")
47#define PROP_STATS_WELCOME_SCREEN QStringLiteral("StatsWelcomeScreen")
45#define PROP_TOUCHPAD_CURSOR_SPEED QStringLiteral("TouchpadCursorSpeed")
48#define PROP_TOUCHPAD_CURSOR_SPEED QStringLiteral("TouchpadCursorSpeed")
49+#define PROP_TOUCHPAD_DISABLE_WHILE_TYPING QStringLiteral("TouchpadDisableWhileTyping")
50+#define PROP_TOUCHPAD_DISABLE_WITH_MOUSE QStringLiteral("TouchpadDisableWithMouse")
51+#define PROP_TOUCHPAD_DOUBLE_CLICK_SPEED QStringLiteral("TouchpadDoubleClickSpeed")
52+#define PROP_TOUCHPAD_PRIMARY_BUTTON QStringLiteral("TouchpadPrimaryButton")
53+#define PROP_TOUCHPAD_SCROLL_SPEED QStringLiteral("TouchpadScrollSpeed")
54+#define PROP_TOUCHPAD_TAP_TO_CLICK QStringLiteral("TouchpadTapToClick")
55+#define PROP_TOUCHPAD_TWO_FINGER_SCROLL QStringLiteral("TouchpadTwoFingerScroll")
58+QVariant primaryButtonConverter(const QVariant &value)
60+ QString stringValue = value.toString();
61+ if (stringValue == "left") {
62+ return QVariant::fromValue(0);
63+ } else if (stringValue == "right") {
64+ return QVariant::fromValue(1); // Mir is less clear on this -- any non-zero value is the same
66+ return QVariant::fromValue(0); // default to left
47AccountsService::AccountsService(QObject* parent, const QString &user)
70AccountsService::AccountsService(QObject* parent, const QString &user)
48 : QObject(parent)
71 : QObject(parent)
@@ -68,8 +91,30 @@ AccountsService::AccountsService(QObject* parent, const QString &user)
69 registerProxy(IFACE_UBUNTU_INPUT, PROP_MOUSE_CURSOR_SPEED,
92 registerProxy(IFACE_UBUNTU_INPUT, PROP_MOUSE_CURSOR_SPEED,
70 m_unityInput, QStringLiteral("setMouseCursorSpeed"));
93 m_unityInput, QStringLiteral("setMouseCursorSpeed"));
94+ registerProxy(IFACE_UBUNTU_INPUT, PROP_MOUSE_DOUBLE_CLICK_SPEED,
95+ m_unityInput, QStringLiteral("setMouseDoubleClickSpeed"));
96+ registerProxy(IFACE_UBUNTU_INPUT, PROP_MOUSE_PRIMARY_BUTTON,
97+ m_unityInput, QStringLiteral("setMousePrimaryButton"),
98+ primaryButtonConverter);
99+ registerProxy(IFACE_UBUNTU_INPUT, PROP_MOUSE_SCROLL_SPEED,
100+ m_unityInput, QStringLiteral("setMouseScrollSpeed"));
71 registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_CURSOR_SPEED,
101 registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_CURSOR_SPEED,
72 m_unityInput, QStringLiteral("setTouchpadCursorSpeed"));
102 m_unityInput, QStringLiteral("setTouchpadCursorSpeed"));
103+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_SCROLL_SPEED,
104+ m_unityInput, QStringLiteral("setTouchpadScrollSpeed"));
105+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_DISABLE_WHILE_TYPING,
106+ m_unityInput, QStringLiteral("setTouchpadDisableWhileTyping"));
107+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_DISABLE_WITH_MOUSE,
108+ m_unityInput, QStringLiteral("setTouchpadDisableWithMouse"));
109+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_DOUBLE_CLICK_SPEED,
110+ m_unityInput, QStringLiteral("setTouchpadDoubleClickSpeed"));
111+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_PRIMARY_BUTTON,
112+ m_unityInput, QStringLiteral("setTouchpadPrimaryButton"),
113+ primaryButtonConverter);
114+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_TAP_TO_CLICK,
115+ m_unityInput, QStringLiteral("setTouchpadTapToClick"));
116+ registerProxy(IFACE_UBUNTU_INPUT, PROP_TOUCHPAD_TWO_FINGER_SCROLL,
117+ m_unityInput, QStringLiteral("setTouchpadTwoFingerScroll"));
74 setUser(!user.isEmpty() ? user : QString::fromUtf8(qgetenv("USER")));
119 setUser(!user.isEmpty() ? user : QString::fromUtf8(qgetenv("USER")));
@@ -200,7 +245,13 @@ void AccountsService::updateCache(const QString &interface, const QString &prope
200 PropertyInfo &info = m_properties[interface][property];
245 PropertyInfo &info = m_properties[interface][property];
202 if (info.proxyInterface) {
247 if (info.proxyInterface) {
248+ QVariant finalValue;
249+ if (info.proxyConverter) {
250+ finalValue = info.proxyConverter(value);
203− info.proxyInterface->asyncCall(info.proxyMethod, value);
254+ info.proxyInterface->asyncCall(info.proxyMethod, finalValue);
204 return; // don't bother saving a copy
255 return; // don't bother saving a copy
@@ -259,12 +310,13 @@ void AccountsService::updateAllProperties(const QString &interface, bool async)
262−void AccountsService::registerProxy(const QString &interface, const QString &property, QDBusInterface *iface, const QString &method)
313+void AccountsService::registerProxy(const QString &interface, const QString &property, QDBusInterface *iface, const QString &method, ProxyConverter converter)
264 registerProperty(interface, property, nullptr);
315 registerProperty(interface, property, nullptr);
266 m_properties[interface][property].proxyInterface = iface;
317 m_properties[interface][property].proxyInterface = iface;
267 m_properties[interface][property].proxyMethod = method;
318 m_properties[interface][property].proxyMethod = method;
319+ m_properties[interface][property].proxyConverter = converter;
270void AccountsService::registerProperty(const QString &interface, const QString &property, const QString &signal)
322void AccountsService::registerProperty(const QString &interface, const QString &property, const QString &signal)