tdf#50400 show an explanatory label if ascii-only password is required
Change-Id: Ib0e3d07e29d56e9782b4b9d215eab4d743158a71
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134526
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
diff --git a/include/sfx2/passwd.hxx b/include/sfx2/passwd.hxx
index cbbbf7a..3302c37 100644
--- a/include/sfx2/passwd.hxx
+++ b/include/sfx2/passwd.hxx
@@ -60,6 +60,7 @@ private:
std::unique_ptr<weld::Entry> m_xConfirm2ED;
std::unique_ptr<weld::Label> m_xMinLengthFT;
std::unique_ptr<weld::Label> m_xOnlyAsciiFT;
std::unique_ptr<weld::Button> m_xOKBtn;
@@ -117,11 +118,8 @@ public:
{
mnExtras = nExtras;
}
void AllowAsciiOnly()
{
mbAsciiOnly = true;
}
void AllowAsciiOnly();
void ShowMinLengthText(bool bShow);
virtual short run() override;
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index da4dd80..13822c4 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -56,7 +56,12 @@ IMPL_LINK(SfxPasswordDialog, InsertTextHdl, OUString&, rTest, bool)
}
if (bReset)
{
rTest = aFilter.makeStringAndClear();
// upgrade from "Normal" to "Warning" if a invalid letter was
// discarded
m_xOnlyAsciiFT->set_label_type(weld::LabelType::Warning);
}
return true;
}
@@ -97,6 +102,7 @@ SfxPasswordDialog::SfxPasswordDialog(weld::Widget* pParent, const OUString* pGro
, m_xConfirm2FT(m_xBuilder->weld_label("confirm2ft"))
, m_xConfirm2ED(m_xBuilder->weld_entry("confirm2ed"))
, m_xMinLengthFT(m_xBuilder->weld_label("minlenft"))
, m_xOnlyAsciiFT(m_xBuilder->weld_label("onlyascii"))
, m_xOKBtn(m_xBuilder->weld_button("ok"))
, maMinLenPwdStr(SfxResId(STR_PASSWD_MIN_LEN))
, maMinLenPwdStr1(SfxResId(STR_PASSWD_MIN_LEN1))
@@ -153,6 +159,12 @@ void SfxPasswordDialog::ShowMinLengthText(bool bShow)
m_xMinLengthFT->set_visible(bShow);
}
void SfxPasswordDialog::AllowAsciiOnly()
{
mbAsciiOnly = true;
m_xOnlyAsciiFT->show();
}
short SfxPasswordDialog::run()
{
m_xUserFT->hide();
diff --git a/sfx2/uiconfig/ui/password.ui b/sfx2/uiconfig/ui/password.ui
index 4cc5709..ff7cfe9 100644
--- a/sfx2/uiconfig/ui/password.ui
+++ b/sfx2/uiconfig/ui/password.ui
@@ -330,6 +330,25 @@
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="onlyascii">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="margin-start">6</property>
<property name="label" translatable="yes" context="password|onlyascii">Only Basic Latin characters can be entered</property>
<property name="xalign">0</property>
<child internal-child="accessible">
<object class="AtkObject" id="onlyascii-atkobject">
<property name="AtkObject::accessible-role" translatable="no">static</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>