From 951e255ac70fc64726012ac13d521010f24b255e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 15 Apr 2024 14:08:47 +0200 Subject: Allow overriding crash report dialog texts ...building on fb6cbbdcefbcc526405f517677a3214b4292b39e "Adapt crash submitted dialog", which had already modified the dialog somewhat. (The two new configuration properties are marked as non-nillable, even though the default actually is nil. That way, the nil default causes no overriding of the dialog's content from the .ui file in any locale, while any non-nil strings for at least one locale will always cause those strings to be used, even as a last resort fallback for non-matching locales. Which is probably a better outcome here than falling back to the non-overridden .ui file content for non-matching locales.) Change-Id: I1028707f7aa1117c16ae6de131cd776ff96eeaa2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166126 Tested-by: allotropia jenkins Reviewed-by: Stephan Bergmann --- .../schema/org/openoffice/Office/Common.xcs | 14 ++++++++++ svx/source/dialog/crashreportdlg.cxx | 31 +++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs index 307caf9f2895..cc4e080795b7 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs @@ -5572,6 +5572,20 @@ true + + + An override for the text presented in the crash report dialog before sending the + report. + + + + + An override for the text presented in the crash report dialog after successfully + sending the report. + + diff --git a/svx/source/dialog/crashreportdlg.cxx b/svx/source/dialog/crashreportdlg.cxx index 9d3512c56fb7..398073efb527 100644 --- a/svx/source/dialog/crashreportdlg.cxx +++ b/svx/source/dialog/crashreportdlg.cxx @@ -12,13 +12,18 @@ #include +#include #include #include #include #include #include #include +#include +#include +#include +#include #include #include @@ -32,7 +37,31 @@ CrashReportDialog::CrashReportDialog(weld::Window* pParent) , mxEditPostUpload(m_xBuilder->weld_text_view("ed_post")) , mxCBSafeMode(m_xBuilder->weld_check_button("check_safemode")) { - maSuccessMsg = mxEditPostUpload->get_text(); + auto const config = css::configuration::ReadOnlyAccess::create( + comphelper::getProcessComponentContext(), + LanguageTag( + css::uno::Reference( + css::configuration::theDefaultProvider::get( + comphelper::getProcessComponentContext()), + css::uno::UNO_QUERY_THROW)-> + getLocale()).getBcp47()); + + auto const preText = config->getByHierarchicalName( + "/org.openoffice.Office.Common/Misc/CrashReportPreSendNotification"); + if (OUString text; preText >>= text) { + mxEditPreUpload->set_label( + text.replaceAll("%PRODUCTNAME", utl::ConfigManager::getProductName())); + } + + auto const postText = config->getByHierarchicalName( + "/org.openoffice.Office.Common/Misc/CrashReportPostSendNotification"); + if (OUString text; postText >>= text) { + OUString url; + rtl::Bootstrap::get("CrashDumpUrl", url); + maSuccessMsg = text.replaceAll("%CrashDumpUrl%", url); + } else { + maSuccessMsg = mxEditPostUpload->get_text(); + } auto const offerSafeMode = officecfg::Office::Common::Misc::OfferSafeMode::get(); mxCBSafeMode->set_visible(offerSafeMode); -- cgit