Commit a7050dd7 authored by mvogt's avatar mvogt

Merge branch 'mer-1536' into 'master'

[messagingframework] Ensure timestamps use C locale. Contributes to MER#1536

Timestamps must be generated using the C locale, so they do not contain
digits other than Latin.

See merge request !2
parents c678068f 8d6449e5
......@@ -42,6 +42,7 @@
#include "qmailtimestamp.h"
#include <QDate>
#include <QLocale>
#include <QStringList>
#include <QTime>
......@@ -262,12 +263,12 @@ QString QMailTimeStampPrivate::toString(QMailTimeStamp::OutputFormat format) con
int mOffset = ( abs(utcOffset) - abs(hOffset * 3600) ) / 60;
if (format == QMailTimeStamp::Rfc2822) {
result = QString( originalTime.toString( "%1, d %2 yyyy hh:mm:ss %3" ) );
result = QLocale::c().toString( originalTime, QStringLiteral( "%1, d %2 yyyy hh:mm:ss %3" ) );
result = result.arg( QString::fromLatin1( Days + ( originalDate.dayOfWeek() - 1 ) * 3, 3 ) );
result = result.arg( QString::fromLatin1( Months + ( originalDate.month() - 1 ) * 3, 3 ) );
result = result.arg( QString().sprintf( "%+.2d%.2d", hOffset, mOffset ) );
} else if (format == QMailTimeStamp::Rfc3501) {
result = QString( originalTime.toString( "dd-%1-yyyy hh:mm:ss %2" ) );
result = QLocale::c().toString( originalTime, QStringLiteral( "dd-%1-yyyy hh:mm:ss %2" ) );
result = result.arg( QString::fromLatin1( Months + ( originalDate.month() - 1 ) * 3, 3 ) );
result = result.arg( QString().sprintf( "%+.2d%.2d", hOffset, mOffset ) );
......@@ -276,7 +277,7 @@ QString QMailTimeStampPrivate::toString(QMailTimeStamp::OutputFormat format) con
result[0] = ' ';
}
} else if (format == QMailTimeStamp::Rfc3339) {
result = QString( originalTime.toString( "yyyy-MM-ddThh:mm:ss%1" ) );
result = QLocale::c().toString( originalTime, QStringLiteral( "yyyy-MM-ddThh:mm:ss%1" ) );
result = result.arg( utcOffset == 0 ? QString("Z") : QString().sprintf( "%+.2d:%.2d", hOffset, mOffset ) );
}
......
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