QDBusError: add assignment operator from QDBusMessage
There's an implicit constructor for this conversion, so there should be an assignment operator, too, as an optimisation. Change-Id: I1d1646cbafdea5a4f80b11b011a8940b65a9fb9f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
6c2695d677
commit
d5a85940f7
@ -302,6 +302,24 @@ QDBusError &QDBusError::operator=(const QDBusError &other)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
Assignment operator from a QDBusMessage
|
||||||
|
*/
|
||||||
|
QDBusError &QDBusError::operator=(const QDBusMessage &qdmsg)
|
||||||
|
{
|
||||||
|
if (qdmsg.type() == QDBusMessage::ErrorMessage) {
|
||||||
|
code = ::get(qdmsg.errorName().toUtf8().constData());
|
||||||
|
nm = qdmsg.errorName();
|
||||||
|
msg = qdmsg.errorMessage();
|
||||||
|
} else {
|
||||||
|
code =NoError;
|
||||||
|
nm.clear();
|
||||||
|
msg.clear();
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns this error's ErrorType.
|
Returns this error's ErrorType.
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ public:
|
|||||||
QDBusError(ErrorType error, const QString &message);
|
QDBusError(ErrorType error, const QString &message);
|
||||||
QDBusError(const QDBusError &other);
|
QDBusError(const QDBusError &other);
|
||||||
QDBusError &operator=(const QDBusError &other);
|
QDBusError &operator=(const QDBusError &other);
|
||||||
|
QDBusError &operator=(const QDBusMessage &msg);
|
||||||
|
|
||||||
ErrorType type() const;
|
ErrorType type() const;
|
||||||
QString name() const;
|
QString name() const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user