static QDBusMessage propertyWriteReply(const QDBusMessage &msg, const QString &interface_name, const QByteArray &property_name, int status) { switch (status) { case PropertyNotFound: return propertyNotFoundError(msg, interface_name, property_name); case PropertyTypeMismatch: return msg.createErrorReply(QDBusError::InvalidArgs, QString::fromLatin1("Invalid arguments for writing to property %1%2%3") .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")); case PropertyWriteSuccess: return msg.createReply(); } Q_ASSERT_X(false, "", "Should not be reached"); return QDBusMessage(); }
QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString &method, const QVariant &, const QVariant &, const QVariant &, const QVariant &, const QVariant & , const QVariant &, const QVariant &, const QVariant &) { gDBusInterfaceCallModeValue = mode; gDBusInterfaceCallMethodValue = method; return QDBusMessage(); }
QDBusMessage QDBusMessagePrivate::makeLocalReply(const QDBusConnectionPrivate &conn, const QDBusMessage &callMsg) { // simulate the reply (return or error) message being sent to the bus and // then received back. if (callMsg.d_ptr->localReply) return makeLocal(conn, *callMsg.d_ptr->localReply); return QDBusMessage(); // failed }
QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int) const { qDBusConnectionAsyncCallService = message.service(); qDBusConnectionAsyncCallPath = message.path(); qDBusConnectionAsyncCallInterface = message.interface(); qDBusConnectionAsyncCallMember = message.member(); qDBusConnectionAsyncCallArguments = message.arguments(); return QDBusPendingCall::fromCompletedCall(QDBusMessage()); }
/*! \since 4.6 Creates a QDBusPendingCall object based on the message \a msg. The message must be of type QDBusMessage::ErrorMessage or QDBusMessage::ReplyMessage (that is, a message that is typical of a completed call). This function is useful for code that requires simulating a pending call, but that has already finished. \sa fromError() */ QDBusPendingCall QDBusPendingCall::fromCompletedCall(const QDBusMessage &msg) { QDBusPendingCallPrivate *d = 0; if (msg.type() == QDBusMessage::ErrorMessage || msg.type() == QDBusMessage::ReplyMessage) { d = new QDBusPendingCallPrivate(QDBusMessage(), 0); d->replyMessage = msg; } return QDBusPendingCall(d); }
// QDBusPendingCall stubs (used by MAppletInstantiator) QDBusPendingCall QDBusAbstractInterface::asyncCall(const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8) { if (Ut_MAppletInstantiator::captureCalls) { QList<QVariant> args; if (arg1.isValid()) { args.append(arg1); if (arg2.isValid()) { args.append(arg2); if (arg3.isValid()) { args.append(arg3); if (arg4.isValid()) { args.append(arg4); if (arg5.isValid()) { args.append(arg5); if (arg6.isValid()) { args.append(arg6); if (arg7.isValid()) { args.append(arg7); if (arg8.isValid()) { args.append(arg8); } } } } } } } } Ut_MAppletInstantiator::callMethods.append(Ut_MAppletInstantiator::callInterfaces.last() + '.' + method); Ut_MAppletInstantiator::callArguments.append(args); } return QDBusPendingCall::fromCompletedCall(QDBusMessage()); }
// QDBusAbstractInterface stubs (used by MRemoteAction) QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode, const QString &method, const QVariant &arg1, const QVariant &arg2, const QVariant &arg3, const QVariant &arg4, const QVariant &arg5, const QVariant &arg6, const QVariant &arg7, const QVariant &arg8) { if (Ut_MAppletInstantiator::captureCalls) { QList<QVariant> args; if (arg1.isValid()) { args.append(arg1); if (arg2.isValid()) { args.append(arg2); if (arg3.isValid()) { args.append(arg3); if (arg4.isValid()) { args.append(arg4); if (arg5.isValid()) { args.append(arg5); if (arg6.isValid()) { args.append(arg6); if (arg7.isValid()) { args.append(arg7); if (arg8.isValid()) { args.append(arg8); } } } } } } } } Ut_MAppletInstantiator::callMethods.append(method); Ut_MAppletInstantiator::callArguments.append(args); } return QDBusMessage(); }
void QDBusPendingReplyData::assign(const QDBusMessage &message) { d = new QDBusPendingCallPrivate(QDBusMessage(), 0); // drops the reference to the old one d->replyMessage = message; }