diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-11 11:52:13 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-11 11:52:13 +0200 |
commit | c1979d19e6221f05f79565b67733b6521ada2d93 (patch) | |
tree | 01fd5a5fdd800ba6ebdd62b7e9f70c97081df055 /cui/source/dialogs | |
parent | af30e765cb3c15fbc1745d1aa6076dc14e565293 (diff) |
cws tl78: #i109634# changes to password to open/modify dialog
Diffstat (limited to 'cui/source/dialogs')
-rwxr-xr-x | cui/source/dialogs/passwdomdlg.cxx | 79 | ||||
-rwxr-xr-x | cui/source/dialogs/passwdomdlg.hrc | 3 | ||||
-rwxr-xr-x | cui/source/dialogs/passwdomdlg.src | 31 |
3 files changed, 96 insertions, 17 deletions
diff --git a/cui/source/dialogs/passwdomdlg.cxx b/cui/source/dialogs/passwdomdlg.cxx index d330ed1655f8..6f2f275c16fd 100755 --- a/cui/source/dialogs/passwdomdlg.cxx +++ b/cui/source/dialogs/passwdomdlg.cxx @@ -43,6 +43,7 @@ #include <vcl/button.hxx> #include <vcl/morebtn.hxx> #include <vcl/settings.hxx> +#include <vcl/msgbox.hxx> ////////////////////////////////////////////////////////////////////// @@ -67,7 +68,8 @@ public: PasswordReenterEdit_Impl::PasswordReenterEdit_Impl( Window * pParent, const ResId &rResId ) : Edit( pParent, rResId ) { - m_aDefaultTxt = String( CUI_RES( STR_PASSWD_MUST_BE_CONFIRMED ) ); +// currently the spec does not want to display this text anymore... +// m_aDefaultTxt = String( CUI_RES( STR_PASSWD_MUST_BE_CONFIRMED ) ); } @@ -104,7 +106,7 @@ void PasswordReenterEdit_Impl::Paint( const Rectangle& rRect ) struct PasswordToOpenModifyDialog_Impl { - Window * m_pParent; + PasswordToOpenModifyDialog * m_pParent; FixedLine m_aFileEncryptionFL; FixedText m_aPasswdToOpenFT; @@ -125,16 +127,21 @@ struct PasswordToOpenModifyDialog_Impl PasswordReenterEdit_Impl m_aReenterPasswdToModifyED; // FixedImage m_aPasswdToModifyMatchFI; + String m_aOneMismatch; + String m_aTwoMismatch; + String m_aInvalidStateForOkButton; - DECL_LINK( ModifyHdl, Edit * ); - PasswordToOpenModifyDialog_Impl( Window * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen ); +// DECL_LINK( ModifyHdl, Edit * ); + DECL_LINK( OkBtnClickHdl, OKButton * ); + + PasswordToOpenModifyDialog_Impl( PasswordToOpenModifyDialog * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen ); ~PasswordToOpenModifyDialog_Impl(); }; PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( - Window * pParent, + PasswordToOpenModifyDialog * pParent, sal_uInt16 nMinPasswdLen, sal_uInt16 nMaxPasswdLen ) : m_pParent( pParent ), @@ -154,8 +161,11 @@ PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( m_aPasswdToModifyFT ( pParent, CUI_RES( FT_PASSWD_TO_MODIFY ) ), m_aPasswdToModifyED ( pParent, CUI_RES( ED_PASSWD_TO_MODIFY ) ), m_aReenterPasswdToModifyFT ( pParent, CUI_RES( FT_REENTER_PASSWD_TO_MODIFY ) ), - m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ) + m_aReenterPasswdToModifyED ( pParent, CUI_RES( ED_REENTER_PASSWD_TO_MODIFY ) ), // m_aPasswdToModifyMatchFI ( pParent, CUI_RES( FI_PASSWD_TO_MODIFY_MATCH ) ) + m_aOneMismatch( CUI_RES( STR_ONE_PASSWORD_MISMATCH ) ), + m_aTwoMismatch( CUI_RES( STR_TWO_PASSWORDS_MISMATCH ) ), + m_aInvalidStateForOkButton( CUI_RES( STR_INVALID_STATE_FOR_OK_BUTTON ) ) { /* const sal_Bool bHighContrast = pParent->GetSettings().GetStyleSettings().GetHighContrastMode(); @@ -167,13 +177,17 @@ PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( m_aMoreFewerOptionsBTN.SetMoreText( String( CUI_RES( STR_MORE_OPTIONS ) ) ); m_aMoreFewerOptionsBTN.SetLessText( String( CUI_RES( STR_FEWER_OPTIONS ) ) ); +#if 0 Link aModifyLink = LINK( this, PasswordToOpenModifyDialog_Impl, ModifyHdl ); m_aPasswdToOpenED.SetModifyHdl( aModifyLink ); m_aReenterPasswdToOpenED.SetModifyHdl( aModifyLink ); m_aPasswdToModifyED.SetModifyHdl( aModifyLink ); m_aReenterPasswdToModifyED.SetModifyHdl( aModifyLink ); +#endif - m_aOk.Enable( FALSE ); + m_aOk.SetClickHdl( LINK( this, PasswordToOpenModifyDialog_Impl, OkBtnClickHdl ) ); + +// m_aOk.Enable( FALSE ); if (nMaxPasswdLen) { @@ -187,7 +201,7 @@ PasswordToOpenModifyDialog_Impl::PasswordToOpenModifyDialog_Impl( m_aPasswdToOpenED.GrabFocus(); - ModifyHdl( NULL ); +// ModifyHdl( NULL ); } @@ -195,7 +209,7 @@ PasswordToOpenModifyDialog_Impl::~PasswordToOpenModifyDialog_Impl() { } - +#if 0 IMPL_LINK( PasswordToOpenModifyDialog_Impl, ModifyHdl, Edit *, EMPTYARG /*pEdit*/ ) { // force repaints to get the m_aDefaultTxt displayed again @@ -218,8 +232,55 @@ IMPL_LINK( PasswordToOpenModifyDialog_Impl, ModifyHdl, Edit *, EMPTYARG /*pEdit* return 0; } +#endif +IMPL_LINK( PasswordToOpenModifyDialog_Impl, OkBtnClickHdl, OKButton *, EMPTYARG /*pBtn*/ ) +{ + bool bInvalidState = !m_aOpenReadonlyCB.IsChecked() && + m_aPasswdToOpenED.GetText().Len() == 0 && + m_aPasswdToModifyED.GetText().Len() == 0; + if (bInvalidState) + { + ErrorBox aErrorBox( m_pParent, WB_OK, m_aInvalidStateForOkButton ); + aErrorBox.Execute(); + } + else // check for mismatched passwords... + { + const bool bToOpenMatch = m_aPasswdToOpenED.GetText() == m_aReenterPasswdToOpenED.GetText(); + const bool bToModifyMatch = m_aPasswdToModifyED.GetText() == m_aReenterPasswdToModifyED.GetText(); + const int nMismatch = (bToOpenMatch? 0 : 1) + (bToModifyMatch? 0 : 1); + if (nMismatch > 0) + { + ErrorBox aErrorBox( m_pParent, WB_OK, nMismatch == 1 ? m_aOneMismatch : m_aTwoMismatch ); + aErrorBox.Execute(); + + Edit &rEdit = !bToOpenMatch? m_aPasswdToOpenED : m_aPasswdToModifyED; + PasswordReenterEdit_Impl &rRepeatEdit = !bToOpenMatch? m_aReenterPasswdToOpenED : m_aReenterPasswdToModifyED; + String aEmpty; + if (nMismatch == 1) + { + rEdit.SetText( aEmpty ); + rRepeatEdit.SetText( aEmpty ); + } + else if (nMismatch == 2) + { + m_aPasswdToOpenED.SetText( aEmpty ); + m_aReenterPasswdToOpenED.SetText( aEmpty ); + m_aPasswdToModifyED.SetText( aEmpty ); + m_aReenterPasswdToModifyED.SetText( aEmpty ); + } + rEdit.GrabFocus(); + } + else + { + m_pParent->EndDialog( RET_OK ); + } + } + + return 0; +} + ////////////////////////////////////////////////////////////////////// diff --git a/cui/source/dialogs/passwdomdlg.hrc b/cui/source/dialogs/passwdomdlg.hrc index e0111aed0084..f8229711e2c9 100755 --- a/cui/source/dialogs/passwdomdlg.hrc +++ b/cui/source/dialogs/passwdomdlg.hrc @@ -52,6 +52,9 @@ #define STR_MORE_OPTIONS 51 #define STR_FEWER_OPTIONS 52 #define STR_PASSWD_MUST_BE_CONFIRMED 53 +#define STR_ONE_PASSWORD_MISMATCH 54 +#define STR_TWO_PASSWORDS_MISMATCH 55 +#define STR_INVALID_STATE_FOR_OK_BUTTON 56 #endif diff --git a/cui/source/dialogs/passwdomdlg.src b/cui/source/dialogs/passwdomdlg.src index 9cdd215a6ff5..a2c522083891 100755 --- a/cui/source/dialogs/passwdomdlg.src +++ b/cui/source/dialogs/passwdomdlg.src @@ -44,7 +44,7 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Pos = MAP_APPFONT( 3, 3 ); Size = MAP_APPFONT( 165, 8 ); - Text [ en-US ] = "File encryption"; + Text [ en-US ] = "File encryption password"; }; FixedText FT_PASSWD_TO_OPEN @@ -67,7 +67,7 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Pos = MAP_APPFONT( 6, 45 ); Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "~Reenter password to open"; + Text [ en-US ] = "Confirm password"; WordBreak = TRUE; }; @@ -89,9 +89,9 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Pos = MAP_APPFONT( 6, 80 ); Size = MAP_APPFONT( 159, 4*8 ); // some extra space for translation in other languages - Text [ en-US ] = "Note: If you lose or forget the password, it can not be recovered. "\ - "It is advisable to keep passwords in a safe place. Passwords are "\ - "case-sensitive."; + Text [ en-US ] = "Note: After a password has been set, the document will only open with "\ + "the password. Should you lose the password, there will be no way to "\ + "recover the document. Please also note that this password is case-sensitive."; WordBreak = TRUE; }; @@ -127,7 +127,7 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Pos = MAP_APPFONT( 3, 154 ); Size = MAP_APPFONT( 165, 8 ); - Text [ en-US ] = "File sharing options"; + Text [ en-US ] = "File sharing password"; }; CheckBox CB_OPEN_READONLY @@ -142,7 +142,7 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Pos = MAP_APPFONT( 6, 186 ); Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Enter password to modify"; + Text [ en-US ] = "Enter password to allow editing"; WordBreak = TRUE; }; @@ -158,7 +158,7 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Pos = MAP_APPFONT( 6, 214 ); Size = MAP_APPFONT( 159, 8 ); - Text [ en-US ] = "Reenter password to modify"; + Text [ en-US ] = "Confirm password"; WordBreak = TRUE; }; @@ -191,6 +191,21 @@ ModalDialog RID_DLG_PASSWORD_TO_OPEN_MODIFY { Text [ en-US ] = "Fewer ~Options" ; }; + + String STR_ONE_PASSWORD_MISMATCH + { + Text [ en-US ] = "The confirmation password did not match the password. Set the password again by entering the same password in both boxes." ; + }; + + String STR_TWO_PASSWORDS_MISMATCH + { + Text [ en-US ] = "The confirmation passwords did not match the original passwords. Set the passwords again." ; + }; + + String STR_INVALID_STATE_FOR_OK_BUTTON + { + Text [ en-US ] = "Please enter a password to open or to modify, or check the open read-only option to continue." ; + }; /* Image IMG_PASSWD_MATCH { |