LCOV - code coverage report
Current view: top level - svx/source/dialog - passwd.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 49 2.0 %
Date: 2014-11-03 Functions: 2 9 22.2 %
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 <vcl/layout.hxx>
      22             : #include "svx/passwd.hxx"
      23             : #include <svx/dialmgr.hxx>
      24             : #include <svx/dialogs.hrc>
      25             : 
      26           0 : IMPL_LINK_NOARG(SvxPasswordDialog, ButtonHdl)
      27             : {
      28           0 :     bool bOK = true;
      29           0 :     short nRet = RET_OK;
      30           0 :     OUString aEmpty;
      31             : 
      32           0 :     if ( m_pNewPasswdED->GetText() != m_pRepeatPasswdED->GetText() )
      33             :     {
      34           0 :         MessageDialog(this, aRepeatPasswdErrStr).Execute();
      35           0 :         m_pNewPasswdED->SetText( aEmpty );
      36           0 :         m_pRepeatPasswdED->SetText( aEmpty );
      37           0 :         m_pNewPasswdED->GrabFocus();
      38           0 :         bOK = false;
      39             :     }
      40             : 
      41           0 :     if ( bOK && aCheckPasswordHdl.IsSet() && !aCheckPasswordHdl.Call( this ) )
      42             :     {
      43           0 :         MessageDialog(this, aOldPasswdErrStr).Execute();
      44           0 :         m_pOldPasswdED->SetText( aEmpty );
      45           0 :         m_pOldPasswdED->GrabFocus();
      46           0 :         bOK = false;
      47             :     }
      48             : 
      49           0 :     if ( bOK )
      50           0 :         EndDialog( nRet );
      51             : 
      52           0 :     return 0;
      53             : }
      54             : 
      55             : 
      56             : 
      57           0 : IMPL_LINK_NOARG(SvxPasswordDialog, EditModifyHdl)
      58             : {
      59           0 :     if ( !bEmpty )
      60             :     {
      61           0 :         OUString aPasswd = comphelper::string::strip(m_pRepeatPasswdED->GetText(), ' ');
      62           0 :         if ( aPasswd.isEmpty() && m_pOKBtn->IsEnabled() )
      63           0 :             m_pOKBtn->Disable();
      64           0 :         else if ( !aPasswd.isEmpty() && !m_pOKBtn->IsEnabled() )
      65           0 :             m_pOKBtn->Enable();
      66             :     }
      67           0 :     else if ( !m_pOKBtn->IsEnabled() )
      68           0 :         m_pOKBtn->Enable();
      69           0 :     return 0;
      70             : }
      71             : 
      72             : 
      73             : 
      74           0 : SvxPasswordDialog::SvxPasswordDialog(vcl::Window* pParent, bool bAllowEmptyPasswords, bool bDisableOldPassword)
      75             :     : SfxModalDialog(pParent, "PasswordDialog", "svx/ui/passwd.ui")
      76           0 :     , aOldPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_OLD_PASSWD))
      77           0 :     , aRepeatPasswdErrStr(SVX_RESSTR(RID_SVXSTR_ERR_REPEAT_PASSWD ))
      78           0 :     , bEmpty(bAllowEmptyPasswords)
      79             : {
      80           0 :     get(m_pOldFL, "oldpass");
      81           0 :     get(m_pOldPasswdFT, "oldpassL");
      82           0 :     get(m_pOldPasswdED, "oldpassEntry");
      83           0 :     get(m_pNewPasswdED, "newpassEntry");
      84           0 :     get(m_pRepeatPasswdED, "confirmpassEntry");
      85           0 :     get(m_pOKBtn, "ok");
      86             : 
      87           0 :     m_pOKBtn->SetClickHdl( LINK( this, SvxPasswordDialog, ButtonHdl ) );
      88           0 :     m_pRepeatPasswdED->SetModifyHdl( LINK( this, SvxPasswordDialog, EditModifyHdl ) );
      89           0 :     EditModifyHdl( 0 );
      90             : 
      91           0 :     if ( bDisableOldPassword )
      92             :     {
      93           0 :         m_pOldFL->Disable();
      94           0 :          m_pOldPasswdFT->Disable();
      95           0 :         m_pOldPasswdED->Disable();
      96           0 :         m_pNewPasswdED->GrabFocus();
      97             :     }
      98           0 : }
      99             : 
     100             : 
     101             : 
     102           0 : SvxPasswordDialog::~SvxPasswordDialog()
     103             : {
     104         594 : }
     105             : 
     106             : 
     107             : 
     108             : 
     109             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10