Commit 63e0ba2d authored by Andrey Butirsky's avatar Andrey Butirsky Committed by David Edmundson

fix: [2/2] Keyboard Layout applet doesn't follow actual layout switching

DIGEST:
BUG: 426900
parent 2969719c
......@@ -43,7 +43,7 @@ KeyboardLayout::KeyboardLayout(QObject* parent)
}
connect(mIface, &OrgKdeKeyboardLayoutsInterface::currentLayoutChanged,
this, &KeyboardLayout::setCurrentLayout);
this, &KeyboardLayout::onCurrentLayoutChanged);
connect(mIface, &OrgKdeKeyboardLayoutsInterface::layoutListChanged,
this, &KeyboardLayout::requestLayoutsList);
......@@ -136,24 +136,32 @@ QString KeyboardLayout::currentLayout() const
return mCurrentLayout;
}
void KeyboardLayout::setCurrentLayout(const QString &layout)
bool KeyboardLayout::onCurrentLayoutChanged(const QString &layout)
{
if (!mIface) {
return;
return false;
}
if (mCurrentLayout == layout) {
return;
return false;
}
if (!mLayouts.contains(layout)) {
qCWarning(KEYBOARD_LAYOUT) << "No such layout" << layout;
return;
return false;
}
mCurrentLayout = layout;
requestCurrentLayoutDisplayName();
mIface->setLayout(layout);
Q_EMIT currentLayoutChanged(layout);
return true;
}
void KeyboardLayout::setCurrentLayout(const QString &layout)
{
if (onCurrentLayoutChanged(layout)) {
mIface->setLayout(layout);
}
}
......
......@@ -64,6 +64,7 @@ private Q_SLOTS:
void requestCurrentLayoutDisplayName();
void requestLayoutsList();
bool onCurrentLayoutChanged(const QString &newLayout);
void onCurrentLayoutReceived(QDBusPendingCallWatcher *watcher);
void onCurrentLayoutDisplayNameReceived(QDBusPendingCallWatcher *watcher);
void onLayoutsListReceived(QDBusPendingCallWatcher *watcher);
......
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