[Libreoffice-commits] core.git: 2 commits - include/vcl sfx2/source sfx2/uiconfig
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 13 15:16:41 UTC 2019
include/vcl/weld.hxx | 10 ++++++++
sfx2/source/appl/sfxhelp.cxx | 43 +++++++++++++++++++++---------------
sfx2/uiconfig/ui/helpmanual.ui | 48 ++++++++++++++++++-----------------------
3 files changed, 57 insertions(+), 44 deletions(-)
New commits:
commit d37330ce1b356c71b2b3d635ff03f1259bee2fca
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 13 11:12:28 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 13 17:16:01 2019 +0200
document how to align extra widgets with message dialog labels
Change-Id: I6c64d1b637120cab71de5f521c0c0268f2f80732
Reviewed-on: https://gerrit.libreoffice.org/78870
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 18637cceda7b..d3fd087333df 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -1936,6 +1936,16 @@ protected:
std::unique_ptr<weld::Container> m_xOrigParent;
public:
+ /* @param rRelocateId - optional argument of the name of a widget in the .ui file
+ which should be relocated into the content area of the dialog.
+
+ e.g. a checkbox for a "Never show this again" option.
+
+ This results in the named widget relocating to the same container
+ as the messages. This enables aligning the extra widget with the
+ message labels in the content area container which doesn't
+ explicitly exist in the ui description, but is only implied.
+ */
MessageDialogController(weld::Widget* pParent, const OUString& rUIFile,
const OString& rDialogId, const OString& rRelocateId = OString());
virtual Dialog* getDialog() override;
commit e40e04c83f3c8e962c838d63124e653d7dfede89
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Sep 13 10:52:25 2019 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 13 17:15:52 2019 +0200
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 at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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>
More information about the Libreoffice-commits
mailing list