summaryrefslogtreecommitdiffstats
path: root/src/dbus/qdbusinternalfilters.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dbus/qdbusinternalfilters.cpp')
-rw-r--r--src/dbus/qdbusinternalfilters.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/dbus/qdbusinternalfilters.cpp b/src/dbus/qdbusinternalfilters.cpp
index de1191afea..e498531c51 100644
--- a/src/dbus/qdbusinternalfilters.cpp
+++ b/src/dbus/qdbusinternalfilters.cpp
@@ -88,7 +88,7 @@ static const char propertiesInterfaceXml[] =
" <method name=\"GetAll\">\n"
" <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"values\" type=\"a{sv}\" direction=\"out\"/>\n"
- " <annotation name=\"com.trolltech.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n"
+ " <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"QVariantMap\"/>\n"
" </method>\n"
" </interface>\n";
@@ -197,7 +197,7 @@ static inline QDBusMessage interfaceNotFoundError(const QDBusMessage &msg, const
static inline QDBusMessage
propertyNotFoundError(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name)
{
- return msg.createErrorReply(QDBusError::InvalidArgs,
+ return msg.createErrorReply(QDBusError::UnknownProperty,
QString::fromLatin1("Property %1%2%3 was not found in object %4")
.arg(interface_name,
QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
@@ -277,6 +277,7 @@ enum PropertyWriteResult {
PropertyWriteSuccess = 0,
PropertyNotFound,
PropertyTypeMismatch,
+ PropertyReadOnly,
PropertyWriteFailed
};
@@ -292,6 +293,12 @@ static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &i
.arg(interface_name,
QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
QString::fromLatin1(property_name)));
+ case PropertyReadOnly:
+ return msg.createErrorReply(QDBusError::PropertyReadOnly,
+ QString::fromLatin1("Property %1%2%3 is read-only")
+ .arg(interface_name,
+ QString::fromLatin1(interface_name.isEmpty() ? "" : "."),
+ QString::fromLatin1(property_name)));
case PropertyWriteFailed:
return msg.createErrorReply(QDBusError::InternalError,
QString::fromLatin1("Internal error"));
@@ -315,6 +322,10 @@ static int writeProperty(QObject *obj, const QByteArray &property_name, QVariant
QMetaProperty mp = mo->property(pidx);
+ // check if this property is writable
+ if (!mp.isWritable())
+ return PropertyReadOnly;
+
// check if this property is exported
bool isScriptable = mp.isScriptable();
if (!(propFlags & QDBusConnection::ExportScriptableProperties) && isScriptable)