Kaydet (Commit) ff3203c5 authored tarafından Manal Alhassoun's avatar Manal Alhassoun Kaydeden (comit) Caolán McNamara

Convert change password dialog to widget UI

Change-Id: I0ff0eda77b849927fe6cffe5cf203c46ba9ef340
Reviewed-on: https://gerrit.libreoffice.org/6089Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 5249bd69
......@@ -200,7 +200,6 @@
// for Toolbox-Control style
#define RID_SVXTBX_STYLE (RID_SVX_START + 120)
#define RID_SVXDLG_PASSWORD (RID_SVX_START + 141)
#define RID_SVXDLG_COMPRESSGRAPHICS (RID_SVX_START + 142)
// Dialog for functions
......@@ -995,6 +994,8 @@
#define RID_SVXSTR_DOC_MODIFIED_YES (SVX_OOO_BUILD_START + 4) // 1234
#define RID_SVXSTR_DOC_MODIFIED_NO (SVX_OOO_BUILD_START + 5) // 1235
#define RID_SVXSTR_DOC_LOAD (SVX_OOO_BUILD_START + 6) // 1236
#define RID_SVXSTR_ERR_OLD_PASSWD (SVX_OOO_BUILD_START + 7) // 1237
#define RID_SVXSTR_ERR_REPEAT_PASSWD (SVX_OOO_BUILD_START + 8) // 1238
// sidebar-related resources (defined in the appropriate .hrc's)
#define RID_SVX_SIDEBAR_BEGIN (RID_SVX_START + 1240)
......
......@@ -33,17 +33,12 @@
class SVX_DLLPUBLIC SvxPasswordDialog : public SfxModalDialog
{
private:
FixedLine aOldFL;
FixedText aOldPasswdFT;
Edit aOldPasswdED;
FixedLine aNewFL;
FixedText aNewPasswdFT;
Edit aNewPasswdED;
FixedText aRepeatPasswdFT;
Edit aRepeatPasswdED;
OKButton aOKBtn;
CancelButton aEscBtn;
HelpButton aHelpBtn;
FixedText* m_pOldFL;
FixedText* m_pOldPasswdFT;
Edit* m_pOldPasswdED;
Edit* m_pNewPasswdED;
Edit* m_pRepeatPasswdED;
OKButton* m_pOKBtn;
OUString aOldPasswdErrStr;
OUString aRepeatPasswdErrStr;
......@@ -59,8 +54,8 @@ public:
SvxPasswordDialog( Window* pParent, sal_Bool bAllowEmptyPasswords = sal_False, sal_Bool bDisableOldPassword = sal_False );
~SvxPasswordDialog();
OUString GetOldPassword() const { return aOldPasswdED.GetText(); }
OUString GetNewPassword() const { return aNewPasswdED.GetText(); }
OUString GetOldPassword() const { return m_pOldPasswdED->GetText(); }
OUString GetNewPassword() const { return m_pNewPasswdED->GetText(); }
void SetCheckPasswordHdl( const Link& rLink ) { aCheckPasswordHdl = rLink; }
};
......
......@@ -19,6 +19,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
svx/uiconfig/ui/headfootformatpage \
svx/uiconfig/ui/findreplacedialog \
svx/uiconfig/ui/optgridpage \
svx/uiconfig/ui/passwd \
svx/uiconfig/ui/redlinecontrol \
svx/uiconfig/ui/redlinefilterpage \
svx/uiconfig/ui/redlineviewpage \
......
......@@ -143,7 +143,6 @@
#define HID_MNU_ZOOM_OPTIMAL "SVX_HID_MNU_ZOOM_OPTIMAL"
#define HID_MNU_ZOOM_PAGE_WIDTH "SVX_HID_MNU_ZOOM_PAGE_WIDTH"
#define HID_MNU_ZOOM_WHOLE_PAGE "SVX_HID_MNU_ZOOM_WHOLE_PAGE"
#define HID_PASSWORD "SVX_HID_PASSWORD"
#define HID_POPUP_COLOR "SVX_HID_POPUP_COLOR"
#define HID_POPUP_COLOR_CTRL "SVX_HID_POPUP_COLOR_CTRL"
#define HID_POPUP_FONTWORK_ALIGN "SVX_HID_POPUP_FONTWORK_ALIGN"
......
......@@ -23,7 +23,6 @@
#include "svx/passwd.hxx"
#include <svx/dialmgr.hxx>
#include <svx/dialogs.hrc>
#include "passwd.hrc"
// class SvxPasswordDialog -----------------------------------------------
......@@ -33,20 +32,20 @@ IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl)
short nRet = RET_OK;
OUString aEmpty;
if ( aNewPasswdED.GetText() != aRepeatPasswdED.GetText() )
if ( m_pNewPasswdED->GetText() != m_pRepeatPasswdED->GetText() )
{
ErrorBox( this, WB_OK, aRepeatPasswdErrStr ).Execute();
aNewPasswdED.SetText( aEmpty );
aRepeatPasswdED.SetText( aEmpty );
aNewPasswdED.GrabFocus();
m_pNewPasswdED->SetText( aEmpty );
m_pRepeatPasswdED->SetText( aEmpty );
m_pNewPasswdED->GrabFocus();
bOK = false;
}
if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
{
ErrorBox( this, WB_OK, aOldPasswdErrStr ).Execute();
aOldPasswdED.SetText( aEmpty );
aOldPasswdED.GrabFocus();
m_pOldPasswdED->SetText( aEmpty );
m_pOldPasswdED->GrabFocus();
bOK = false;
}
......@@ -62,48 +61,42 @@ IMPL_LINK_NOARG(SvxPasswordDialog, EditModifyHdl)
{
if ( !bEmpty )
{
OUString aPasswd = comphelper::string::strip(aRepeatPasswdED.GetText(), ' ');
if ( aPasswd.isEmpty() && aOKBtn.IsEnabled() )
aOKBtn.Disable();
else if ( !aPasswd.isEmpty() && !aOKBtn.IsEnabled() )
aOKBtn.Enable();
OUString aPasswd = comphelper::string::strip(m_pRepeatPasswdED->GetText(), ' ');
if ( aPasswd.isEmpty() && m_pOKBtn->IsEnabled() )
m_pOKBtn->Disable();
else if ( !aPasswd.isEmpty() && !m_pOKBtn->IsEnabled() )
m_pOKBtn->Enable();
}
else if ( !aOKBtn.IsEnabled() )
aOKBtn.Enable();
else if ( !m_pOKBtn->IsEnabled() )
m_pOKBtn->Enable();
return 0;
}
// -----------------------------------------------------------------------
SvxPasswordDialog::SvxPasswordDialog( Window* pParent, sal_Bool bAllowEmptyPasswords, sal_Bool bDisableOldPassword ) :
SfxModalDialog( pParent, SVX_RES( RID_SVXDLG_PASSWORD ) ),
aOldFL ( this, SVX_RES( FL_OLD_PASSWD ) ),
aOldPasswdFT ( this, SVX_RES( FT_OLD_PASSWD ) ),
aOldPasswdED ( this, SVX_RES( ED_OLD_PASSWD ) ),
aNewFL ( this, SVX_RES( FL_NEW_PASSWD ) ),
aNewPasswdFT ( this, SVX_RES( FT_NEW_PASSWD ) ),
aNewPasswdED ( this, SVX_RES( ED_NEW_PASSWD ) ),
aRepeatPasswdFT ( this, SVX_RES( FT_REPEAT_PASSWD ) ),
aRepeatPasswdED ( this, SVX_RES( ED_REPEAT_PASSWD ) ),
aOKBtn ( this, SVX_RES( BTN_PASSWD_OK ) ),
aEscBtn ( this, SVX_RES( BTN_PASSWD_ESC ) ),
aHelpBtn ( this, SVX_RES( BTN_PASSWD_HELP ) ),
aOldPasswdErrStr ( SVX_RESSTR( STR_ERR_OLD_PASSWD ) ),
aRepeatPasswdErrStr ( SVX_RESSTR( STR_ERR_REPEAT_PASSWD ) ),
bEmpty ( bAllowEmptyPasswords )
SvxPasswordDialog::SvxPasswordDialog(Window* pParent, sal_Bool bAllowEmptyPasswords, sal_Bool bDisableOldPassword)
: SfxModalDialog(pParent, "PasswordDialog", "svx/ui/passwd.ui")
, aOldPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_OLD_PASSWD))
, aRepeatPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_REPEAT_PASSWD ))
, bEmpty(bAllowEmptyPasswords)
{
FreeResource();
aOKBtn.SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
aRepeatPasswdED.SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
get(m_pOldFL, "oldpass");
get(m_pOldPasswdFT, "oldpassL");
get(m_pOldPasswdED, "oldpassEntry");
get(m_pNewPasswdED, "newpassEntry");
get(m_pRepeatPasswdED, "confirmpassEntry");
get(m_pOKBtn, "ok");
m_pOKBtn->SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
m_pRepeatPasswdED->SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
EditModifyHdl( 0 );
if ( bDisableOldPassword )
{
aOldFL.Disable();
aOldPasswdFT.Disable();
aOldPasswdED.Disable();
aNewPasswdED.GrabFocus();
m_pOldFL->Disable();
m_pOldPasswdFT->Disable();
m_pOldPasswdED->Disable();
m_pNewPasswdED->GrabFocus();
}
}
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _SVX_PASSWD_HRC
#define _SVX_PASSWD_HRC
// defines ------------------------------------------------------------------
#define FT_OLD_PASSWD 10
#define ED_OLD_PASSWD 11
#define FL_OLD_PASSWD 12
#define FT_NEW_PASSWD 20
#define ED_NEW_PASSWD 21
#define FT_REPEAT_PASSWD 22
#define ED_REPEAT_PASSWD 23
#define FL_NEW_PASSWD 24
#define BTN_PASSWD_OK 30
#define BTN_PASSWD_ESC 31
#define BTN_PASSWD_HELP 32
#define STR_ERR_OLD_PASSWD 40
#define STR_ERR_REPEAT_PASSWD 41
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -18,98 +18,15 @@
*/
#include <svx/dialogs.hrc>
#include "helpid.hrc"
#include "passwd.hrc"
// RID_SVXDLG_PASSWORD ---------------------------------------------------
ModalDialog RID_SVXDLG_PASSWORD
String RID_SVXSTR_ERR_OLD_PASSWD
{
HelpId = HID_PASSWORD ;
OutputSize = TRUE ;
SVLook = TRUE ;
Size = MAP_APPFONT ( 210 , 77 ) ;
Moveable = TRUE ;
FixedText FT_OLD_PASSWD
{
Pos = MAP_APPFONT ( 12 , 16 ) ;
Size = MAP_APPFONT ( 57 , 8 ) ;
Text [ en-US ] = "~Password" ;
};
Edit ED_OLD_PASSWD
{
HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_OLD_PASSWD";
Border = TRUE ;
Pos = MAP_APPFONT ( 71 , 14 ) ;
Size = MAP_APPFONT ( 71 , 12 ) ;
PassWord = TRUE ;
};
FixedLine FL_OLD_PASSWD
{
Pos = MAP_APPFONT ( 6 , 3 ) ;
Size = MAP_APPFONT ( 142 , 8 ) ;
Text [ en-US ] = "Old password" ;
};
FixedText FT_NEW_PASSWD
{
Pos = MAP_APPFONT ( 12 , 45 ) ;
Size = MAP_APPFONT ( 57 , 8 ) ;
Text [ en-US ] = "Pa~ssword" ;
};
Edit ED_NEW_PASSWD
{
HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_NEW_PASSWD";
Border = TRUE ;
Pos = MAP_APPFONT ( 71 , 43 ) ;
Size = MAP_APPFONT ( 71 , 12 ) ;
PassWord = TRUE ;
};
FixedText FT_REPEAT_PASSWD
{
Pos = MAP_APPFONT ( 12 , 61 ) ;
Size = MAP_APPFONT ( 57 , 8 ) ;
Text [ en-US ] = "Confi~rm";
};
Edit ED_REPEAT_PASSWD
{
HelpID = "svx:Edit:RID_SVXDLG_PASSWORD:ED_REPEAT_PASSWD";
Border = TRUE ;
Pos = MAP_APPFONT ( 71 , 59 ) ;
Size = MAP_APPFONT ( 71 , 12 ) ;
PassWord = TRUE ;
};
FixedLine FL_NEW_PASSWD
{
Pos = MAP_APPFONT ( 6 , 32 ) ;
Size = MAP_APPFONT ( 142 , 8 ) ;
Text [ en-US ] = "New password" ;
};
OKButton BTN_PASSWD_OK
{
Pos = MAP_APPFONT ( 154 , 6 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
DefButton = TRUE ;
Disable = TRUE ;
};
CancelButton BTN_PASSWD_ESC
{
Pos = MAP_APPFONT ( 154 , 23 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
HelpButton BTN_PASSWD_HELP
{
Pos = MAP_APPFONT ( 154 , 43 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
String STR_ERR_OLD_PASSWD
{
Text [ en-US ] = "Invalid password" ;
};
String STR_ERR_REPEAT_PASSWD
{
Text [ en-US ] = "Passwords do not match" ;
};
Text [ en-US ] = "Change Password" ;
Text [ en-US ] = "Invalid password" ;
};
String RID_SVXSTR_ERR_REPEAT_PASSWD
{
Text [ en-US ] = "Passwords do not match" ;
};
// ********************************************************************** EOF
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This diff is collapsed.
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