Commit b0da255a authored by hjk's avatar hjk

Debugger: Restrict QTimeZone use to Qt >= 5.2

Change-Id: Iba786c265ddf7163fd7bb779d103065de3f83547
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: default avatarChristian Stenger <christian.stenger@digia.com>
parent cfe84eaa
......@@ -33,7 +33,9 @@
#include <QDateTime>
#include <QDebug>
#include <QHostAddress>
#if QT_VERSION >= 0x050200
#include <QTimeZone>
#endif
#include <ctype.h>
......@@ -504,6 +506,7 @@ static QTime timeFromData(int ms)
return ms == -1 ? QTime() : QTime(0, 0, 0, 0).addMSecs(ms);
}
#if QT_VERSION >= 0x050200
// Stolen and adapted from qdatetime.cpp
static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
{
......@@ -550,6 +553,7 @@ static void getDateTime(qint64 msecs, int status, QDate *date, QTime *time)
*date = (status & NullDate) ? QDate() : QDate::fromJulianDay(jd);
*time = (status & NullTime) ? QTime() : QTime::fromMSecsSinceStartOfDay(ds);
}
#endif
QString decodeData(const QByteArray &ba, int encoding)
{
......@@ -678,6 +682,7 @@ QString decodeData(const QByteArray &ba, int encoding)
return QString::fromUtf8(decodedBa);
}
case DateTimeInternal: { // 29, DateTimeInternal: msecs, spec, offset, tz, status
#if QT_VERSION >= 0x050200
int p0 = ba.indexOf('/');
int p1 = ba.indexOf('/', p0 + 1);
int p2 = ba.indexOf('/', p1 + 1);
......@@ -708,6 +713,10 @@ QString decodeData(const QByteArray &ba, int encoding)
dateTime = QDateTime(date, time, spec);
}
return dateTime.toString();
#else
// "Very plain".
return QString::fromLatin1(ba);
#endif
}
}
qDebug() << "ENCODING ERROR: " << encoding;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment