summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-09-15 12:12:18 +0200
committerFridrich Štrba <fridrich.strba@bluewin.ch>2010-09-15 14:10:27 +0200
commit392e4db4192abb549be4062c48a732a6d04d1753 (patch)
tree05a17730229a020e58952604490893c97f808741 /sfx2
parent31b4717cdd1742a200cef4a2134681d667de56ce (diff)
sc-save-password-minlength.diff: Display min password length in dialog
i#21923
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/inc/sfx2/passwd.hxx6
-rw-r--r--sfx2/source/dialog/passwd.cxx26
-rw-r--r--sfx2/source/dialog/passwd.hrc3
-rw-r--r--sfx2/source/dialog/passwd.src16
4 files changed, 51 insertions, 0 deletions
diff --git a/sfx2/inc/sfx2/passwd.hxx b/sfx2/inc/sfx2/passwd.hxx
index 4f4a04834257..cad348887670 100644
--- a/sfx2/inc/sfx2/passwd.hxx
+++ b/sfx2/inc/sfx2/passwd.hxx
@@ -55,6 +55,7 @@ private:
Edit maPasswordED;
FixedText maConfirmFT;
Edit maConfirmED;
+ FixedText maMinLengthFT;
FixedLine maPasswordBox;
OKButton maOKBtn;
@@ -63,12 +64,17 @@ private:
String maConfirmStr;
USHORT mnMinLen;
+ String maMinLenPwdStr;
+ String maEmptyPwdStr;
+ String maMainPwdStr;
USHORT mnExtras;
bool mbAsciiOnly;
DECL_DLLPRIVATE_LINK( EditModifyHdl, Edit* );
DECL_DLLPRIVATE_LINK( OKHdl, OKButton* );
+ void SetPasswdText();
+
public:
SfxPasswordDialog( Window* pParent, const String* pGroupText = NULL );
diff --git a/sfx2/source/dialog/passwd.cxx b/sfx2/source/dialog/passwd.cxx
index e7cc73ca04bf..72415b63cee1 100644
--- a/sfx2/source/dialog/passwd.cxx
+++ b/sfx2/source/dialog/passwd.cxx
@@ -103,6 +103,7 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
maPasswordED ( this, SfxResId( ED_PASSWD_PASSWORD ) ),
maConfirmFT ( this, SfxResId( FT_PASSWD_CONFIRM ) ),
maConfirmED ( this, SfxResId( ED_PASSWD_CONFIRM ) ),
+ maMinLengthFT ( this, SfxResId( FT_PASSWD_MINLEN ) ),
maPasswordBox ( this, SfxResId( GB_PASSWD_PASSWORD ) ),
maOKBtn ( this, SfxResId( BTN_PASSWD_OK ) ),
maCancelBtn ( this, SfxResId( BTN_PASSWD_CANCEL ) ),
@@ -110,6 +111,9 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
maConfirmStr ( SfxResId( STR_PASSWD_CONFIRM ) ),
mnMinLen ( 5 ),
+ maMinLenPwdStr ( SfxResId( STR_PASSWD_MIN_LEN ) ),
+ maEmptyPwdStr ( SfxResId( STR_PASSWD_EMPTY ) ),
+ maMainPwdStr ( ),
mnExtras ( 0 ),
mbAsciiOnly ( false )
@@ -123,6 +127,25 @@ SfxPasswordDialog::SfxPasswordDialog( Window* pParent, const String* pGroupText
if ( 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
void SfxPasswordDialog::SetMinLen( USHORT nLen )
{
mnMinLen = nLen;
+ SetPasswdText();
EditModifyHdl( NULL );
}
@@ -189,8 +213,10 @@ short SfxPasswordDialog::Execute()
aPos = maUserED.GetPosPixel();
maPasswordED.SetPosPixel( aPos );
+ aPos = maConfirmFT.GetPosPixel();
maConfirmFT.SetPosPixel( aPwdPos1 );
maConfirmED.SetPosPixel( aPwdPos2 );
+ maMinLengthFT.SetPosPixel(aPos);
}
Size aBoxSize = maPasswordBox.GetSizePixel();
diff --git a/sfx2/source/dialog/passwd.hrc b/sfx2/source/dialog/passwd.hrc
index 5be0446fd752..b29af8bae9ee 100644
--- a/sfx2/source/dialog/passwd.hrc
+++ b/sfx2/source/dialog/passwd.hrc
@@ -36,12 +36,15 @@
#define ED_PASSWD_PASSWORD 14
#define FT_PASSWD_CONFIRM 15
#define ED_PASSWD_CONFIRM 16
+#define FT_PASSWD_MINLEN 17
#define BTN_PASSWD_OK 20
#define BTN_PASSWD_CANCEL 21
#define BTN_PASSWD_HELP 22
#define STR_PASSWD_CONFIRM 30
+#define STR_PASSWD_MIN_LEN 31
+#define STR_PASSWD_EMPTY 32
#endif
diff --git a/sfx2/source/dialog/passwd.src b/sfx2/source/dialog/passwd.src
index fc58ecfda219..bba03b7e8fe9 100644
--- a/sfx2/source/dialog/passwd.src
+++ b/sfx2/source/dialog/passwd.src
@@ -77,6 +77,22 @@ ModalDialog DLG_PASSWD
Pos = MAP_APPFONT( 57, 44 );
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
{
Pos = MAP_APPFONT( 6, 3 );