28 bool bInvalidState = !m_xOpenReadonlyCB->get_active() && !m_bAllowEmpty &&
29 m_xPasswdToOpenED->get_text().isEmpty() &&
30 m_xPasswdToModifyED->get_text().isEmpty();
34 VclMessageType::Warning, VclButtonsType::Ok,
35 m_bIsPasswordToModify? m_aInvalidStateForOkButton : m_aInvalidStateForOkButton_v2));
36 m_xErrorBox->runAsync(m_xErrorBox, [](sal_Int32 ) {});
40 const bool bToOpenMatch = m_xPasswdToOpenED->get_text() == m_xReenterPasswdToOpenED->get_text();
41 const bool bToModifyMatch = m_xPasswdToModifyED->get_text() == m_xReenterPasswdToModifyED->get_text();
42 const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1);
46 VclMessageType::Warning, VclButtonsType::Ok,
47 nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch));
48 m_xErrorBox->runAsync(m_xErrorBox, [
this, bToOpenMatch, nMismatch](sal_Int32 )
50 weld::Entry* pEdit = !bToOpenMatch ? m_xPasswdToOpenED.get() : m_xPasswdToModifyED.get();
51 weld::Entry* pRepeatEdit = !bToOpenMatch? m_xReenterPasswdToOpenED.get() : m_xReenterPasswdToModifyED.get();
57 else if (nMismatch == 2)
59 m_xPasswdToOpenED->set_text(
"" );
60 m_xReenterPasswdToOpenED->set_text(
"" );
61 m_xPasswdToModifyED->set_text(
"" );
62 m_xReenterPasswdToModifyED->set_text(
"" );
77 int nLength = rEntry.get_text().getLength();
78 if (&rEntry == m_xPasswdToOpenED.get())
79 pIndicator = m_xPasswdToOpenInd.get();
80 else if (&rEntry == m_xReenterPasswdToOpenED.get())
81 pIndicator = m_xReenterPasswdToOpenInd.get();
82 else if (&rEntry == m_xPasswdToModifyED.get())
83 pIndicator = m_xPasswdToModifyInd.get();
84 else if (&rEntry == m_xReenterPasswdToModifyED.get())
85 pIndicator = m_xReenterPasswdToModifyInd.get();
92 , m_xPasswdToOpenED(m_xBuilder->weld_entry(
"newpassEntry"))
93 , m_xPasswdToOpenInd(m_xBuilder->weld_label(
"newpassIndicator"))
94 , m_xReenterPasswdToOpenED(m_xBuilder->weld_entry(
"confirmpassEntry"))
95 , m_xReenterPasswdToOpenInd(m_xBuilder->weld_label(
"confirmpassIndicator"))
96 , m_xOptionsExpander(m_xBuilder->weld_expander(
"expander"))
97 , m_xOk(m_xBuilder->weld_button(
"ok"))
98 , m_xOpenReadonlyCB(m_xBuilder->weld_check_button(
"readonly"))
99 , m_xPasswdToModifyFT(m_xBuilder->weld_label(
"label7"))
100 , m_xPasswdToModifyED(m_xBuilder->weld_entry(
"newpassroEntry"))
101 , m_xPasswdToModifyInd(m_xBuilder->weld_label(
"newpassroIndicator"))
102 , m_xReenterPasswdToModifyFT(m_xBuilder->weld_label(
"label8"))
103 , m_xReenterPasswdToModifyED(m_xBuilder->weld_entry(
"confirmropassEntry"))
104 , m_xReenterPasswdToModifyInd(m_xBuilder->weld_label(
"confirmropassIndicator"))
105 , m_aOneMismatch(
CuiResId( RID_CUISTR_ONE_PASSWORD_MISMATCH ) )
106 , m_aTwoMismatch(
CuiResId( RID_CUISTR_TWO_PASSWORDS_MISMATCH ) )
107 , m_aInvalidStateForOkButton(
CuiResId( RID_CUISTR_INVALID_STATE_FOR_OK_BUTTON ) )
108 , m_aInvalidStateForOkButton_v2(
CuiResId( RID_CUISTR_INVALID_STATE_FOR_OK_BUTTON_V2 ) )
109 , m_nMaxPasswdLen(nMaxPasswdLen)
110 , m_bIsPasswordToModify( bIsPasswordToModify )
111 , m_bAllowEmpty( false )
117 OUString aIndicatorTemplate(
CuiResId(RID_CUISTR_PASSWORD_LEN_INDICATOR).replaceFirst(
"%1", OUString::number(nMaxPasswdLen)));
135 if (!bIsPasswordToModify)
139 if (pSh->IsLoadReadonly())
165 const bool bPasswdOk =
174 const bool bPasswdOk =
188 bool bEnable = m_xOpenReadonlyCB->get_active();
189 m_xPasswdToModifyED->set_sensitive(bEnable);
190 m_xPasswdToModifyFT->set_sensitive(bEnable);
191 m_xReenterPasswdToModifyED->set_sensitive(bEnable);
192 m_xReenterPasswdToModifyFT->set_sensitive(bEnable);
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
std::unique_ptr< weld::Entry > m_xPasswdToModifyED
std::unique_ptr< weld::Label > m_xReenterPasswdToOpenInd
OUString GetPasswordToOpen() const
~PasswordToOpenModifyDialog()
std::unique_ptr< weld::Expander > m_xOptionsExpander
bool IsRecommendToOpenReadonly() const
std::unique_ptr< weld::Label > m_xPasswdToOpenInd
std::unique_ptr< weld::Button > m_xOk
std::unique_ptr< weld::Entry > m_xPasswdToOpenED
std::unique_ptr< weld::CheckButton > m_xOpenReadonlyCB
std::unique_ptr< weld::Entry > m_xReenterPasswdToModifyED
PasswordToOpenModifyDialog(const PasswordToOpenModifyDialog &)=delete
std::shared_ptr< weld::MessageDialog > m_xErrorBox
std::unique_ptr< weld::Label > m_xReenterPasswdToModifyInd
OUString GetPasswordToModify() const
std::unique_ptr< weld::Entry > m_xReenterPasswdToOpenED
std::unique_ptr< weld::Label > m_xPasswdToModifyInd
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual void set_text(const OUString &rText)=0
OUString CuiResId(TranslateId aKey)
#define LINK(Instance, Class, Member)
IMPL_LINK_NOARG(PasswordToOpenModifyDialog, OkBtnClickHdl, weld::Button &, void)
IMPL_LINK(PasswordToOpenModifyDialog, ChangeHdl, weld::Entry &, rEntry, void)