Commit 68bca3f2 authored by Andrey Butirsky's avatar Andrey Butirsky

impr: keyboard layout DBus API: rework to index based

Accomodate API changes on server sides.
ID is not marshalling over DBus any more as it's just Index now.
parent 8d266097
......@@ -71,13 +71,13 @@ void KeyboardLayout::switchToPreviousLayout()
if (mIface) mIface->switchToPreviousLayout();
}
void KeyboardLayout::setLayout(const QString &layout)
void KeyboardLayout::setLayout(uint index)
{
if (mIface) mIface->setLayout(layout);
if (mIface) mIface->setLayout(index);
}
template<class T>
void KeyboardLayout::requestDBusData(QDBusPendingReply<T> pendingReply, void (KeyboardLayout::*notify)(const T &))
void KeyboardLayout::requestDBusData(QDBusPendingReply<T> pendingReply, void (KeyboardLayout::*notify)(T))
{
const QDBusPendingCallWatcher * const watcher = new QDBusPendingCallWatcher(pendingReply, this);
connect(watcher, &QDBusPendingCallWatcher::finished, this,
......
......@@ -23,15 +23,15 @@ public:
~KeyboardLayout() override;
Q_SIGNALS:
void layoutChanged(const QString &idName);
void layoutsChanged(const QVector<LayoutNames> &layouts);
void layoutChanged(uint index);
void layoutsChanged(QVector<LayoutNames> layouts);
void layoutLongNameChanged(const QString &longName);
void layoutLongNameChanged(QString longName);
protected:
Q_INVOKABLE void switchToNextLayout();
Q_INVOKABLE void switchToPreviousLayout();
Q_INVOKABLE void setLayout(const QString &layout);
Q_INVOKABLE void setLayout(uint index);
Q_INVOKABLE void requestLayoutLongName();
......@@ -39,7 +39,7 @@ private:
enum DBusData {Layout, LayoutLongName, Layouts};
template<class T>
void requestDBusData(QDBusPendingReply<T> pendingReply, void (KeyboardLayout::*notify)(const T &));
void requestDBusData(QDBusPendingReply<T> pendingReply, void (KeyboardLayout::*notify)(T));
template<DBusData>
void requestDBusData();
......
......@@ -11,7 +11,7 @@ void LayoutNames::registerMetaType()
QDBusArgument &operator<<(QDBusArgument &argument, const LayoutNames &layoutNames)
{
argument.beginStructure();
argument << layoutNames.id << layoutNames.shortName << layoutNames.displayName << layoutNames.longName;
argument << layoutNames.shortName << layoutNames.displayName << layoutNames.longName;
argument.endStructure();
return argument;
}
......@@ -19,7 +19,7 @@ QDBusArgument &operator<<(QDBusArgument &argument, const LayoutNames &layoutName
const QDBusArgument &operator>>(const QDBusArgument &argument, LayoutNames &layoutNames)
{
argument.beginStructure();
argument >> layoutNames.id >> layoutNames.shortName >> layoutNames.displayName >> layoutNames.longName;
argument >> layoutNames.shortName >> layoutNames.displayName >> layoutNames.longName;
argument.endStructure();
return argument;
}
......@@ -9,7 +9,6 @@ class LayoutNames
{
Q_GADGET
Q_PROPERTY(QString id MEMBER id)
Q_PROPERTY(QString shortName MEMBER shortName)
Q_PROPERTY(QString displayName MEMBER displayName)
Q_PROPERTY(QString longName MEMBER longName)
......@@ -17,7 +16,6 @@ class LayoutNames
public:
static void registerMetaType();
QString id;
QString shortName;
QString displayName;
QString longName;
......
......@@ -3,7 +3,7 @@
<node>
<interface name="org.kde.KeyboardLayouts">
<signal name="layoutChanged">
<arg name="layout" type="s" direction="out"/>
<arg name="layout" type="u" direction="out"/>
</signal>
<signal name="layoutListChanged">
</signal>
......@@ -13,10 +13,10 @@
</method>
<method name="setLayout">
<arg type="b" direction="out"/>
<arg name="layout" type="s" direction="in"/>
<arg name="layout" type="u" direction="in"/>
</method>
<method name="getLayout">
<arg type="s" direction="out"/>
<arg type="u" direction="out"/>
</method>
<method name="getLayoutLongName">
<arg type="s" direction="out"/>
......
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