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
14 #include <afs/param.h>
18 #include "afs_shl_ext.h"
19 #include "copy_acl_dlg.h"
26 static char THIS_FILE[] = __FILE__;
29 /////////////////////////////////////////////////////////////////////////////
33 CCopyAclDlg::CCopyAclDlg(CWnd* pParent /*=NULL*/)
36 InitModalIndirect (TaLocale_GetDialogResource (CCopyAclDlg::IDD), pParent);
38 //{{AFX_DATA_INIT(CCopyAclDlg)
39 // NOTE: the ClassWizard will add member initialization here
46 void CCopyAclDlg::DoDataExchange(CDataExchange* pDX)
48 CDialog::DoDataExchange(pDX);
49 //{{AFX_DATA_MAP(CCopyAclDlg)
50 DDX_Control(pDX, IDOK, m_Ok);
51 DDX_Control(pDX, IDC_FROM_DIR, m_FromDir);
52 DDX_Control(pDX, IDC_TO_DIR, m_ToDir);
53 DDX_Control(pDX, IDC_CLEAR, m_Clear);
58 BEGIN_MESSAGE_MAP(CCopyAclDlg, CDialog)
59 //{{AFX_MSG_MAP(CCopyAclDlg)
60 ON_EN_CHANGE(IDC_TO_DIR, OnChangeToDir)
61 ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
62 ON_BN_CLICKED(IDHELP, OnHelp)
66 /////////////////////////////////////////////////////////////////////////////
67 // CCopyAclDlg message handlers
69 void CCopyAclDlg::OnOK()
71 m_bClear = m_Clear.GetCheck() == 1;
72 m_ToDir.GetWindowText(m_strToDir);
74 if (PathIsDirectory(m_strToDir) == -1) {
75 ShowMessageBox(IDS_DIR_DOES_NOT_EXIST_ERROR, MB_ICONEXCLAMATION, IDS_DIR_DOES_NOT_EXIST_ERROR, m_strToDir);
82 BOOL CCopyAclDlg::OnInitDialog()
84 CDialog::OnInitDialog();
86 m_FromDir.SetWindowText(m_strFromDir);
88 return TRUE; // return TRUE unless you set the focus to a control
89 // EXCEPTION: OCX Property Pages should return FALSE
92 void CCopyAclDlg::OnChangeToDir()
94 m_ToDir.GetWindowText(m_strToDir);
96 BOOL bEnable = m_strToDir.GetLength() > 0;
97 m_Ok.EnableWindow(bEnable);
100 void CCopyAclDlg::OnBrowse()
102 CFileDialog dlg(TRUE, 0, TEXT("*.*"), OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR | OFN_HIDEREADONLY, 0, 0);
104 if (dlg.DoModal() == IDCANCEL)
107 CString strPath = dlg.GetPathName();
109 // Remove file name (last component of path)
110 int nFirstSlash = strPath.Find('\\');
111 int nLastSlash = strPath.ReverseFind('\\');
112 if (nFirstSlash != nLastSlash)
113 strPath = strPath.Left(nLastSlash);
115 strPath = strPath.Left(nFirstSlash + 1);
117 m_ToDir.SetWindowText(strPath);
120 void CCopyAclDlg::OnHelp()
122 ShowHelp(m_hWnd, COPY_ACL_HELP_ID);