From b0da255acf86f67a53e31cee59a7829b8b6a1610 Mon Sep 17 00:00:00 2001
From: hjk <hjk121@nokiamail.com>
Date: Mon, 2 Dec 2013 15:46:22 +0100
Subject: [PATCH] Debugger: Restrict QTimeZone use to Qt >= 5.2

Change-Id: Iba786c265ddf7163fd7bb779d103065de3f83547
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
---
 src/plugins/debugger/debuggerprotocol.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp
index 7f673ab8e27..b76bce34891 100644
--- a/src/plugins/debugger/debuggerprotocol.cpp
+++ b/src/plugins/debugger/debuggerprotocol.cpp
@@ -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;
-- 
GitLab