mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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/mime_type.h"
|
||||||
#include "core/utils.h"
|
#include "core/utils.h"
|
||||||
#include <QtCore/QDateTime>
|
#include <QtCore/QDateTime>
|
||||||
|
#include <QtCore/QTimeZone>
|
||||||
#include <QtCore/QRegularExpression>
|
#include <QtCore/QRegularExpression>
|
||||||
#include <QtGui/QImageReader>
|
#include <QtGui/QImageReader>
|
||||||
#include <range/v3/algorithm/max_element.hpp>
|
#include <range/v3/algorithm/max_element.hpp>
|
||||||
|
@ -30,7 +31,7 @@ constexpr auto kMigratedMessagesIdShift = -1'000'000'000;
|
||||||
|
|
||||||
QString PrepareFileNameDatePart(TimeId date) {
|
QString PrepareFileNameDatePart(TimeId date) {
|
||||||
return date
|
return date
|
||||||
? ('@' + QString::fromUtf8(FormatDateTime(date, '-', '-', '_')))
|
? ('@' + QString::fromUtf8(FormatDateTime(date, 0, '-', '-', '_')))
|
||||||
: QString();
|
: QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1811,6 +1812,7 @@ Utf8String FormatPhoneNumber(const Utf8String &phoneNumber) {
|
||||||
|
|
||||||
Utf8String FormatDateTime(
|
Utf8String FormatDateTime(
|
||||||
TimeId date,
|
TimeId date,
|
||||||
|
bool hasTimeZone,
|
||||||
QChar dateSeparator,
|
QChar dateSeparator,
|
||||||
QChar timeSeparator,
|
QChar timeSeparator,
|
||||||
QChar separator) {
|
QChar separator) {
|
||||||
|
@ -1818,14 +1820,21 @@ Utf8String FormatDateTime(
|
||||||
return Utf8String();
|
return Utf8String();
|
||||||
}
|
}
|
||||||
const auto value = QDateTime::fromSecsSinceEpoch(date);
|
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"
|
return (QString("%1") + dateSeparator + "%2" + dateSeparator + "%3"
|
||||||
+ separator + "%4" + timeSeparator + "%5" + timeSeparator + "%6"
|
+ separator + "%4" + timeSeparator + "%5" + timeSeparator + "%6"
|
||||||
|
+ "%7"
|
||||||
).arg(value.date().day(), 2, 10, QChar('0')
|
).arg(value.date().day(), 2, 10, QChar('0')
|
||||||
).arg(value.date().month(), 2, 10, QChar('0')
|
).arg(value.date().month(), 2, 10, QChar('0')
|
||||||
).arg(value.date().year()
|
).arg(value.date().year()
|
||||||
).arg(value.time().hour(), 2, 10, QChar('0')
|
).arg(value.time().hour(), 2, 10, QChar('0')
|
||||||
).arg(value.time().minute(), 2, 10, QChar('0')
|
).arg(value.time().minute(), 2, 10, QChar('0')
|
||||||
).arg(value.time().second(), 2, 10, QChar('0')
|
).arg(value.time().second(), 2, 10, QChar('0')
|
||||||
|
).arg(timeZoneOffset
|
||||||
).toUtf8();
|
).toUtf8();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -709,6 +709,7 @@ bool SkipMessageByDate(const Message &message, const Settings &settings);
|
||||||
Utf8String FormatPhoneNumber(const Utf8String &phoneNumber);
|
Utf8String FormatPhoneNumber(const Utf8String &phoneNumber);
|
||||||
Utf8String FormatDateTime(
|
Utf8String FormatDateTime(
|
||||||
TimeId date,
|
TimeId date,
|
||||||
|
bool hasTimeZone = false,
|
||||||
QChar dateSeparator = QChar('.'),
|
QChar dateSeparator = QChar('.'),
|
||||||
QChar timeSeparator = QChar(':'),
|
QChar timeSeparator = QChar(':'),
|
||||||
QChar separator = QChar(' '));
|
QChar separator = QChar(' '));
|
||||||
|
|
|
@ -1193,7 +1193,7 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||||
block.append(pushDiv("body"));
|
block.append(pushDiv("body"));
|
||||||
block.append(pushTag("div", {
|
block.append(pushTag("div", {
|
||||||
{ "class", "pull_right date details" },
|
{ "class", "pull_right date details" },
|
||||||
{ "title", FormatDateTime(message.date) },
|
{ "title", FormatDateTime(message.date, true) },
|
||||||
}));
|
}));
|
||||||
block.append(FormatTimeText(message.date));
|
block.append(FormatTimeText(message.date));
|
||||||
block.append(popTag());
|
block.append(popTag());
|
||||||
|
@ -1223,7 +1223,8 @@ auto HtmlWriter::Wrap::pushMessage(
|
||||||
block.append(" via @" + via);
|
block.append(" via @" + via);
|
||||||
}
|
}
|
||||||
block.append(pushTag("span", {
|
block.append(pushTag("span", {
|
||||||
{ "class", "details" },
|
{ "class", "date details" },
|
||||||
|
{ "title", FormatDateTime(message.forwardedDate, true) },
|
||||||
{ "inline", "" }
|
{ "inline", "" }
|
||||||
}));
|
}));
|
||||||
block.append(' ' + FormatDateTime(message.forwardedDate));
|
block.append(' ' + FormatDateTime(message.forwardedDate));
|
||||||
|
|
Loading…
Add table
Reference in a new issue