From 1755b0fd8bd39fc3bcaf863b9cde37b003339847 Mon Sep 17 00:00:00 2001 From: Andrey Butirsky Date: Mon, 23 Nov 2020 16:56:18 +0300 Subject: [PATCH] impr: Keyboard Layout DBus API: expose switchToNextLayout() method switchToPreviousLayout() is also added P-W part: "Keyboard Layout plugin: passthrough DBus switchToNextLayout() method to QML applet" --- keyboard_layout.cpp | 10 ++++++++++ keyboard_layout.h | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/keyboard_layout.cpp b/keyboard_layout.cpp index 7876a2e633..99bf9b63ec 100644 --- a/keyboard_layout.cpp +++ b/keyboard_layout.cpp @@ -291,6 +291,16 @@ KeyboardLayoutDBusInterface::~KeyboardLayoutDBusInterface() QDBusConnection::sessionBus().unregisterService(s_keyboardService); } +void KeyboardLayoutDBusInterface::switchToNextLayout() +{ + m_keyboardLayout->switchToNextLayout(); +} + +void KeyboardLayoutDBusInterface::switchToPreviousLayout() +{ + m_keyboardLayout->switchToPreviousLayout(); +} + bool KeyboardLayoutDBusInterface::setLayout(const QString &layout) { const auto layouts = m_xkb->layoutNames(); diff --git a/keyboard_layout.h b/keyboard_layout.h index 72fbc2a6e0..19541c1b69 100644 --- a/keyboard_layout.h +++ b/keyboard_layout.h @@ -43,6 +43,8 @@ public: void init(); void checkLayoutChange(quint32 previousLayout); + void switchToNextLayout(); + void switchToPreviousLayout(); void resetLayout(); void updateNotifier(); @@ -57,8 +59,6 @@ private: void initDBusInterface(); void notifyLayoutChange(); void initNotifierItem(); - void switchToNextLayout(); - void switchToPreviousLayout(); void switchToLayout(xkb_layout_index_t index); void reinitNotifierMenu(); void loadShortcuts(); @@ -81,6 +81,8 @@ public: ~KeyboardLayoutDBusInterface() override; public Q_SLOTS: + void switchToNextLayout(); + void switchToPreviousLayout(); bool setLayout(const QString &layout); QString getCurrentLayout(); QString getCurrentLayoutLongName() const;