Failing to send a reply will result in an automatic timeout error
being generated by D-Bus.
*/
-void QDBusContext::setDelayedReply(bool enable) const
+void QDBusContext::setDelayedReply(bool enable)
{
- message().setDelayedReply(enable);
+ Q_ASSERT(d_ptr);
+ d_ptr->message.setDelayedReply(enable);
}
/*!
If an error is sent, the return value and any output parameters
from the called slot will be ignored by QtDBus.
*/
-void QDBusContext::sendErrorReply(const QString &name, const QString &msg) const
+void QDBusContext::sendErrorReply(const QString &name, const QString &msg)
{
setDelayedReply(true);
connection().send(message().createErrorReply(name, msg));
If an error is sent, the return value and any output parameters
from the called slot will be ignored by QtDBus.
*/
-void QDBusContext::sendErrorReply(QDBusError::ErrorType type, const QString &msg) const
+void QDBusContext::sendErrorReply(QDBusError::ErrorType type, const QString &msg)
{
setDelayedReply(true);
connection().send(message().createErrorReply(type, msg));
// convenience methods
bool isDelayedReply() const;
- // yes, they are const, so that you can use them even from const methods
- void setDelayedReply(bool enable) const;
- void sendErrorReply(const QString &name, const QString &msg = QString()) const;
- void sendErrorReply(QDBusError::ErrorType type, const QString &msg = QString()) const;
+ void setDelayedReply(bool enable);
+ void sendErrorReply(const QString &name, const QString &msg = QString());
+ void sendErrorReply(QDBusError::ErrorType type, const QString &msg = QString());
private:
QDBusContextPrivate *d_ptr;
class QDBusContextPrivate
{
public:
- inline QDBusContextPrivate(const QDBusConnection &conn, const QDBusMessage &msg)
+ inline QDBusContextPrivate(const QDBusConnection &conn, QDBusMessage msg)
: connection(conn), message(msg) {}
QDBusConnection connection;
- const QDBusMessage &message;
+ QDBusMessage message;
static QDBusContextPrivate *set(QObject *obj, QDBusContextPrivate *newContext);
};
\sa {Delayed Replies}
*/
-void QDBusMessage::setDelayedReply(bool enable) const
+void QDBusMessage::setDelayedReply(bool enable)
{
d_ptr->delayedReply = enable;
}
bool isReplyRequired() const;
- void setDelayedReply(bool enable) const;
+ void setDelayedReply(bool enable);
bool isDelayedReply() const;
void setAutoStartService(bool enable);