diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-09-13 10:52:25 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-09-13 17:15:52 +0200 |
commit | e40e04c83f3c8e962c838d63124e653d7dfede89 (patch) | |
tree | 20fd6ee74a7a8b982f81165ec652fb0d26ec4a39 /sfx2 | |
parent | 363e895b016b80589c55e6348d6aab60b4e7f75c (diff) |
Related: tdf#127195 use MessageDialogController to relocate checkbox
MessageDialogController has an argument which indicates what
widget in a message dialog should be rearranged to be aligned
with the message box messsage area, "hidedialog" in this case
remove the indent amount as the relocate logic takes care of
the intent of that
Change-Id: I92f138e41ec3fd50771d210db8358e9236684157
Reviewed-on: https://gerrit.libreoffice.org/78869
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/appl/sfxhelp.cxx | 43 | ||||
-rw-r--r-- | sfx2/uiconfig/ui/helpmanual.ui | 48 |
2 files changed, 47 insertions, 44 deletions
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index d709ed3591f2..e6942da14fd6 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -998,6 +998,25 @@ namespace } } +class HelpManualMessage : public weld::MessageDialogController +{ +private: + std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB; + +public: + HelpManualMessage(weld::Widget* pParent) + : MessageDialogController(pParent, "sfx/ui/helpmanual.ui", "onlinehelpmanual", "hidedialog") + , m_xHideOfflineHelpCB(m_xBuilder->weld_check_button("hidedialog")) + { + LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); + OUString sLocaleString = SvtLanguageTable::GetLanguageString(aLangTag.getLanguageType()); + OUString sPrimText = get_primary_text(); + set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString)); + } + + bool GetOfflineHelpPopUp() const { return !m_xHideOfflineHelpCB->get_active(); } +}; + bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const OUString& rKeyword) { OUStringBuffer aHelpRootURL("vnd.sun.star.help://"); @@ -1126,16 +1145,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const { weld::Window* pWeldWindow = pWindow ? pWindow->GetFrameWeld() : nullptr; aBusy.incBusy(pWeldWindow); - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWeldWindow, "sfx/ui/helpmanual.ui")); - std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); - std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog")); - LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); - OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() ); - OUString sPrimText = xQueryBox->get_primary_text(); - xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString)); - short OnlineHelpBox = xQueryBox->run(); + HelpManualMessage aQueryBox(pWeldWindow); + short OnlineHelpBox = aQueryBox.run(); bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK; - aHelpOptions.SetOfflineHelpPopUp(!m_xHideOfflineHelpCB->get_state()); + aHelpOptions.SetOfflineHelpPopUp(aQueryBox.GetOfflineHelpPopUp()); aBusy.decBusy(); } if(!bShowOfflineHelpPopUp) @@ -1284,16 +1297,10 @@ bool SfxHelp::Start_Impl(const OUString& rURL, weld::Widget* pWidget, const OUSt if(bShowOfflineHelpPopUp) { aBusy.incBusy(pWidget); - std::unique_ptr<weld::Builder> xBuilder(Application::CreateBuilder(pWidget, "sfx/ui/helpmanual.ui")); - std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog("onlinehelpmanual")); - std::unique_ptr<weld::CheckButton> m_xHideOfflineHelpCB(xBuilder->weld_check_button("hidedialog")); - LanguageTag aLangTag = Application::GetSettings().GetUILanguageTag(); - OUString sLocaleString = SvtLanguageTable::GetLanguageString( aLangTag.getLanguageType() ); - OUString sPrimText = xQueryBox->get_primary_text(); - xQueryBox->set_primary_text(sPrimText.replaceAll("$UILOCALE", sLocaleString)); - short OnlineHelpBox = xQueryBox->run(); + HelpManualMessage aQueryBox(pWidget); + short OnlineHelpBox = aQueryBox.run(); bShowOfflineHelpPopUp = OnlineHelpBox != RET_OK; - aHelpOptions.SetOfflineHelpPopUp(!m_xHideOfflineHelpCB->get_state()); + aHelpOptions.SetOfflineHelpPopUp(aQueryBox.GetOfflineHelpPopUp()); aBusy.decBusy(); } if(!bShowOfflineHelpPopUp) diff --git a/sfx2/uiconfig/ui/helpmanual.ui b/sfx2/uiconfig/ui/helpmanual.ui index 6fe76ea115e2..06df47407d32 100644 --- a/sfx2/uiconfig/ui/helpmanual.ui +++ b/sfx2/uiconfig/ui/helpmanual.ui @@ -18,24 +18,6 @@ <child internal-child="action_area"> <object class="GtkButtonBox" id="btnbox"> <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkCheckButton" id="hidedialog"> - <property name="label" translatable="yes" context="helpmanual|hidedialog">Do not show this dialog again</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="xalign">0</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - <property name="secondary">True</property> - </packing> - </child> <child> <object class="GtkButton" id="website"> <property name="label" translatable="yes" context="helpmanual|website">Read Help Online</property> @@ -45,9 +27,9 @@ <property name="use_underline">True</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> </packing> </child> <child> @@ -61,19 +43,33 @@ <property name="use_stock">True</property> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> </packing> </child> </object> <packing> <property name="expand">False</property> - <property name="fill">True</property> - <property name="pack_type">end</property> + <property name="fill">False</property> <property name="position">0</property> </packing> </child> + <child> + <object class="GtkCheckButton" id="hidedialog"> + <property name="label" translatable="yes" context="helpmanual|hidedialog">Do not show this dialog again</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> </object> </child> <action-widgets> |