diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-04-15 14:08:47 +0200 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2024-04-15 15:14:07 +0200 |
commit | 951e255ac70fc64726012ac13d521010f24b255e (patch) | |
tree | 5e37d581a63ed2b1d4a562a0a63fe709a8d292da | |
parent | 344a00b2a4c358e3c0a66f0c163c874a5ebdcc08 (diff) |
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 <jenkins@allotropia.de>
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
-rw-r--r-- | officecfg/registry/schema/org/openoffice/Office/Common.xcs | 14 | ||||
-rw-r--r-- | svx/source/dialog/crashreportdlg.cxx | 31 |
2 files changed, 44 insertions, 1 deletions
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 @@ </info> <value>true</value> </prop> + <prop oor:name="CrashReportPreSendNotification" oor:type="xs:string" oor:nillable="false" + oor:localized="true"> + <info> + <desc>An override for the text presented in the crash report dialog before sending the + report.</desc> + </info> + </prop> + <prop oor:name="CrashReportPostSendNotification" oor:type="xs:string" oor:nillable="false" + oor:localized="true"> + <info> + <desc>An override for the text presented in the crash report dialog after successfully + sending the report.</desc> + </info> + </prop> <prop oor:name="ShowTipOfTheDay" oor:type="xs:boolean" oor:nillable="false"> <!-- UIHints: Tools - Options - General --> <info> 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 <config_folders.h> +#include <i18nlangtag/languagetag.hxx> #include <rtl/bootstrap.hxx> #include <desktop/crashreport.hxx> #include <sfx2/safemode.hxx> #include <comphelper/processfactory.hxx> #include <officecfg/Office/Common.hxx> #include <osl/file.hxx> +#include <unotools/configmgr.hxx> +#include <com/sun/star/configuration/ReadOnlyAccess.hpp> +#include <com/sun/star/configuration/theDefaultProvider.hpp> +#include <com/sun/star/lang/XLocalizable.hpp> #include <com/sun/star/task/OfficeRestartManager.hpp> #include <com/sun/star/task/XInteractionHandler.hpp> @@ -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::lang::XLocalizable>( + 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); |