[plasma/xdg-desktop-portal-kde] src: settings: Use sendErrorReply
David Redondo <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 449b1aeef0d44f4c74a500151bc092a228e3b833 by David Redondo.
Committed on 22/07/2026 at 09:30.
Pushed by davidre into branch 'master'.
settings: Use sendErrorReply
simplifies the code
M +2 -8 src/settings.cpp
https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/commit/449b1aeef0d44f4c74a500151bc092a228e3b833
diff --git a/src/settings.cpp b/src/settings.cpp
index 7bdccb03..5dc5353f 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -526,24 +526,18 @@ QDBusVariant SettingsPortal::Read(const QString &group, const QString &key)
qCDebug(XdgDesktopPortalKdeSettings) << " group: " << group;
qCDebug(XdgDesktopPortalKdeSettings) << " key: " << key;
- auto sendError = [m = m_parent->message()](QDBusError::ErrorType error, const QString &message) {
- m.setDelayedReply(true);
- const auto reply = m.createErrorReply(error, message);
- QDBusConnection::sessionBus().send(reply);
- };
-
auto setting = std::ranges::find(m_settings, group, [](const auto &setting) {
return setting->group();
});
if (setting == std::ranges::end(m_settings)) {
qCWarning(XdgDesktopPortalKdeSettings) << "Namespace " << group << " is not supported";
- sendError(QDBusError::UnknownProperty, QStringLiteral("Namespace is not supported"));
+ m_parent->sendErrorReply(QDBusError::UnknownProperty, QStringLiteral("Namespace is not supported"));
return {};
}
const QVariant result = (*setting)->read(group, key);
if (result.isNull()) {
- sendError(QDBusError::UnknownProperty, QStringLiteral("Property doesn't exist"));
+ m_parent->sendErrorReply(QDBusError::UnknownProperty, QStringLiteral("Property doesn't exist"));
return {};
}