Commit fac29606 authored by Andrey Butirsky's avatar Andrey Butirsky
Browse files

impr: Keyboard Layout DBus API: drop excessive method arguments

It's enough to give info about current layout only or all the layouts
altogether, so no need to pass layout to asqure in an argument.

P-W part:
impr: Keyboard Layout plugin: drop excessive DBus API method arguments
parent 1755b0fd
......@@ -77,7 +77,7 @@ void KeyboardLayout::initDBusInterface()
m_dbusInterface = new KeyboardLayoutDBusInterface(m_xkb, this);
connect(this, &KeyboardLayout::layoutChanged, m_dbusInterface,
[this] {
emit m_dbusInterface->currentLayoutChanged(m_xkb->layoutName());
emit m_dbusInterface->layoutChanged(m_xkb->layoutName());
}
);
// TODO: the signal might be emitted even if the list didn't change
......@@ -319,17 +319,22 @@ bool KeyboardLayoutDBusInterface::setLayout(const QString &layout)
return true;
}
QString KeyboardLayoutDBusInterface::getCurrentLayout()
QString KeyboardLayoutDBusInterface::getLayout() const
{
return m_xkb->layoutName();
}
QString KeyboardLayoutDBusInterface::getCurrentLayoutLongName() const
QString KeyboardLayoutDBusInterface::getLayoutDisplayName() const
{
return m_xkb->layoutShortName();
}
QString KeyboardLayoutDBusInterface::getLayoutLongName() const
{
return translatedLayout(m_xkb->layoutName());
}
QStringList KeyboardLayoutDBusInterface::getLayoutsList()
QStringList KeyboardLayoutDBusInterface::getLayoutsList() const
{
const auto layouts = m_xkb->layoutNames();
QStringList ret;
......@@ -339,12 +344,4 @@ QStringList KeyboardLayoutDBusInterface::getLayoutsList()
return ret;
}
QString KeyboardLayoutDBusInterface::getLayoutDisplayName(const QString &layout)
{
// TODO: remove arguments from the DBus API methods
Q_UNUSED(layout)
return m_xkb->layoutShortName();
}
}
......@@ -84,13 +84,13 @@ public Q_SLOTS:
void switchToNextLayout();
void switchToPreviousLayout();
bool setLayout(const QString &layout);
QString getCurrentLayout();
QString getCurrentLayoutLongName() const;
QStringList getLayoutsList();
QString getLayoutDisplayName(const QString &layout);
QString getLayout() const;
QString getLayoutDisplayName() const;
QString getLayoutLongName() const;
QStringList getLayoutsList() const;
Q_SIGNALS:
void currentLayoutChanged(QString layout);
void layoutChanged(QString layout);
void layoutListChanged();
private:
......
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