diff options
Diffstat (limited to 'src/activitypub')
-rw-r--r-- | src/activitypub/apactivity.cpp | 5 | ||||
-rw-r--r-- | src/activitypub/appost.cpp | 6 | ||||
-rw-r--r-- | src/activitypub/apquestion.cpp | 11 |
3 files changed, 15 insertions, 7 deletions
diff --git a/src/activitypub/apactivity.cpp b/src/activitypub/apactivity.cpp index 5f1c36d..3bc6444 100644 --- a/src/activitypub/apactivity.cpp +++ b/src/activitypub/apactivity.cpp @@ -1,5 +1,6 @@ #include "apactivity.h" #include "apactor.h" +#include "src/settings_interface.h" #include <QDebug> @@ -40,7 +41,9 @@ QString APActivity::get_html_render(HtmlRenderDetails render_info) { html.replace("{{by}}", by_actor.get_html_render(render_info)); html.replace("{{object}}", object->get_html_render(render_info)); if (published.isValid()) - html.replace("{{published}}", render_info.locale->toString(published.toLocalTime())); + html.replace("{{published}}", render_info.locale->toString( + SettingsInterface::quick_read_setting("ui/timezone").value<AppSettingsTypes::Timezone>() ? published.toUTC() : published.toLocalTime() + )); return html; } 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<AppSettingsTypes::Timezone>() ? published.toUTC() : published.toLocalTime() + )); } html.replace("{{url-id}}", object_url); diff --git a/src/activitypub/apquestion.cpp b/src/activitypub/apquestion.cpp index d519947..06fde9e 100644 --- a/src/activitypub/apquestion.cpp +++ b/src/activitypub/apquestion.cpp @@ -1,4 +1,5 @@ #include "apquestion.h" +#include "src/settings_interface.h" #include <QDebug> APQuestion::APQuestion(APObjectFields fields) : APPost(fields) { @@ -18,12 +19,14 @@ QString APQuestion::get_html_render(HtmlRenderDetails render_info) { html.append(get_html_template("appoll")); if (end_time.isValid()) { - // TODO: add a UI setting for configuring the display of local time or UTC time. - html.replace("{{end-time}}", render_info.locale->toString(end_time.toLocalTime())); + html.replace("{{end-time}}", render_info.locale->toString( + SettingsInterface::quick_read_setting("ui/timezone").value<AppSettingsTypes::Timezone>() ? end_time.toUTC() : end_time.toLocalTime() + )); } if (closed_time.isValid()) { - // TODO: add a UI setting for configuring the display of local time or UTC time. - html.replace("{{closed-time}}", render_info.locale->toString(closed_time.toLocalTime())); + html.replace("{{closed-time}}", render_info.locale->toString( + SettingsInterface::quick_read_setting("ui/timezone").value<AppSettingsTypes::Timezone>() ? closed_time.toUTC() : closed_time.toLocalTime() + )); } html.replace("{{total-votes}}", render_info.locale->toString(total_votes)); |