[Libreoffice-commits] core.git: include/sfx2 sfx2/source sfx2/uiconfig solenv/sanitizers
include/sfx2/passwd.hxx|3 ++ sfx2/source/dialog/passwd.cxx | 45 sfx2/uiconfig/ui/password.ui | 56 - solenv/sanitizers/ui/sfx.suppr |4 ++ 4 files changed, 96 insertions(+), 12 deletions(-) New commits: commit ed72c6fbfa02cf98cb0d0f761ef5a7b9ffb894bc Author: Sarper Akdemir AuthorDate: Wed Nov 15 14:54:42 2023 +0300 Commit: Sarper Akdemir CommitDate: Wed Nov 15 23:05:49 2023 +0100 tdf#157518: enforce password policy on sfx2/ui/password.ui Change-Id: I115b5b05ed82f2f900bcd70ec4f52c7f749544e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159443 Tested-by: Jenkins Reviewed-by: Sarper Akdemir diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx index bc5e478bbf03..3ddffed196d0 100644 --- a/include/sfx2/passwd.hxx +++ b/include/sfx2/passwd.hxx @@ -51,6 +51,7 @@ private: std::unique_ptr m_xPassword1FT; std::unique_ptr m_xPassword1ED; std::unique_ptr m_xPassword1StrengthBar; +std::unique_ptr m_xPassword1PolicyLabel; std::unique_ptr m_xConfirm1FT; std::unique_ptr m_xConfirm1ED; @@ -58,6 +59,7 @@ private: std::unique_ptr m_xPassword2FT; std::unique_ptr m_xPassword2ED; std::unique_ptr m_xPassword2StrengthBar; +std::unique_ptr m_xPassword2PolicyLabel; std::unique_ptr m_xConfirm2FT; std::unique_ptr m_xConfirm2ED; @@ -74,6 +76,7 @@ private: OUStringmaMainPwdStr; sal_uInt16 mnMinLen; SfxShowExtras mnExtras; +std::optional moPasswordPolicy; boolmbAsciiOnly; DECL_DLLPRIVATE_LINK(OKHdl, weld::Button&, void); diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index a69d0aef352a..b78546722cb9 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include #include @@ -38,15 +39,35 @@ void SfxPasswordDialog::ModifyHdl() bEnable = (bEnable && (m_xPassword2ED->get_text().getLength() >= mnMinLen)); m_xOKBtn->set_sensitive(bEnable); +// if there's a confirm entry, the dialog is being used for setting a password if (m_xConfirm1ED->get_visible()) { m_xPassword1StrengthBar->set_percentage( SvPasswordHelper::GetPasswordStrengthPercentage(aPassword1Text)); +bool bPasswordMeetsPolicy = SvPasswordHelper::PasswordMeetsPolicy( +aPassword1Text, moPasswordPolicy); +m_xPassword1ED->set_message_type(bPasswordMeetsPolicy ? weld::EntryMessageType::Normal + : weld::EntryMessageType::Error); +m_xPassword1PolicyLabel->set_visible(!bPasswordMeetsPolicy); } + +// if there's a confirm entry, the dialog is being used for setting a password if (m_xConfirm2ED->get_visible()) { +OUString aPassword2Text = m_xPassword2ED->get_text(); + m_xPassword2StrengthBar->set_percentage( SvPasswordHelper::GetPasswordStrengthPercentage(m_xPassword2ED->get_text())); + +// second password is optional, ignore policy if it is empty +bool bPasswordMeetsPolicy += aPassword2Text.isEmpty() + ? true + : SvPasswordHelper::PasswordMeetsPolicy( + aPassword2Text, moPasswordPolicy); +m_xPassword2ED->set_message_type(bPasswordMeetsPolicy ? weld::EntryMessageType::Normal + : weld::EntryMessageType::Error); +m_xPassword2PolicyLabel->set_visible(!bPasswordMeetsPolicy); } } @@ -81,6 +102,19 @@ IMPL_LINK(SfxPasswordDialog, InsertTextHdl, OUString&, rTest, bool) IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, weld::Button&, void) { +if (m_xConfirm1ED->get_visible() +&& !SvPasswordHelper::PasswordMeetsPolicy(GetPassword(), moPasswordPolicy)) +{ +m_xPassword1ED->grab_focus(); +return; +} +if (m_xConfirm2ED->get_visible() && !GetPassword2().isEmpty() +&& !SvPasswordHelper::PasswordMeetsPolicy(GetPassword2(), moPasswordPolicy)) +{ +m_xPassword2ED->grab_focus(); +return; +} + bool bConfirmFailed = bool( mnExtras & SfxShowExtras::CONFIRM ) && ( GetConfirm() != GetPassword() ); if( ( mnExtras & SfxShowExtras::CONFIRM2 ) && ( m_xConfirm2ED->get_text() != GetPassword2() ) ) @@ -114,12 +148,14 @@ SfxPasswordDialog::SfxPasswordDialog(weld::Widget* pParent, const OUString* pGro , m_xPassword1FT(m_xBuilder->weld_label("pass1ft")) , m_xPassword1ED(m_xBuilder->weld_entry("pass1ed")) , m_xPassword1StrengthBar(m_xBuilder->weld_level_bar("pass1bar")) +, m_xPassword1PolicyLabel(m_xBuilder->weld_label("pass1policylabel")) , m_xConfirm1FT(m_xBuilder->weld_label("confirm1ft"))
[Libreoffice-commits] core.git: include/sfx2 sfx2/source sfx2/uiconfig solenv/sanitizers
include/sfx2/strings.hrc |3 --- sfx2/source/sidebar/DeckTitleBar.cxx | 12 +--- sfx2/source/sidebar/PanelTitleBar.cxx |2 -- sfx2/uiconfig/ui/decktitlebar.ui |9 - sfx2/uiconfig/ui/paneltitlebar.ui |9 - solenv/sanitizers/ui/sfx.suppr|2 -- 6 files changed, 17 insertions(+), 20 deletions(-) New commits: commit 2f80334f1d4fe0d486f858776687c1180077a5fa Author: Caolán McNamara AuthorDate: Mon Feb 15 14:26:44 2021 + Commit: Caolán McNamara CommitDate: Mon Feb 15 17:23:28 2021 +0100 Related: tdf#140387 give toolbuttons a11y names Change-Id: I046957afaf89e3f88cde4c2a3cffa470af657175 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110939 Tested-by: Jenkins Reviewed-by: Caolán McNamara diff --git a/include/sfx2/strings.hrc b/include/sfx2/strings.hrc index ddf2745ebb05..0fc589d8d4a6 100644 --- a/include/sfx2/strings.hrc +++ b/include/sfx2/strings.hrc @@ -295,9 +295,6 @@ #define STR_CLOSE_PANE NC_("STR_CLOSE_PANE", "Close Pane") -#define SFX_STR_SIDEBAR_MORE_OPTIONS NC_("SFX_STR_SIDEBAR_MORE_OPTIONS", "More Options") -#define SFX_STR_SIDEBAR_CLOSE_DECK NC_("SFX_STR_SIDEBAR_CLOSE_DECK", "Close Sidebar Deck") - // Translators: default Impress template names #define STR_TEMPLATE_NAME1 NC_("STR_TEMPLATE_NAME1", "") #define STR_TEMPLATE_NAME2 NC_("STR_TEMPLATE_NAME2", "Beehive") diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx index f7e0a8df7b7e..91d95d69f264 100644 --- a/sfx2/source/sidebar/DeckTitleBar.cxx +++ b/sfx2/source/sidebar/DeckTitleBar.cxx @@ -119,17 +119,7 @@ void DeckTitleBar::SetCloserVisible (const bool bIsCloserVisible) mbIsCloserVisible = bIsCloserVisible; -if (mbIsCloserVisible) -{ -mxToolBox->set_item_visible("button", true); -mxToolBox->set_item_icon_name("button", "sfx2/res/closedoc.png"); -mxToolBox->set_item_tooltip_text("button", -SfxResId(SFX_STR_SIDEBAR_CLOSE_DECK)); -} -else -{ -mxToolBox->set_item_visible("button", false); -} +mxToolBox->set_item_visible("button", mbIsCloserVisible); } void DeckTitleBar::HandleToolBoxItemClick() diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx index a9ddbc79fcb5..7f2ff3214722 100644 --- a/sfx2/source/sidebar/PanelTitleBar.cxx +++ b/sfx2/source/sidebar/PanelTitleBar.cxx @@ -109,8 +109,6 @@ void PanelTitleBar::SetMoreOptionsCommand(const OUString& rsCommandName, *mxToolBox, *m_xBuilder, msMoreOptionsCommand, rxFrame, rxController, true); mxToolBox->set_item_visible(msIdent, true); -mxToolBox->set_item_icon_name(msIdent, "sfx2/res/symphony/morebutton.png"); -mxToolBox->set_item_tooltip_text(msIdent, SfxResId(SFX_STR_SIDEBAR_MORE_OPTIONS)); } void PanelTitleBar::HandleToolBoxItemClick() diff --git a/sfx2/uiconfig/ui/decktitlebar.ui b/sfx2/uiconfig/ui/decktitlebar.ui index 68ecdc6469be..bbfcba7bf69b 100644 --- a/sfx2/uiconfig/ui/decktitlebar.ui +++ b/sfx2/uiconfig/ui/decktitlebar.ui @@ -1,5 +1,5 @@ - + @@ -61,7 +61,14 @@ True False +Close Sidebar Deck True +sfx2/res/closedoc.png + + +Close Sidebar Deck + + False diff --git a/sfx2/uiconfig/ui/paneltitlebar.ui b/sfx2/uiconfig/ui/paneltitlebar.ui index 6fd621856b82..2e352bf21a4f 100644 --- a/sfx2/uiconfig/ui/paneltitlebar.ui +++ b/sfx2/uiconfig/ui/paneltitlebar.ui @@ -1,5 +1,5 @@ - + @@ -68,7 +68,14 @@ True False +More Options True +sfx2/res/symphony/morebutton.png + + +More Options + + False diff --git a/solenv/sanitizers/ui/sfx.suppr b/solenv/sanitizers/ui/sfx.suppr index 58a6dc14654f..31def4bb9fb1 100644 --- a/solenv/sanitizers/ui/sfx.suppr +++ b/solenv/sanitizers/ui/sfx.suppr @@ -12,7 +12,6 @@ sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='type'] orphan-label sfx2/uiconfig/ui/custominfopage.ui://GtkLabel[@id='value'] orphan-label sfx2/uiconfig/ui/decktitlebar.ui://GtkImage[@id='addonimage'] no-labelled-by sfx2/uiconfig/ui/decktitlebar.ui://GtkLabel[@id='label'] orphan-label -sfx2/uiconfig/ui/decktitlebar.ui://GtkToolButton[@id='button'] button-no-label sfx2/uiconfig/ui/documentinfopage.ui://GtkLabel[@id='showcreate'] orphan-label sfx2/uiconfig/ui/documentinfopage.ui://GtkLabel[@id='showmodify'] orphan-label sfx2/uiconfig/ui/documentinfopage.ui://GtkLabel[@id='showsigned'] orphan-label @@ -47,7 +46,6 @@ sfx2/uiconfig/ui/templatepanel.ui://GtkToggleToolButton[@id='6']