LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/uui/source - masterpasscrtdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 22 4.5 %
Date: 2013-07-09 Functions: 2 7 28.6 %
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 <sal/macros.h>
      21             : #include <vcl/msgbox.hxx>
      22             : 
      23             : #include <ids.hrc>
      24             : #include <masterpasscrtdlg.hxx>
      25             : 
      26             : // MasterPasswordCreateDialog---------------------------------------------------
      27             : 
      28             : // -----------------------------------------------------------------------
      29             : 
      30           0 : IMPL_LINK_NOARG(MasterPasswordCreateDialog, EditHdl_Impl)
      31             : {
      32           0 :     m_pOKBtn->Enable( m_pEDMasterPasswordCrt->GetText().getLength() >= nMinLen );
      33           0 :     return 0;
      34             : }
      35             : 
      36             : // -----------------------------------------------------------------------
      37             : 
      38           0 : IMPL_LINK_NOARG(MasterPasswordCreateDialog, OKHdl_Impl)
      39             : {
      40             :     // compare both passwords and show message box if there are not equal!!
      41           0 :     if( m_pEDMasterPasswordCrt->GetText() == m_pEDMasterPasswordRepeat->GetText() )
      42           0 :         EndDialog( RET_OK );
      43             :     else
      44             :     {
      45           0 :         String aErrorMsg( ResId( STR_ERROR_PASSWORDS_NOT_IDENTICAL, *pResourceMgr ));
      46           0 :         ErrorBox aErrorBox( this, WB_OK, aErrorMsg );
      47           0 :         aErrorBox.Execute();
      48           0 :         m_pEDMasterPasswordCrt->SetText( String() );
      49           0 :         m_pEDMasterPasswordRepeat->SetText( String() );
      50           0 :         m_pEDMasterPasswordCrt->GrabFocus();
      51             :     }
      52           0 :     return 1;
      53             : }
      54             : 
      55             : // -----------------------------------------------------------------------
      56             : 
      57           0 : MasterPasswordCreateDialog::MasterPasswordCreateDialog(Window* pParent, ResMgr* pResMgr)
      58             :     : ModalDialog(pParent, "SetMasterPasswordDialog", "uui/ui/setmasterpassworddlg.ui")
      59             :     , pResourceMgr(pResMgr)
      60           0 :     , nMinLen(1)
      61             : {
      62           0 :     get(m_pEDMasterPasswordCrt, "password1");
      63           0 :     get(m_pEDMasterPasswordRepeat, "password2");
      64           0 :     get(m_pOKBtn, "ok");
      65           0 :     m_pOKBtn->Enable( sal_False );
      66           0 :     m_pOKBtn->SetClickHdl( LINK( this, MasterPasswordCreateDialog, OKHdl_Impl ) );
      67           0 :     m_pEDMasterPasswordCrt->SetModifyHdl( LINK( this, MasterPasswordCreateDialog, EditHdl_Impl ) );
      68          36 : }
      69             : 
      70             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10