summaryrefslogtreecommitdiff
path: root/hostmanagerconn.cc
diff options
context:
space:
mode:
Diffstat (limited to 'hostmanagerconn.cc')
-rw-r--r--hostmanagerconn.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/hostmanagerconn.cc b/hostmanagerconn.cc
index e4f5edc..b8d1d31 100644
--- a/hostmanagerconn.cc
+++ b/hostmanagerconn.cc
@@ -26,7 +26,7 @@ void HostManagerConn::sendMessage(const QJsonObject &msg)
QJsonDocument doc(msg);
QByteArray data = doc.toJson(QJsonDocument::Compact);
qDebug() << "Send JSON:" << data;
- _socket->send(QByteArray(3,0) + doc.toJson(QJsonDocument::Compact));
+ _socket->send(doc.toJson(QJsonDocument::Compact));
}
void HostManagerConn::handleMessage(const QJsonObject &msg)
@@ -75,11 +75,13 @@ void HostManagerConn::performTimeSync()
msg["usingCamera"] = QLatin1String("false");
msg["safety_cam"] = QLatin1String("0");
- msg["locale"] = QLocale::system().name(); // ie es_ES
- msg["data1224"] = QLatin1String("24"); // TODO
+ QLocale l = QLocale::system();
+ msg["locale"] = l.name(); // i.e. es_ES
+ msg["data1224"] = l.timeFormat().contains('a', Qt::CaseInsensitive) ? QLatin1String("12") : QLatin1String("24");
msg["dateformat"] = QLocale::system().dateFormat(QLocale::ShortFormat);
#if SAILFISH
+ // QTimeZone does not seem to work on Sailfish; use timed.
msg["timezone"] = monitor->timezone();
#else
msg["timezone"] = QString::fromLatin1(QTimeZone::systemTimeZoneId());
@@ -159,13 +161,11 @@ void HostManagerConn::handleMessageReceived()
{
QByteArray data = _socket->receive();
- if (data.size() < 5) {
+ if (data.size() < 4) {
qWarning() << "Invalid HostManager message received";
return;
}
- data.remove(0, 3); // What are those first three bytes??? They seem to be always NUL.
-
qDebug() << "Got JSON:" << QString::fromUtf8(data);
QJsonParseError error;