33 task::PasswordRequestMode nDialogMode,
const std::locale& rResLocale,
34 const OUString& aDocURL,
bool bOpenToModify,
bool bIsSimplePasswordRequest)
35 : GenericDialogController(pParent,
"uui/ui/password.ui",
"PasswordDialog")
36 , m_xFTPassword(m_xBuilder->weld_label(
"newpassFT"))
37 , m_xEDPassword(m_xBuilder->weld_entry(
"newpassEntry"))
38 , m_xFTConfirmPassword(m_xBuilder->weld_label(
"confirmpassFT"))
39 , m_xEDConfirmPassword(m_xBuilder->weld_entry(
"confirmpassEntry"))
40 , m_xOKBtn(m_xBuilder->weld_button(
"ok"))
42 , aPasswdMismatch(
Translate::
get(STR_PASSWORD_MISMATCH, rResLocale))
47 if( nDialogMode == task::PasswordRequestMode_PASSWORD_REENTER )
49 TranslateId pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
50 TranslateId pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId;
53 VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg));
58 OUString aTitle(
Translate::get(STR_TITLE_ENTER_PASSWORD, rResLocale));
65 if (nDialogMode == task::PasswordRequestMode_PASSWORD_CREATE)
79 TranslateId pStrId = bOpenToModify ? STR_ENTER_PASSWORD_TO_MODIFY : STR_ENTER_PASSWORD_TO_OPEN;
86 if (!aFileName.isEmpty())
88 m_xDialog->set_title(aTitle +
" - " + aFileName);
94 if (bIsSimplePasswordRequest)
96 DBG_ASSERT( aDocURL.isEmpty(),
"A simple password request should not have a document URL! Use document password request instead." );
105 bool bEDPasswdValid = m_xEDPassword->get_text().getLength() >= nMinLen;
106 bool bPasswdMismatch = m_xEDConfirmPassword->get_text() != m_xEDPassword->get_text();
107 bool bValid = (!m_xEDConfirmPassword->get_visible() && bEDPasswdValid) ||
108 (m_xEDConfirmPassword->get_visible() && bEDPasswdValid && !bPasswdMismatch);
110 if (m_xEDConfirmPassword->get_visible() && bPasswdMismatch)
113 VclMessageType::Warning, VclButtonsType::Ok,
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
OUString getName(sal_Int32 nIndex=LAST_SEGMENT, bool bIgnoreFinalSlash=true, DecodeMechanism eMechanism=DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
OUString GetMainURL(DecodeMechanism eMechanism, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8) const
std::unique_ptr< weld::Button > m_xOKBtn
std::unique_ptr< weld::Entry > m_xEDConfirmPassword
PasswordDialog(weld::Window *pParent, css::task::PasswordRequestMode nDlgMode, const std::locale &rLocale, const OUString &aDocURL, bool bOpenToModify, bool bIsSimplePasswordRequest)
std::unique_ptr< weld::Label > m_xFTConfirmPassword
std::unique_ptr< weld::Label > m_xFTPassword
static OUString getProductName()
std::shared_ptr< weld::Dialog > m_xDialog
#define DBG_ASSERT(sCon, aError)
#define LINK(Instance, Class, Member)
OUString get(TranslateId sContextAndId, const std::locale &loc)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
IMPL_LINK_NOARG(PasswordDialog, OKHdl_Impl, weld::Button &, void)