diff --git a/uui/inc/bitmaps.hlst b/uui/inc/bitmaps.hlst new file mode 100644 index 000000000000..fcf2c8074241 --- /dev/null +++ b/uui/inc/bitmaps.hlst @@ -0,0 +1,17 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include + +inline constexpr OUString RID_SVXBMP_HIDEPASS = u"res/hidepass.png"_ustr; +inline constexpr OUString RID_SVXBMP_SHOWPASS = u"res/showpass.png"_ustr; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/uui/source/passworddlg.cxx b/uui/source/passworddlg.cxx index 0485e4ddc201..382c387bc6b3 100644 --- a/uui/source/passworddlg.cxx +++ b/uui/source/passworddlg.cxx @@ -26,6 +26,7 @@ #include #include #include +#include using namespace ::com::sun::star; @@ -54,12 +55,28 @@ PasswordDialog::PasswordDialog(weld::Window* pParent, xBox->run(); } + m_xPass[0] = m_xBuilder->weld_toggle_button(u"togglebt1"_ustr); + m_xPass[1] = m_xBuilder->weld_toggle_button(u"togglebt2"_ustr); + + Link aToggleLink = LINK(this, PasswordDialog, 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); + } + // default settings for enter password or reenter passwd... OUString aTitle(Translate::get(STR_TITLE_ENTER_PASSWORD, rResLocale)); m_xFTConfirmPassword->hide(); m_xEDConfirmPassword->hide(); + m_xPass[1]->hide(); m_xFTConfirmPassword->set_sensitive(false); m_xEDConfirmPassword->set_sensitive(false); + m_xPass[1]->set_sensitive(false); // settings for create password if (nDialogMode == task::PasswordRequestMode_PASSWORD_CREATE) @@ -119,5 +136,40 @@ IMPL_LINK_NOARG(PasswordDialog, OKHdl_Impl, weld::Button&, void) m_xDialog->response(RET_OK); } +IMPL_LINK(PasswordDialog, 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_xEDPassword->set_visibility(true); + m_xEDPassword->grab_focus(); + } + else + { + m_xPass[0]->set_from_icon_name(RID_SVXBMP_HIDEPASS); + m_xEDPassword->set_visibility(false); + m_xEDPassword->grab_focus(); + } + } + else if (&rToggleable == m_xPass[1].get()) + { + if (bChecked) + { + m_xPass[1]->set_from_icon_name(RID_SVXBMP_SHOWPASS); + m_xEDConfirmPassword->set_visibility(true); + m_xEDConfirmPassword->grab_focus(); + } + else + { + m_xPass[1]->set_from_icon_name(RID_SVXBMP_HIDEPASS); + m_xEDConfirmPassword->set_visibility(false); + m_xEDConfirmPassword->grab_focus(); + } + } +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/uui/source/passworddlg.hxx b/uui/source/passworddlg.hxx index c21c4c3ba82f..f8a303cf65f4 100644 --- a/uui/source/passworddlg.hxx +++ b/uui/source/passworddlg.hxx @@ -29,11 +29,13 @@ class PasswordDialog : public weld::GenericDialogController std::unique_ptr m_xFTConfirmPassword; std::unique_ptr m_xEDConfirmPassword; std::unique_ptr m_xOKBtn; + std::array, 2> m_xPass; sal_uInt16 nMinLen; OUString aPasswdMismatch; DECL_LINK(OKHdl_Impl, weld::Button&, void); + DECL_LINK(ShowHdl, weld::Toggleable&, void); public: PasswordDialog(weld::Window* pParent, css::task::PasswordRequestMode nDlgMode, const std::locale& rLocale, const OUString& aDocURL, diff --git a/uui/uiconfig/ui/password.ui b/uui/uiconfig/ui/password.ui index f36fbf479818..568f401b34d3 100644 --- a/uui/uiconfig/ui/password.ui +++ b/uui/uiconfig/ui/password.ui @@ -2,6 +2,16 @@ + + True + False + res/hidepass.png + + + True + False + res/hidepass.png + False 6 @@ -86,7 +96,6 @@ True False True - confirmpassEntry 0 @@ -99,7 +108,6 @@ True False True - newpassEntry 0 @@ -108,17 +116,48 @@ - + True - True + False True - False - True - True - - - Type a password. A password is case sensitive. + + + True + True + True + False + True + True + + + Type a password. A password is case sensitive. + + + + False + True + 0 + + + + + True + True + True + passimg1 + + + Show Characters + Show or Hide password characters + + + + + False + True + 1 + @@ -127,17 +166,48 @@ - + True - True + False True - False - True - True - - - Re-enter the password. + + + True + True + True + False + True + True + + + Re-enter the password. + + + + False + True + 0 + + + + + True + True + True + passimg2 + + + Show Characters + Show or Hide password characters + + + + + False + True + 1 +