2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
11 #include <afs/param.h>
16 #include "afs_shl_ext.h"
17 #include "copy_acl_dlg.h"
24 static char THIS_FILE[] = __FILE__;
27 /////////////////////////////////////////////////////////////////////////////
31 CCopyAclDlg::CCopyAclDlg(CWnd* pParent /*=NULL*/)
34 InitModalIndirect (TaLocale_GetDialogResource (CCopyAclDlg::IDD), pParent);
36 //{{AFX_DATA_INIT(CCopyAclDlg)
37 // NOTE: the ClassWizard will add member initialization here
44 void CCopyAclDlg::DoDataExchange(CDataExchange* pDX)
46 CDialog::DoDataExchange(pDX);
47 //{{AFX_DATA_MAP(CCopyAclDlg)
48 DDX_Control(pDX, IDOK, m_Ok);
49 DDX_Control(pDX, IDC_FROM_DIR, m_FromDir);
50 DDX_Control(pDX, IDC_TO_DIR, m_ToDir);
51 DDX_Control(pDX, IDC_CLEAR, m_Clear);
56 BEGIN_MESSAGE_MAP(CCopyAclDlg, CDialog)
57 //{{AFX_MSG_MAP(CCopyAclDlg)
58 ON_EN_CHANGE(IDC_TO_DIR, OnChangeToDir)
59 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
60 ON_BN_CLICKED(IDHELP, OnHelp)
64 /////////////////////////////////////////////////////////////////////////////
65 // CCopyAclDlg message handlers
67 void CCopyAclDlg::OnOK()
69 m_bClear = m_Clear.GetCheck() == 1;
70 m_ToDir.GetWindowText(m_strToDir);
72 if (access(m_strToDir, 0) == -1) {
73 ShowMessageBox(IDS_DIR_DOES_NOT_EXIST_ERROR, MB_ICONEXCLAMATION, IDS_DIR_DOES_NOT_EXIST_ERROR, m_strToDir);
80 BOOL CCopyAclDlg::OnInitDialog()
82 CDialog::OnInitDialog();
84 m_FromDir.SetWindowText(m_strFromDir);
86 return TRUE; // return TRUE unless you set the focus to a control
87 // EXCEPTION: OCX Property Pages should return FALSE
90 void CCopyAclDlg::OnChangeToDir()
92 m_ToDir.GetWindowText(m_strToDir);
94 BOOL bEnable = m_strToDir.GetLength() > 0;
95 m_Ok.EnableWindow(bEnable);
98 void CCopyAclDlg::OnBrowse()
100 CFileDialog dlg(TRUE, 0, "*.*", OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_HIDEREADONLY, 0, 0);
102 if (dlg.DoModal() == IDCANCEL)
105 CString strPath = dlg.GetPathName();
107 // Remove file name (last component of path)
108 int nFirstSlash = strPath.Find('\\');
109 int nLastSlash = strPath.ReverseFind('\\');
110 if (nFirstSlash != nLastSlash)
111 strPath = strPath.Left(nLastSlash);
113 strPath = strPath.Left(nFirstSlash + 1);
115 m_ToDir.SetWindowText(strPath);
118 void CCopyAclDlg::OnHelp()
120 ShowHelp(m_hWnd, COPY_ACL_HELP_ID);