Commit 7d539f6a authored by Andrey Butirsky's avatar Andrey Butirsky

Keyboard Layout plugin: passthrough DBus switchToNextLayout() method to QML applet

No need to reimplement switching to the next layout logic in every QML
code - implemenation is already there on KWin/P-D side

KWin/P-D parts:
impr: Keyboard Layout DBus API: expose switchToNextLayout() method
parent b748d51c
......@@ -66,6 +66,11 @@ KeyboardLayout::~KeyboardLayout()
{
}
void KeyboardLayout::switchToNextLayout()
{
if (mIface) mIface->switchToNextLayout();
}
void KeyboardLayout::setCurrentLayout(const QString &layout)
{
if (mIface) mIface->setLayout(layout);
......
......@@ -45,6 +45,9 @@ Q_SIGNALS:
void currentLayoutLongNameChanged();
void layoutsChanged();
protected Q_SLOTS:
void switchToNextLayout();
private:
void setCurrentLayout(const QString &layout);
......
......@@ -7,6 +7,8 @@
</signal>
<signal name="layoutListChanged">
</signal>
<method name="switchToNextLayout">
</method>
<method name="setLayout">
<arg type="b" direction="out"/>
<arg name="layout" type="s" direction="in"/>
......
......@@ -21,14 +21,9 @@ PlasmaComponents3.ToolButton {
Accessible.name: i18ndc("plasma_lookandfeel_org.kde.lookandfeel", "Button to change keyboard layout", "Switch layout")
icon.name: "input-keyboard"
onClicked: layout.nextLayout()
onClicked: layout.switchToNextLayout()
KeyboardLayout {
id: layout
function nextLayout() {
var layouts = layout.layouts;
var index = (layouts.indexOf(layout.currentLayout)+1) % layouts.length;
layout.currentLayout = layouts[index];
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment