Resolves: tdf#113286 make Crash report link clickable

Change-Id: Ife9f152e7945d40307e1f8b974e08167981acc6b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150414
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara 2023-04-14 14:17:36 +01:00
parent 232fb7e4f2
commit 5bb3a7af20
4 changed files with 130 additions and 86 deletions

View file

@ -11,9 +11,8 @@ svx/uiconfig/ui/columnswindow.ui://GtkSpinButton[@id='spinbutton'] no-labelled-b
svx/uiconfig/ui/compressgraphicdialog.ui://GtkLabel[@id='label13'] orphan-label
svx/uiconfig/ui/compressgraphicdialog.ui://GtkLabel[@id='label14'] orphan-label
svx/uiconfig/ui/compressgraphicdialog.ui://GtkLabel[@id='label16'] orphan-label
svx/uiconfig/ui/crashreportdlg.ui://GtkLabel[@id='ed_bugreport'] orphan-label
svx/uiconfig/ui/crashreportdlg.ui://GtkLabel[@id='ed_pre'] orphan-label
svx/uiconfig/ui/crashreportdlg.ui://GtkTextView[@id='ed_post'] no-labelled-by
svx/uiconfig/ui/crashreportdlg.ui://GtkTextView[@id='ed_bugreport'] no-labelled-by
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth0'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth1'] button-no-label
svx/uiconfig/ui/depthwindow.ui://GtkRadioButton[@id='depth2'] button-no-label

View file

@ -32,12 +32,13 @@ CrashReportDialog::CrashReportDialog(weld::Window* pParent)
, mxBtnCancel(m_xBuilder->weld_button("btn_cancel"))
, mxBtnClose(m_xBuilder->weld_button("btn_close"))
, mxEditPreUpload(m_xBuilder->weld_label("ed_pre"))
, mxEditPostUpload(m_xBuilder->weld_text_view("ed_post"))
, mxFtBugReport(m_xBuilder->weld_text_view("ed_bugreport"))
, mxEditPostUpload(m_xBuilder->weld_label("ed_post"))
, mxLinkButton(m_xBuilder->weld_link_button("linkbutton"))
, mxFtBugReport(m_xBuilder->weld_label("ed_bugreport"))
, mxCBSafeMode(m_xBuilder->weld_check_button("check_safemode"))
, mxPrivacyPolicyButton(m_xBuilder->weld_link_button("btnPrivacyPolicy"))
{
maSuccessMsg = mxEditPostUpload->get_text();
maLinkTemplate = mxLinkButton->get_uri();
auto nWidth = mxEditPreUpload->get_preferred_size().Width();
nWidth = std::max(nWidth, mxCBSafeMode->get_size_request().Width());
@ -83,17 +84,20 @@ IMPL_LINK(CrashReportDialog, BtnHdl, weld::Button&, rBtn, void)
if (bSuccess)
{
OUString aProcessedMessage
= maSuccessMsg.replaceAll("%CRASHID", aCrashID.replaceAll("Crash-ID=", ""));
OUString aProcessedLink
= maLinkTemplate.replaceAll("%CRASHID", aCrashID.replaceAll("Crash-ID=", ""));
// vclbuilder seems to replace _ with ~ even in text
mxEditPostUpload->set_text(aProcessedMessage.replaceAll("~", "_"));
mxLinkButton->set_label(aProcessedLink.replaceAll("~", "_"));
mxLinkButton->set_uri(aProcessedLink);
}
else
{
mxEditPostUpload->set_text(aCrashID);
mxEditPostUpload->set_label(aCrashID);
}
mxLinkButton->set_visible(bSuccess);
mxBtnClose->show();
mxFtBugReport->show();
mxEditPostUpload->show();

View file

@ -24,12 +24,13 @@ private:
std::unique_ptr<weld::Button> mxBtnCancel;
std::unique_ptr<weld::Button> mxBtnClose;
std::unique_ptr<weld::Label> mxEditPreUpload;
std::unique_ptr<weld::TextView> mxEditPostUpload;
std::unique_ptr<weld::TextView> mxFtBugReport;
std::unique_ptr<weld::Label> mxEditPostUpload;
std::unique_ptr<weld::LinkButton> mxLinkButton;
std::unique_ptr<weld::Label> mxFtBugReport;
std::unique_ptr<weld::CheckButton> mxCBSafeMode;
std::unique_ptr<weld::LinkButton> mxPrivacyPolicyButton;
OUString maSuccessMsg;
OUString maLinkTemplate;
DECL_LINK(BtnHdl, weld::Button&, void);
DECL_STATIC_LINK(CrashReportDialog, InstallLOKNotifierHdl, void*,

View file

@ -2,16 +2,6 @@
<!-- Generated with glade 3.40.0 -->
<interface domain="svx">
<requires lib="gtk+" version="3.20"/>
<object class="GtkTextBuffer" id="textbuffer1">
<property name="text" translatable="yes" context="crashreportdlg|ed_post">The crash report was successfully uploaded.
You can soon find the report at:
https://crashreport.libreoffice.org/stats/crash_details/%CRASHID</property>
</object>
<object class="GtkTextBuffer" id="textbuffer2">
<property name="text" translatable="yes" context="crashreportdlg|ed_bugreport">Please check the report and if no bug report is connected to the crash report yet, open a new bug report at bugs.documentfoundation.org.
Add detailed instructions on how to reproduce the crash and the shown crash ID into the crash report field.
Thank you for your help in improving %PRODUCTNAME.</property>
</object>
<object class="GtkDialog" id="CrashReportDialog">
<property name="can-focus">False</property>
<property name="border-width">6</property>
@ -75,18 +65,127 @@ Thank you for your help in improving %PRODUCTNAME.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ed_pre">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="crashreportdlg|ed_pre">Unfortunately it seems that %PRODUCTNAME crashed when it was last run.
<property name="orientation">vertical</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel" id="ed_pre">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="crashreportdlg|ed_pre">Unfortunately it seems that %PRODUCTNAME crashed when it was last run.
You can help us to fix this issue by sending an anonymous crash report to the %PRODUCTNAME crash reporting server.</property>
<property name="wrap">True</property>
<property name="max-width-chars">80</property>
<property name="wrap">True</property>
<property name="max-width-chars">80</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<!-- n-columns=1 n-rows=2 -->
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="row-spacing">3</property>
<child>
<object class="GtkLinkButton" id="linkbutton">
<property name="label" translatable="no">https://crashreport.libreoffice.org/stats/crash_details/%CRASHID</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="no-show-all">True</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="relief">none</property>
<property name="uri">https://crashreport.libreoffice.org/stats/crash_details/%CRASHID</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ed_post">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="crashreportdlg|ed_post">The crash report was successfully uploaded. You can soon find the report at:</property>
<property name="use-underline">True</property>
<property name="wrap">True</property>
<property name="mnemonic-widget">linkbutton</property>
<property name="max-width-chars">80</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="ed_bugreport">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="crashreportdlg|ed_bugreport">Please check the report and if no bug report is connected to the crash report yet, open a new bug report at bugs.documentfoundation.org.
Add detailed instructions on how to reproduce the crash and the shown crash ID into the crash report field.
Thank you for your help in improving %PRODUCTNAME.</property>
<property name="wrap">True</property>
<property name="max-width-chars">80</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="check_safemode">
<property name="label" translatable="yes" context="crashreportdlg|check_safemode">Restart %PRODUCTNAME to enter safe mode</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="btnPrivacyPolicy">
<property name="label" translatable="yes" context="crashreportdlg|privacy">Privacy Policy</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
@ -94,65 +193,6 @@ You can help us to fix this issue by sending an anonymous crash report to the %P
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="ed_post">
<property name="can-focus">False</property>
<property name="valign">center</property>
<property name="editable">False</property>
<property name="wrap-mode">word</property>
<property name="cursor-visible">False</property>
<property name="buffer">textbuffer1</property>
<property name="accepts-tab">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkTextView" id="ed_bugreport">
<property name="can-focus">False</property>
<property name="editable">False</property>
<property name="wrap-mode">word</property>
<property name="cursor-visible">False</property>
<property name="buffer">textbuffer2</property>
<property name="accepts-tab">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="check_safemode">
<property name="label" translatable="yes" context="crashreportdlg|check_safemode">Restart %PRODUCTNAME to enter safe mode</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="draw-indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkLinkButton" id="btnPrivacyPolicy">
<property name="label" translatable="yes" context="crashreportdlg|privacy">Privacy Policy</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="relief">none</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object>
</child>
</object>