diff options
author | Manal Alhassoun <malhassoun@kacst.edu.sa> | 2013-09-30 11:22:50 +0300 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-01 09:55:52 +0000 |
commit | ff3203c5c567ed14a8ff2e80408c304d3cdd84e0 (patch) | |
tree | 178f9ccc0046dfb31a015661bdb234c2002c7018 /svx/source/dialog | |
parent | 5249bd69ff7fa41d785a5bf9f4e7539ef8288438 (diff) |
Convert change password dialog to widget UI
Change-Id: I0ff0eda77b849927fe6cffe5cf203c46ba9ef340
Reviewed-on: https://gerrit.libreoffice.org/6089
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svx/source/dialog')
-rw-r--r-- | svx/source/dialog/passwd.cxx | 69 | ||||
-rw-r--r-- | svx/source/dialog/passwd.hrc | 44 | ||||
-rw-r--r-- | svx/source/dialog/passwd.src | 97 |
3 files changed, 38 insertions, 172 deletions
diff --git a/svx/source/dialog/passwd.cxx b/svx/source/dialog/passwd.cxx index 2e80408f2753..25b2314a4388 100644 --- a/svx/source/dialog/passwd.cxx +++ b/svx/source/dialog/passwd.cxx @@ -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(); } } diff --git a/svx/source/dialog/passwd.hrc b/svx/source/dialog/passwd.hrc deleted file mode 100644 index 2f8552e2dcba..000000000000 --- a/svx/source/dialog/passwd.hrc +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- 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: */ diff --git a/svx/source/dialog/passwd.src b/svx/source/dialog/passwd.src index bb0d96139223..11d4e0cf1f27 100644 --- a/svx/source/dialog/passwd.src +++ b/svx/source/dialog/passwd.src @@ -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: */ |