mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Added time zone info to date tooltips in export HTML.
This commit is contained in:
parent
96bd9ae81c
commit
86cc83b491
3 changed files with 14 additions and 3 deletions
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/mime_type.h"
|
||||
#include "core/utils.h"
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QTimeZone>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtGui/QImageReader>
|
||||
#include <range/v3/algorithm/max_element.hpp>
|
||||
|
@ -30,7 +31,7 @@ constexpr auto kMigratedMessagesIdShift = -1'000'000'000;
|
|||
|
||||
QString PrepareFileNameDatePart(TimeId date) {
|
||||
return date
|
||||
? ('@' + QString::fromUtf8(FormatDateTime(date, '-', '-', '_')))
|
||||
? ('@' + QString::fromUtf8(FormatDateTime(date, 0, '-', '-', '_')))
|
||||
: QString();
|
||||
}
|
||||
|
||||
|
@ -1811,6 +1812,7 @@ Utf8String FormatPhoneNumber(const Utf8String &phoneNumber) {
|
|||
|
||||
Utf8String FormatDateTime(
|
||||
TimeId date,
|
||||
bool hasTimeZone,
|
||||
QChar dateSeparator,
|
||||
QChar timeSeparator,
|
||||
QChar separator) {
|
||||
|
@ -1818,14 +1820,21 @@ Utf8String FormatDateTime(
|
|||
return Utf8String();
|
||||
}
|
||||
const auto value = QDateTime::fromSecsSinceEpoch(date);
|
||||
const auto timeZoneOffset = hasTimeZone
|
||||
? separator + value.timeZone().displayName(
|
||||
QTimeZone::StandardTime,
|
||||
QTimeZone::OffsetName)
|
||||
: QString();
|
||||
return (QString("%1") + dateSeparator + "%2" + dateSeparator + "%3"
|
||||
+ separator + "%4" + timeSeparator + "%5" + timeSeparator + "%6"
|
||||
+ "%7"
|
||||
).arg(value.date().day(), 2, 10, QChar('0')
|
||||
).arg(value.date().month(), 2, 10, QChar('0')
|
||||
).arg(value.date().year()
|
||||
).arg(value.time().hour(), 2, 10, QChar('0')
|
||||
).arg(value.time().minute(), 2, 10, QChar('0')
|
||||
).arg(value.time().second(), 2, 10, QChar('0')
|
||||
).arg(timeZoneOffset
|
||||
).toUtf8();
|
||||
}
|
||||
|
||||
|
|
|
@ -709,6 +709,7 @@ bool SkipMessageByDate(const Message &message, const Settings &settings);
|
|||
Utf8String FormatPhoneNumber(const Utf8String &phoneNumber);
|
||||
Utf8String FormatDateTime(
|
||||
TimeId date,
|
||||
bool hasTimeZone = false,
|
||||
QChar dateSeparator = QChar('.'),
|
||||
QChar timeSeparator = QChar(':'),
|
||||
QChar separator = QChar(' '));
|
||||
|
|
|
@ -1193,7 +1193,7 @@ auto HtmlWriter::Wrap::pushMessage(
|
|||
block.append(pushDiv("body"));
|
||||
block.append(pushTag("div", {
|
||||
{ "class", "pull_right date details" },
|
||||
{ "title", FormatDateTime(message.date) },
|
||||
{ "title", FormatDateTime(message.date, true) },
|
||||
}));
|
||||
block.append(FormatTimeText(message.date));
|
||||
block.append(popTag());
|
||||
|
@ -1223,7 +1223,8 @@ auto HtmlWriter::Wrap::pushMessage(
|
|||
block.append(" via @" + via);
|
||||
}
|
||||
block.append(pushTag("span", {
|
||||
{ "class", "details" },
|
||||
{ "class", "date details" },
|
||||
{ "title", FormatDateTime(message.forwardedDate, true) },
|
||||
{ "inline", "" }
|
||||
}));
|
||||
block.append(' ' + FormatDateTime(message.forwardedDate));
|
||||
|
|
Loading…
Add table
Reference in a new issue