From 52add29e0a380618a358fdbaddb612703d36eb90 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Wed, 16 Aug 2023 12:33:07 -0400 Subject: Implement localtime/UTC time display setting --- src/activitypub/appost.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/activitypub/appost.cpp') diff --git a/src/activitypub/appost.cpp b/src/activitypub/appost.cpp index dadefe8..24a01f5 100644 --- a/src/activitypub/appost.cpp +++ b/src/activitypub/appost.cpp @@ -1,4 +1,5 @@ #include "appost.h" +#include "src/settings_interface.h" APPost::APPost(APObjectFields fields) { for (QString actor_url : fields.to_actors) @@ -44,9 +45,10 @@ QString APPost::get_html_render(HtmlRenderDetails render_info) { QString html(get_html_template("appost")); if (published.isValid()) { - // TODO: add a UI setting for configuring the display of local time or UTC time. // Using QLocale::toString() is forward compatible with Qt 6 as QDateTime::toString() will not return anymore a string in the system locale. - html.replace("{{published}}", render_info.locale->toString(published.toLocalTime())); + html.replace("{{published}}", render_info.locale->toString( + SettingsInterface::quick_read_setting("ui/timezone").value() ? published.toUTC() : published.toLocalTime() + )); } html.replace("{{url-id}}", object_url); -- cgit v1.2.3-54-g00ecf