diff options
Diffstat (limited to 'sfx2/source/dialog/passwd.cxx')
-rw-r--r-- | sfx2/source/dialog/passwd.cxx | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx index 79bb50a51276..6222885f7bb5 100644 --- a/sfx2/source/dialog/passwd.cxx +++ b/sfx2/source/dialog/passwd.cxx @@ -25,6 +25,7 @@ #include <rtl/ustrbuf.hxx> #include <vcl/svapp.hxx> #include <vcl/weld.hxx> +#include <bitmaps.hlst> IMPL_LINK_NOARG(SfxPasswordDialog, EditModifyHdl, weld::Entry&, void) { @@ -96,6 +97,12 @@ IMPL_LINK(SfxPasswordDialog, InsertTextHdl, OUString&, rTest, bool) // discarded m_xOnlyAsciiFT->set_label_type(weld::LabelType::Warning); } + else + { + // tdf#161412: downgrade from "Warning" to "Normal" if a valid + // letter was discarded after an invalid letter. + m_xOnlyAsciiFT->set_label_type(weld::LabelType::Normal); + } return true; } @@ -138,6 +145,74 @@ IMPL_LINK_NOARG(SfxPasswordDialog, OKHdl, weld::Button&, void) m_xDialog->response(RET_OK); } +IMPL_LINK(SfxPasswordDialog, ShowHdl, weld::Toggleable&, rToggleable, void) +{ + bool bChecked = rToggleable.get_active(); + if (&rToggleable == m_xPass[0].get()) + { + if (bChecked) + { + m_xPass[0]->set_from_icon_name(RID_SVXBMP_SHOWPASS); + m_xPassword1ED->set_visibility(true); + m_xPassword1ED->grab_focus(); + } + else + { + m_xPass[0]->set_from_icon_name(RID_SVXBMP_HIDEPASS); + m_xPassword1ED->set_visibility(false); + m_xPassword1ED->grab_focus(); + } + } + else if (&rToggleable == m_xPass[1].get()) + { + if (bChecked) + { + m_xPass[1]->set_from_icon_name(RID_SVXBMP_SHOWPASS); + m_xConfirm1ED->set_visibility(true); + m_xConfirm1ED->grab_focus(); + } + else + { + m_xPass[1]->set_from_icon_name(RID_SVXBMP_HIDEPASS); + m_xConfirm1ED->set_visibility(false); + m_xConfirm1ED->grab_focus(); + } + } + else if (&rToggleable == m_xPass[2].get()) + { + if (bChecked) + { + m_xPass[2]->set_from_icon_name(RID_SVXBMP_SHOWPASS); + m_xPassword2ED->set_visibility(true); + m_xPassword2ED->grab_focus(); + } + else + { + m_xPass[2]->set_from_icon_name(RID_SVXBMP_HIDEPASS); + m_xPassword2ED->set_visibility(false); + m_xPassword2ED->grab_focus(); + } + } + else if (&rToggleable == m_xPass[3].get()) + { + if (bChecked) + { + m_xPass[3]->set_from_icon_name(RID_SVXBMP_SHOWPASS); + m_xConfirm2ED->set_visibility(true); + m_xConfirm2ED->grab_focus(); + } + else + { + m_xPass[3]->set_from_icon_name(RID_SVXBMP_HIDEPASS); + m_xConfirm2ED->set_visibility(false); + m_xConfirm2ED->grab_focus(); + } + } + else { + // should not reach it + } +} + // CTOR / DTOR ----------------------------------------------------------- SfxPasswordDialog::SfxPasswordDialog(weld::Widget* pParent, const OUString* pGroupText) @@ -179,6 +254,22 @@ SfxPasswordDialog::SfxPasswordDialog(weld::Widget* pParent, const OUString* pGro m_xConfirm2ED->connect_insert_text(aLink2); m_xOKBtn->connect_clicked(LINK(this, SfxPasswordDialog, OKHdl)); + m_xPass[0] = m_xBuilder->weld_toggle_button(u"togglebt1"_ustr); + m_xPass[1] = m_xBuilder->weld_toggle_button(u"togglebt2"_ustr); + m_xPass[2] = m_xBuilder->weld_toggle_button(u"togglebt3"_ustr); + m_xPass[3] = m_xBuilder->weld_toggle_button(u"togglebt4"_ustr); + + Link<weld::Toggleable&, void> aToggleLink = LINK(this, SfxPasswordDialog, ShowHdl); + + for (auto& aPass : m_xPass) + { + if (aPass->get_active()) + aPass->set_from_icon_name(RID_SVXBMP_SHOWPASS); + else + aPass->set_from_icon_name(RID_SVXBMP_HIDEPASS); + aPass->connect_toggled(aToggleLink); + } + if(moPasswordPolicy) { m_xPassword1PolicyLabel->set_label( |