Commit 1336888a authored by Karl Ove Hufthammer's avatar Karl Ove Hufthammer Committed by Boudewijn Rempt

Show publication time of RSS news in user’s preferred short datetime format

The publication time of the news items on Krita’s welcome page is now
shown in the user’s timezone and in their preferred short datetime format.
The timezone of the datetime in the RSS feed is now also taken into account
when parsing the publication date (the old code basically assumed that the
user lived in the timezone the RSS feed generator was set up to use, which
at the time of writing was UTC).

Note that old code only displayed the date; the new code also displays
the time (typically hh:mm).
parent 922bb3bd
......@@ -70,9 +70,7 @@ public: = streamReader.readElementText();
else if ( == QLatin1String("pubDate")) {
QString dateStr = streamReader.readElementText();
// fixme: honor time zone!
dateStr = dateStr.left(dateStr.indexOf('+')-1);
item.pubDate = QLocale(QLocale::English).toDateTime(dateStr, "ddd, dd MMM yyyy HH:mm:ss");
item.pubDate = QDateTime::fromString(dateStr, Qt::RFC2822Date);
else if ( == QLatin1String("description"))
item.description = streamReader.readElementText(); //shortenHtml(streamReader.readElementText());
......@@ -200,7 +198,7 @@ QVariant MultiFeedRssModel::data(const QModelIndex &index, int role) const
case Qt::DisplayRole:
return QString("<b><a href=\"" + + "\">" + item.title + "</a></b>"
"<br><small>(" + item.pubDate.toString("MMMM d, yyyy") + ") "
"<br><small>(" + item.pubDate.toLocalTime().toString(Qt::DefaultLocaleShortDate) + ") "
+ item.description.left(90).append("...") + "</small><hr>");
case TitleRole:
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