Kaydet (Commit) 392e4db4 authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Fridrich Štrba

sc-save-password-minlength.diff: Display min password length in dialog

i#21923
üst 31b4717c
...@@ -55,6 +55,7 @@ private: ...@@ -55,6 +55,7 @@ private:
Edit maPasswordED; Edit maPasswordED;
FixedText maConfirmFT; FixedText maConfirmFT;
Edit maConfirmED; Edit maConfirmED;
FixedText maMinLengthFT;
FixedLine maPasswordBox; FixedLine maPasswordBox;
OKButton maOKBtn; OKButton maOKBtn;
...@@ -63,12 +64,17 @@ private: ...@@ -63,12 +64,17 @@ private:
String maConfirmStr; String maConfirmStr;
USHORT mnMinLen; USHORT mnMinLen;
String maMinLenPwdStr;
String maEmptyPwdStr;
String maMainPwdStr;
USHORT mnExtras; USHORT mnExtras;
bool mbAsciiOnly; bool mbAsciiOnly;
DECL_DLLPRIVATE_LINK( EditModifyHdl, Edit* ); DECL_DLLPRIVATE_LINK( EditModifyHdl, Edit* );
DECL_DLLPRIVATE_LINK( OKHdl, OKButton* ); DECL_DLLPRIVATE_LINK( OKHdl, OKButton* );
void SetPasswdText();
public: public:
SfxPasswordDialog( Window* pParent, const String* pGroupText = NULL ); SfxPasswordDialog( Window* pParent, const String* pGroupText = NULL );
......
...@@ -103,6 +103,7 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText ...@@ -103,6 +103,7 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
maPasswordED ( this, SfxResId( ED_PASSWD_PASSWORD ) ), maPasswordED ( this, SfxResId( ED_PASSWD_PASSWORD ) ),
maConfirmFT ( this, SfxResId( FT_PASSWD_CONFIRM ) ), maConfirmFT ( this, SfxResId( FT_PASSWD_CONFIRM ) ),
maConfirmED ( this, SfxResId( ED_PASSWD_CONFIRM ) ), maConfirmED ( this, SfxResId( ED_PASSWD_CONFIRM ) ),
maMinLengthFT ( this, SfxResId( FT_PASSWD_MINLEN ) ),
maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ), maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ),
maOKBtn ( this, SfxResId( BTN_PASSWD_OK ) ), maOKBtn ( this, SfxResId( BTN_PASSWD_OK ) ),
maCancelBtn ( this, SfxResId( BTN_PASSWD_CANCEL ) ), maCancelBtn ( this, SfxResId( BTN_PASSWD_CANCEL ) ),
...@@ -110,6 +111,9 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText ...@@ -110,6 +111,9 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ), maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ),
mnMinLen ( 5 ), mnMinLen ( 5 ),
maMinLenPwdStr ( SfxResId( STR_PASSWD_MIN_LEN ) ),
maEmptyPwdStr ( SfxResId( STR_PASSWD_EMPTY ) ),
maMainPwdStr ( ),
mnExtras ( 0 ), mnExtras ( 0 ),
mbAsciiOnly ( false ) mbAsciiOnly ( false )
...@@ -123,6 +127,25 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText ...@@ -123,6 +127,25 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
if ( pGroupText ) if ( pGroupText )
maPasswordBox.SetText( *pGroupText ); maPasswordBox.SetText( *pGroupText );
//set the text to the pasword length
SetPasswdText();
}
// -----------------------------------------------------------------------
void SfxPasswordDialog::SetPasswdText( )
{
//set the new string to the minimum password length
if( mnMinLen == 0 )
maMinLengthFT.SetText( maEmptyPwdStr );
else
{
maMainPwdStr = maMinLenPwdStr;
maMainPwdStr.SearchAndReplace( String::CreateFromAscii( "$(MINLEN)" ), String::CreateFromInt32((sal_Int32) mnMinLen ), 0);
maMinLengthFT.SetText( maMainPwdStr );
maMinLengthFT.Show();
}
} }
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
...@@ -130,6 +153,7 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText ...@@ -130,6 +153,7 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
void SfxPasswordDialog::SetMinLen( USHORT nLen ) void SfxPasswordDialog::SetMinLen( USHORT nLen )
{ {
mnMinLen = nLen; mnMinLen = nLen;
SetPasswdText();
EditModifyHdl( NULL ); EditModifyHdl( NULL );
} }
...@@ -189,8 +213,10 @@ short SfxPasswordDialog::Execute() ...@@ -189,8 +213,10 @@ short SfxPasswordDialog::Execute()
aPos = maUserED.GetPosPixel(); aPos = maUserED.GetPosPixel();
maPasswordED.SetPosPixel( aPos ); maPasswordED.SetPosPixel( aPos );
aPos = maConfirmFT.GetPosPixel();
maConfirmFT.SetPosPixel( aPwdPos1 ); maConfirmFT.SetPosPixel( aPwdPos1 );
maConfirmED.SetPosPixel( aPwdPos2 ); maConfirmED.SetPosPixel( aPwdPos2 );
maMinLengthFT.SetPosPixel(aPos);
} }
Size aBoxSize = maPasswordBox.GetSizePixel(); Size aBoxSize = maPasswordBox.GetSizePixel();
......
...@@ -36,12 +36,15 @@ ...@@ -36,12 +36,15 @@
#define ED_PASSWD_PASSWORD 14 #define ED_PASSWD_PASSWORD 14
#define FT_PASSWD_CONFIRM 15 #define FT_PASSWD_CONFIRM 15
#define ED_PASSWD_CONFIRM 16 #define ED_PASSWD_CONFIRM 16
#define FT_PASSWD_MINLEN 17
#define BTN_PASSWD_OK 20 #define BTN_PASSWD_OK 20
#define BTN_PASSWD_CANCEL 21 #define BTN_PASSWD_CANCEL 21
#define BTN_PASSWD_HELP 22 #define BTN_PASSWD_HELP 22
#define STR_PASSWD_CONFIRM 30 #define STR_PASSWD_CONFIRM 30
#define STR_PASSWD_MIN_LEN 31
#define STR_PASSWD_EMPTY 32
#endif #endif
......
...@@ -77,6 +77,22 @@ ModalDialog DLG_PASSWD ...@@ -77,6 +77,22 @@ ModalDialog DLG_PASSWD
Pos = MAP_APPFONT( 57, 44 ); Pos = MAP_APPFONT( 57, 44 );
Size = MAP_APPFONT( 75, 12 ); Size = MAP_APPFONT( 75, 12 );
}; };
String STR_PASSWD_MIN_LEN
{
Text [ en-US ] = "(Minimum $(MINLEN) characters)" ;
};
String STR_PASSWD_EMPTY
{
Text [ en-US ] = "(The password can be empty)" ;
};
FixedText FT_PASSWD_MINLEN
{
Pos = MAP_APPFONT(12, 65 );
Size = MAP_APPFONT( 126, 10 );
};
FixedLine GB_PASSWD_PASSWORD FixedLine GB_PASSWD_PASSWORD
{ {
Pos = MAP_APPFONT( 6, 3 ); Pos = MAP_APPFONT( 6, 3 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment