LINUX: afs_create infinite fetchStatus loop
[pkg-k5-afs_openafs.git] / src / WINNT / client_exp / copy_acl_dlg.cpp
blob0c98a33ca1e6b4e7a75ca9c8cd3dec8b0fd61d74
1 /*
2 * Copyright 2000, International Business Machines Corporation and others.
3 * All Rights Reserved.
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
8 */
10 #include "stdafx.h"
11 #include <shlwapi.h>
12 #include <winsock2.h>
13 #include <ws2tcpip.h>
15 extern "C" {
16 #include <afs/param.h>
17 #include <afs/stds.h>
20 #include "afs_shl_ext.h"
21 #include "copy_acl_dlg.h"
22 #include "io.h"
23 #include "msgs.h"
25 #ifdef _DEBUG
26 #define new DEBUG_NEW
27 #undef THIS_FILE
28 static char THIS_FILE[] = __FILE__;
29 #endif
31 /////////////////////////////////////////////////////////////////////////////
32 // CCopyAclDlg dialog
35 CCopyAclDlg::CCopyAclDlg(CWnd* pParent /*=NULL*/)
36 : CDialog()
38 InitModalIndirect (TaLocale_GetDialogResource (CCopyAclDlg::IDD), pParent);
40 //{{AFX_DATA_INIT(CCopyAclDlg)
41 // NOTE: the ClassWizard will add member initialization here
42 //}}AFX_DATA_INIT
44 m_bClear = FALSE;
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);
56 //}}AFX_DATA_MAP
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)
65 //}}AFX_MSG_MAP
66 END_MESSAGE_MAP()
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);
78 return;
81 CDialog::OnOK();
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)
107 return;
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);
116 else
117 strPath = strPath.Left(nFirstSlash + 1);
119 m_ToDir.SetWindowText(strPath);
122 void CCopyAclDlg::OnHelp()
124 ShowHelp(m_hWnd, COPY_ACL_HELP_ID);