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
16 #include <afs/param.h>
20 #include "afs_shl_ext.h"
21 #include "copy_acl_dlg.h"
28 static char THIS_FILE
[] = __FILE__
;
31 /////////////////////////////////////////////////////////////////////////////
35 CCopyAclDlg::CCopyAclDlg(CWnd
* pParent
/*=NULL*/)
38 InitModalIndirect (TaLocale_GetDialogResource (CCopyAclDlg::IDD
), pParent
);
40 //{{AFX_DATA_INIT(CCopyAclDlg)
41 // NOTE: the ClassWizard will add member initialization here
48 void CCopyAclDlg::DoDataExchange(CDataExchange
* pDX
)
50 CDialog::DoDataExchange(pDX
);
51 //{{AFX_DATA_MAP(CCopyAclDlg)
52 DDX_Control(pDX
, IDOK
, m_Ok
);
53 DDX_Control(pDX
, IDC_FROM_DIR
, m_FromDir
);
54 DDX_Control(pDX
, IDC_TO_DIR
, m_ToDir
);
55 DDX_Control(pDX
, IDC_CLEAR
, m_Clear
);
60 BEGIN_MESSAGE_MAP(CCopyAclDlg
, CDialog
)
61 //{{AFX_MSG_MAP(CCopyAclDlg)
62 ON_EN_CHANGE(IDC_TO_DIR
, OnChangeToDir
)
63 ON_BN_CLICKED(IDC_BROWSE
, OnBrowse
)
64 ON_BN_CLICKED(IDHELP
, OnHelp
)
68 /////////////////////////////////////////////////////////////////////////////
69 // CCopyAclDlg message handlers
71 void CCopyAclDlg::OnOK()
73 m_bClear
= m_Clear
.GetCheck() == 1;
74 m_ToDir
.GetWindowText(m_strToDir
);
76 if (PathIsDirectory(m_strToDir
) == -1) {
77 ShowMessageBox(IDS_DIR_DOES_NOT_EXIST_ERROR
, MB_ICONEXCLAMATION
, IDS_DIR_DOES_NOT_EXIST_ERROR
, m_strToDir
);
84 BOOL
CCopyAclDlg::OnInitDialog()
86 CDialog::OnInitDialog();
88 m_FromDir
.SetWindowText(m_strFromDir
);
90 return TRUE
; // return TRUE unless you set the focus to a control
91 // EXCEPTION: OCX Property Pages should return FALSE
94 void CCopyAclDlg::OnChangeToDir()
96 m_ToDir
.GetWindowText(m_strToDir
);
98 BOOL bEnable
= m_strToDir
.GetLength() > 0;
99 m_Ok
.EnableWindow(bEnable
);
102 void CCopyAclDlg::OnBrowse()
104 CFileDialog
dlg(TRUE
, 0, TEXT("*.*"), OFN_FILEMUSTEXIST
| OFN_PATHMUSTEXIST
| OFN_NOCHANGEDIR
| OFN_HIDEREADONLY
, 0, 0);
106 if (dlg
.DoModal() == IDCANCEL
)
109 CString strPath
= dlg
.GetPathName();
111 // Remove file name (last component of path)
112 int nFirstSlash
= strPath
.Find('\\');
113 int nLastSlash
= strPath
.ReverseFind('\\');
114 if (nFirstSlash
!= nLastSlash
)
115 strPath
= strPath
.Left(nLastSlash
);
117 strPath
= strPath
.Left(nFirstSlash
+ 1);
119 m_ToDir
.SetWindowText(strPath
);
122 void CCopyAclDlg::OnHelp()
124 ShowHelp(m_hWnd
, COPY_ACL_HELP_ID
);