cui/UIConfig_cui.mk | 2 +- cui/source/options/optdeepl.cxx | 12 +++++------- cui/uiconfig/ui/optdeeplpage.ui | 9 ++++----- sw/source/uibase/shells/textsh1.cxx | 10 ++++++++++ 4 files changed, 20 insertions(+), 13 deletions(-)
New commits: commit 25c630fa87bf297f88ebeef3e4692ebc3460e37d Author: Aron Budea <[email protected]> AuthorDate: Sun Nov 27 22:48:51 2022 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Tue Nov 29 08:09:03 2022 +0100 DeepL: Only enable Translate menu if it's set up Both the API URL and Authentication key have to be set. Plus: - align widgets in DeepL settings dialog, - rename .ui file to conform to other dialog names in Options. Change-Id: I8cfeaa64b05747b0113a6075b6fd241ca9ab3a70 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143359 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit bfdaa3f59bcf87f341138202c047dd4b28acb28a) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143405 Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/cui/UIConfig_cui.mk b/cui/UIConfig_cui.mk index 0ed879e2b228..590bcea5f22a 100644 --- a/cui/UIConfig_cui.mk +++ b/cui/UIConfig_cui.mk @@ -132,6 +132,7 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/optbasicidepage \ cui/uiconfig/ui/optctlpage \ cui/uiconfig/ui/optchartcolorspage \ + cui/uiconfig/ui/optdeeplpage \ cui/uiconfig/ui/optemailpage \ cui/uiconfig/ui/optfltrpage \ cui/uiconfig/ui/optfltrembedpage \ @@ -139,7 +140,6 @@ $(eval $(call gb_UIConfig_add_uifiles,cui,\ cui/uiconfig/ui/optgeneralpage \ cui/uiconfig/ui/opthtmlpage \ cui/uiconfig/ui/langtoolconfigpage \ - cui/uiconfig/ui/deepltabpage \ cui/uiconfig/ui/optionsdialog \ cui/uiconfig/ui/optjsearchpage \ cui/uiconfig/ui/optlanguagespage \ diff --git a/cui/source/options/optdeepl.cxx b/cui/source/options/optdeepl.cxx index 94b48ccc2f43..5343f72a59c9 100644 --- a/cui/source/options/optdeepl.cxx +++ b/cui/source/options/optdeepl.cxx @@ -20,14 +20,12 @@ #include "optdeepl.hxx" #include <svtools/deeplcfg.hxx> -OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage, - weld::DialogController* pController, - const SfxItemSet& rSet) - : SfxTabPage(pPage, pController, "cui/ui/deepltabpage.ui", "OptDeeplPage", &rSet) +OptDeeplTabPage::OptDeeplTabPage(weld::Container* pPage, weld::DialogController* pController, + const SfxItemSet& rSet) + : SfxTabPage(pPage, pController, "cui/ui/optdeeplpage.ui", "OptDeeplPage", &rSet) , m_xAPIUrl(m_xBuilder->weld_entry("apiurl")) , m_xAuthKey(m_xBuilder->weld_entry("authkey")) { - } OptDeeplTabPage::~OptDeeplTabPage() {} @@ -48,8 +46,8 @@ bool OptDeeplTabPage::FillItemSet(SfxItemSet*) } std::unique_ptr<SfxTabPage> OptDeeplTabPage::Create(weld::Container* pPage, - weld::DialogController* pController, - const SfxItemSet* rAttrSet) + weld::DialogController* pController, + const SfxItemSet* rAttrSet) { return std::make_unique<OptDeeplTabPage>(pPage, pController, *rAttrSet); } diff --git a/cui/uiconfig/ui/deepltabpage.ui b/cui/uiconfig/ui/optdeeplpage.ui similarity index 92% rename from cui/uiconfig/ui/deepltabpage.ui rename to cui/uiconfig/ui/optdeeplpage.ui index 051de46fc972..6eedbafeab43 100644 --- a/cui/uiconfig/ui/deepltabpage.ui +++ b/cui/uiconfig/ui/optdeeplpage.ui @@ -18,7 +18,7 @@ <property name="halign">start</property> <property name="xpad">5</property> <property name="ypad">5</property> - <property name="label" translatable="yes" context="deepltabpage|label1">DeepL API Options</property> + <property name="label" translatable="yes" context="optdeeplpage|label1">DeepL API Options</property> <property name="use_underline">True</property> <property name="mnemonic_widget">grid1</property> <attributes> @@ -32,7 +32,7 @@ </child> <child> <object class="GtkLinkButton" id="privacy"> - <property name="label" translatable="yes" context="deepltabpage|privacy">Please read the privacy policy</property> + <property name="label" translatable="yes" context="optdeeplpage|privacy">Please read the privacy policy</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -60,8 +60,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <property name="halign">start</property> - <property name="margin_left">5</property> - <property name="label" translatable="yes" context="deepltabpage|privacy">API URL:</property> + <property name="label" translatable="yes" context="optdeeplpage|privacy">API URL:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">apiurl</property> </object> @@ -76,7 +75,7 @@ <property name="can_focus">False</property> <property name="halign">start</property> <property name="margin_right">5</property> - <property name="label" translatable="yes" context="deepltabpage|label3">Authentication key:</property> + <property name="label" translatable="yes" context="optdeeplpage|label3">Authentication key:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">authkey</property> </object> diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index c69ab04770a1..53813ff905e6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -2005,6 +2005,16 @@ void SwTextShell::GetState( SfxItemSet &rSet ) } break; + case SID_FM_TRANSLATE: + { + const SvxDeeplOptions& rDeeplOptions = SvxDeeplOptions::Get(); + if (rDeeplOptions.getAPIUrl().isEmpty() || rDeeplOptions.getAuthKey().isEmpty()) + { + rSet.DisableItem(nWhich); + } + } + break; + case SID_HYPERLINK_DIALOG: if( GetView().GetDocShell()->IsReadOnly() || ( !GetView().GetViewFrame()->HasChildWindow(nWhich)
