From ff65bdcfe93d3285079f4509f82d5e24cef88e81 Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Fri, 29 Oct 2010 16:03:46 +0000 Subject: QXmppEntityTimeIq::utc() should return a QDateTime, the user should not have to implement parsing / serialization --- src/QXmppEntityTimeIq.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/QXmppEntityTimeIq.cpp') diff --git a/src/QXmppEntityTimeIq.cpp b/src/QXmppEntityTimeIq.cpp index 56cc6f94..d86579aa 100644 --- a/src/QXmppEntityTimeIq.cpp +++ b/src/QXmppEntityTimeIq.cpp @@ -39,12 +39,12 @@ void QXmppEntityTimeIq::setTzo(const QString &tzo) m_tzo = tzo; } -QString QXmppEntityTimeIq::utc() const +QDateTime QXmppEntityTimeIq::utc() const { return m_utc; } -void QXmppEntityTimeIq::setUtc(const QString &utc) +void QXmppEntityTimeIq::setUtc(const QDateTime &utc) { m_utc = utc; } @@ -59,7 +59,7 @@ void QXmppEntityTimeIq::parseElementFromChild(const QDomElement &element) { QDomElement timeElement = element.firstChildElement("time"); m_tzo = timeElement.firstChildElement("tzo").text(); - m_utc = timeElement.firstChildElement("utc").text(); + m_utc = datetimeFromString(timeElement.firstChildElement("utc").text()); } void QXmppEntityTimeIq::toXmlElementFromChild(QXmlStreamWriter *writer) const @@ -70,8 +70,8 @@ void QXmppEntityTimeIq::toXmlElementFromChild(QXmlStreamWriter *writer) const if(!m_tzo.isEmpty()) helperToXmlAddTextElement(writer, "tzo", m_tzo); - if(!m_utc.isEmpty()) - helperToXmlAddTextElement(writer, "utc", m_utc); + if(m_utc.isValid()) + helperToXmlAddTextElement(writer, "utc", datetimeToString(m_utc)); writer->writeEndElement(); } -- cgit v1.2.3