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
15 #include <afs/param.h>
19 #include "afs_shl_ext.h"
20 #include "copy_acl_dlg.h"
27 static char THIS_FILE[] = __FILE__;
30 /////////////////////////////////////////////////////////////////////////////
34 CCopyAclDlg::CCopyAclDlg(CWnd* pParent /*=NULL*/)
37 InitModalIndirect (TaLocale_GetDialogResource (CCopyAclDlg::IDD), pParent);
39 //{{AFX_DATA_INIT(CCopyAclDlg)
40 // NOTE: the ClassWizard will add member initialization here
47 void CCopyAclDlg::DoDataExchange(CDataExchange* pDX)
49 CDialog::DoDataExchange(pDX);
50 //{{AFX_DATA_MAP(CCopyAclDlg)
51 DDX_Control(pDX, IDOK, m_Ok);
52 DDX_Control(pDX, IDC_FROM_DIR, m_FromDir);
53 DDX_Control(pDX, IDC_TO_DIR, m_ToDir);
54 DDX_Control(pDX, IDC_CLEAR, m_Clear);
59 BEGIN_MESSAGE_MAP(CCopyAclDlg, CDialog)
60 //{{AFX_MSG_MAP(CCopyAclDlg)
61 ON_EN_CHANGE(IDC_TO_DIR, OnChangeToDir)
62 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
63 ON_BN_CLICKED(IDHELP, OnHelp)
67 /////////////////////////////////////////////////////////////////////////////
68 // CCopyAclDlg message handlers
70 void CCopyAclDlg::OnOK()
72 m_bClear = m_Clear.GetCheck() == 1;
73 m_ToDir.GetWindowText(m_strToDir);
75 if (access(m_strToDir, 0) == -1) {
76 ShowMessageBox(IDS_DIR_DOES_NOT_EXIST_ERROR, MB_ICONEXCLAMATION, IDS_DIR_DOES_NOT_EXIST_ERROR, m_strToDir);
83 BOOL CCopyAclDlg::OnInitDialog()
85 CDialog::OnInitDialog();
87 m_FromDir.SetWindowText(m_strFromDir);
89 return TRUE; // return TRUE unless you set the focus to a control
90 // EXCEPTION: OCX Property Pages should return FALSE
93 void CCopyAclDlg::OnChangeToDir()
95 m_ToDir.GetWindowText(m_strToDir);
97 BOOL bEnable = m_strToDir.GetLength() > 0;
98 m_Ok.EnableWindow(bEnable);
101 void CCopyAclDlg::OnBrowse()
103 CFileDialog dlg(TRUE, 0, "*.*", OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_HIDEREADONLY, 0, 0);
105 if (dlg.DoModal() == IDCANCEL)
108 CString strPath = dlg.GetPathName();
110 // Remove file name (last component of path)
111 int nFirstSlash = strPath.Find('\\');
112 int nLastSlash = strPath.ReverseFind('\\');
113 if (nFirstSlash != nLastSlash)
114 strPath = strPath.Left(nLastSlash);
116 strPath = strPath.Left(nFirstSlash + 1);
118 m_ToDir.SetWindowText(strPath);
121 void CCopyAclDlg::OnHelp()
123 ShowHelp(m_hWnd, COPY_ACL_HELP_ID);