LCOV - code coverage report
Current view: top level - svx/source/dialog - passwd.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 49 0.0 %
Date: 2014-04-11 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <comphelper/string.hxx>
      21             : #include <tools/shl.hxx>
      22             : #include <vcl/msgbox.hxx>
      23             : #include "svx/passwd.hxx"
      24             : #include <svx/dialmgr.hxx>
      25             : #include <svx/dialogs.hrc>
      26             : 
      27             : // class SvxPasswordDialog -----------------------------------------------
      28             : 
      29           0 : IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl)
      30             : {
      31           0 :     bool bOK = true;
      32           0 :     short nRet = RET_OK;
      33           0 :     OUString aEmpty;
      34             : 
      35           0 :     if ( m_pNewPasswdED->GetText() != m_pRepeatPasswdED->GetText() )
      36             :     {
      37           0 :         ErrorBox( this, WB_OK, aRepeatPasswdErrStr ).Execute();
      38           0 :         m_pNewPasswdED->SetText( aEmpty );
      39           0 :         m_pRepeatPasswdED->SetText( aEmpty );
      40           0 :         m_pNewPasswdED->GrabFocus();
      41           0 :         bOK = false;
      42             :     }
      43             : 
      44           0 :     if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
      45             :     {
      46           0 :         ErrorBox( this, WB_OK, aOldPasswdErrStr ).Execute();
      47           0 :         m_pOldPasswdED->SetText( aEmpty );
      48           0 :         m_pOldPasswdED->GrabFocus();
      49           0 :         bOK = false;
      50             :     }
      51             : 
      52           0 :     if ( bOK )
      53           0 :         EndDialog( nRet );
      54             : 
      55           0 :     return 0;
      56             : }
      57             : 
      58             : 
      59             : 
      60           0 : IMPL_LINK_NOARG(SvxPasswordDialog, EditModifyHdl)
      61             : {
      62           0 :     if ( !bEmpty )
      63             :     {
      64           0 :         OUString aPasswd = comphelper::string::strip(m_pRepeatPasswdED->GetText(), ' ');
      65           0 :         if ( aPasswd.isEmpty() && m_pOKBtn->IsEnabled() )
      66           0 :             m_pOKBtn->Disable();
      67           0 :         else if ( !aPasswd.isEmpty() && !m_pOKBtn->IsEnabled() )
      68           0 :             m_pOKBtn->Enable();
      69             :     }
      70           0 :     else if ( !m_pOKBtn->IsEnabled() )
      71           0 :         m_pOKBtn->Enable();
      72           0 :     return 0;
      73             : }
      74             : 
      75             : 
      76             : 
      77           0 : SvxPasswordDialog::SvxPasswordDialog(Window* pParent, bool bAllowEmptyPasswords, bool bDisableOldPassword)
      78             :     : SfxModalDialog(pParent, "PasswordDialog", "svx/ui/passwd.ui")
      79           0 :     , aOldPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_OLD_PASSWD))
      80           0 :     , aRepeatPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_REPEAT_PASSWD ))
      81           0 :     , bEmpty(bAllowEmptyPasswords)
      82             : {
      83           0 :     get(m_pOldFL, "oldpass");
      84           0 :     get(m_pOldPasswdFT, "oldpassL");
      85           0 :     get(m_pOldPasswdED, "oldpassEntry");
      86           0 :     get(m_pNewPasswdED, "newpassEntry");
      87           0 :     get(m_pRepeatPasswdED, "confirmpassEntry");
      88           0 :     get(m_pOKBtn, "ok");
      89             : 
      90           0 :     m_pOKBtn->SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
      91           0 :     m_pRepeatPasswdED->SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
      92           0 :     EditModifyHdl( 0 );
      93             : 
      94           0 :     if ( bDisableOldPassword )
      95             :     {
      96           0 :         m_pOldFL->Disable();
      97           0 :          m_pOldPasswdFT->Disable();
      98           0 :         m_pOldPasswdED->Disable();
      99           0 :         m_pNewPasswdED->GrabFocus();
     100             :     }
     101           0 : }
     102             : 
     103             : 
     104             : 
     105           0 : SvxPasswordDialog::~SvxPasswordDialog()
     106             : {
     107           0 : }
     108             : 
     109             : 
     110             : 
     111             : 
     112             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10