Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / client_exp / make_mount_point_dlg.cpp
blob5b619caedbe827eff0ddb3f2a892b9e03a8cdd9a
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 <winsock2.h>
12 #include <ws2tcpip.h>
14 extern "C" {
15 #include <afs/param.h>
16 #include <afs/stds.h>
19 #include "afs_shl_ext.h"
20 #include "make_mount_point_dlg.h"
21 #include "gui2fs.h"
23 #ifdef _DEBUG
24 #define new DEBUG_NEW
25 #undef THIS_FILE
26 static char THIS_FILE[] = __FILE__;
27 #endif
29 /////////////////////////////////////////////////////////////////////////////
30 // CMakeMountPointDlg dialog
33 CMakeMountPointDlg::CMakeMountPointDlg(CWnd* pParent /*=NULL*/)
34 : CDialog()
36 InitModalIndirect (TaLocale_GetDialogResource (CMakeMountPointDlg::IDD), pParent);
38 //{{AFX_DATA_INIT(CMakeMountPointDlg)
39 m_nType = -1;
40 //}}AFX_DATA_INIT
42 m_bMade = FALSE;
46 void CMakeMountPointDlg::DoDataExchange(CDataExchange* pDX)
48 CDialog::DoDataExchange(pDX);
49 //{{AFX_DATA_MAP(CMakeMountPointDlg)
50 DDX_Control(pDX, IDOK, m_Ok);
51 DDX_Control(pDX, IDC_VOLUME, m_Vol);
52 DDX_Control(pDX, IDC_RW, m_RW);
53 DDX_Control(pDX, IDC_DIR, m_Dir);
54 DDX_Control(pDX, IDC_CELL, m_Cell);
55 DDX_Radio(pDX, IDC_REGULAR, m_nType);
56 //}}AFX_DATA_MAP
60 BEGIN_MESSAGE_MAP(CMakeMountPointDlg, CDialog)
61 //{{AFX_MSG_MAP(CMakeMountPointDlg)
62 ON_EN_CHANGE(IDC_VOLUME, OnChangeVolume)
63 ON_EN_CHANGE(IDC_DIR, OnChangeDir)
64 ON_EN_CHANGE(IDC_CELL, OnChangeCell)
65 ON_BN_CLICKED(IDHELP, OnHelp)
66 //}}AFX_MSG_MAP
67 END_MESSAGE_MAP()
69 /////////////////////////////////////////////////////////////////////////////
70 // CMakeMountPointDlg message handlers
72 void CMakeMountPointDlg::OnOK()
74 UpdateData(TRUE);
76 BOOL bRW = m_nType == 1;
78 m_bMade = MakeMount(m_strDir, m_strVol, m_strCell, bRW);
80 CDialog::OnOK();
83 void CMakeMountPointDlg::OnChangeVolume()
85 CString strVol;
86 m_Vol.GetWindowText(strVol);
87 if (strVol.GetLength() > 63) {
88 MessageBeep((UINT)-1);
89 m_Vol.SetWindowText(m_strVol);
90 } else
91 m_strVol = strVol;
93 CheckEnableOk();
96 void CMakeMountPointDlg::OnChangeDir()
98 m_Dir.GetWindowText(m_strDir);
100 CheckEnableOk();
103 void CMakeMountPointDlg::OnChangeCell()
105 m_Cell.GetWindowText(m_strCell);
107 CheckEnableOk();
110 void CMakeMountPointDlg::CheckEnableOk()
112 BOOL bEnable = FALSE;
114 if ((m_strVol.GetLength() > 0) && (m_strDir.GetLength() > 0))
115 bEnable = TRUE;
117 m_Ok.EnableWindow(bEnable);
120 BOOL CMakeMountPointDlg::OnInitDialog()
122 CDialog::OnInitDialog();
124 m_Dir.SetWindowText(m_strDir);
126 m_nType = 0;
128 UpdateData(FALSE);
130 return TRUE; // return TRUE unless you set the focus to a control
131 // EXCEPTION: OCX Property Pages should return FALSE
134 void CMakeMountPointDlg::OnHelp()
136 ShowHelp(m_hWnd, MAKE_MOUNT_POINT_HELP_ID);