mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 07:03:08 +00:00
mobileshellstate: Make sure DBus calls are async
This commit is contained in:
parent
cadc5db962
commit
e16bdea17e
2 changed files with 27 additions and 7 deletions
|
|
@ -113,18 +113,36 @@ void ShellDBusClient::showVolumeOSD()
|
||||||
|
|
||||||
void ShellDBusClient::updateDoNotDisturb()
|
void ShellDBusClient::updateDoNotDisturb()
|
||||||
{
|
{
|
||||||
m_doNotDisturb = m_interface->doNotDisturb();
|
auto reply = m_interface->doNotDisturb();
|
||||||
Q_EMIT doNotDisturbChanged();
|
auto watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
|
|
||||||
|
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) {
|
||||||
|
QDBusPendingReply<bool> reply = *watcher;
|
||||||
|
m_doNotDisturb = reply.argumentAt<0>();
|
||||||
|
Q_EMIT doNotDisturbChanged();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellDBusClient::updateIsActionDrawerOpen()
|
void ShellDBusClient::updateIsActionDrawerOpen()
|
||||||
{
|
{
|
||||||
m_isActionDrawerOpen = m_interface->isActionDrawerOpen();
|
auto reply = m_interface->isActionDrawerOpen();
|
||||||
Q_EMIT isActionDrawerOpenChanged();
|
auto watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
|
|
||||||
|
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) {
|
||||||
|
QDBusPendingReply<bool> reply = *watcher;
|
||||||
|
m_isActionDrawerOpen = reply.argumentAt<0>();
|
||||||
|
Q_EMIT isActionDrawerOpenChanged();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShellDBusClient::updateIsTaskSwitcherVisible()
|
void ShellDBusClient::updateIsTaskSwitcherVisible()
|
||||||
{
|
{
|
||||||
m_isTaskSwitcherVisible = m_interface->isTaskSwitcherVisible();
|
auto reply = m_interface->isTaskSwitcherVisible();
|
||||||
Q_EMIT isTaskSwitcherVisibleChanged();
|
auto watcher = new QDBusPendingCallWatcher(reply, this);
|
||||||
|
|
||||||
|
QObject::connect(watcher, &QDBusPendingCallWatcher::finished, this, [this](auto watcher) {
|
||||||
|
QDBusPendingReply<bool> reply = *watcher;
|
||||||
|
m_isTaskSwitcherVisible = reply.argumentAt<0>();
|
||||||
|
Q_EMIT isTaskSwitcherVisibleChanged();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -263,6 +263,8 @@ void MobileTaskSwitcherEffect::setDBusState(bool active)
|
||||||
QStringLiteral("org.kde.plasmashell"),
|
QStringLiteral("org.kde.plasmashell"),
|
||||||
QStringLiteral("setIsTaskSwitcherVisible"));
|
QStringLiteral("setIsTaskSwitcherVisible"));
|
||||||
request.setArguments({active});
|
request.setArguments({active});
|
||||||
const QDBusReply<bool> response = QDBusConnection::sessionBus().call(request, QDBus::NoBlock);
|
|
||||||
|
// this does not block, so it won't necessarily be called before the method returns
|
||||||
|
QDBusConnection::sessionBus().send(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue