Update NEWS for 1.6.22
[pkg-k5-afs_openafs.git] / src / WINNT / client_exp / add_submount_dlg.cpp
blob13dc407503cd34fad61a9659f7ddb990f03598b6
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 "add_submount_dlg.h"
20 #include "submount_info.h"
21 #include "help.h"
22 #include "msgs.h"
24 #ifdef _DEBUG
25 #define new DEBUG_NEW
26 #undef THIS_FILE
27 static char THIS_FILE[] = __FILE__;
28 #endif
30 /////////////////////////////////////////////////////////////////////////////
31 // CAddSubmtDlg dialog
34 CAddSubmtDlg::CAddSubmtDlg(CWnd* pParent /*=NULL*/)
35 : CDialog()
37 InitModalIndirect (TaLocale_GetDialogResource (CAddSubmtDlg::IDD), pParent);
39 //{{AFX_DATA_INIT(CAddSubmtDlg)
40 m_strShareName = _T("");
41 m_strPathName = _T("");
42 //}}AFX_DATA_INIT
44 m_bAdd = TRUE;
45 m_bSave = FALSE;
49 void CAddSubmtDlg::DoDataExchange(CDataExchange* pDX)
51 CDialog::DoDataExchange(pDX);
52 //{{AFX_DATA_MAP(CAddSubmtDlg)
53 DDX_Control(pDX, IDOK, m_Ok);
54 DDX_Text(pDX, IDC_SHARE_NAME, m_strShareName);
55 DDX_Text(pDX, IDC_PATH_NAME, m_strPathName);
56 //}}AFX_DATA_MAP
60 BEGIN_MESSAGE_MAP(CAddSubmtDlg, CDialog)
61 //{{AFX_MSG_MAP(CAddSubmtDlg)
62 ON_EN_CHANGE(IDC_SHARE_NAME, OnChangeShareName)
63 ON_EN_CHANGE(IDC_PATH_NAME, OnChangePathName)
64 ON_BN_CLICKED(IDHELP, OnHelp)
65 //}}AFX_MSG_MAP
66 END_MESSAGE_MAP()
68 /////////////////////////////////////////////////////////////////////////////
69 // CAddSubmtDlg message handlers
71 BOOL CAddSubmtDlg::OnInitDialog()
73 CDialog::OnInitDialog();
75 if (!m_bAdd) {
76 SetWindowText(GetMessageString(IDS_EDIT_PATH_NAME));
77 ((CEdit *)GetDlgItem(IDC_SHARE_NAME))->EnableWindow(FALSE);
80 return TRUE; // return TRUE unless you set the focus to a control
81 // EXCEPTION: OCX Property Pages should return FALSE
84 void CAddSubmtDlg::CheckEnableOk()
86 UpdateData(TRUE);
88 m_Ok.EnableWindow(!m_strShareName.IsEmpty() && !m_strPathName.IsEmpty());
91 void CAddSubmtDlg::OnChangeShareName()
93 CheckEnableOk();
96 void CAddSubmtDlg::OnChangePathName()
98 CheckEnableOk();
101 void CAddSubmtDlg::OnOK()
103 UpdateData(TRUE);
105 m_bSave = TRUE;
107 CDialog::OnOK();
110 void CAddSubmtDlg::SetSubmtInfo(CSubmountInfo *pInfo)
112 ASSERT_VALID(pInfo);
114 m_strShareName = pInfo->GetShareName();
115 m_strPathName = pInfo->GetPathName();
118 CSubmountInfo *CAddSubmtDlg::GetSubmtInfo()
120 if (!m_bSave)
121 return 0;
123 SUBMT_INFO_STATUS status;
125 if (m_bAdd)
126 status = SIS_ADDED;
127 else
128 status = SIS_CHANGED;
130 return new CSubmountInfo(m_strShareName, m_strPathName, status);
133 void CAddSubmtDlg::OnHelp()
135 ShowHelp(m_hWnd, (m_bAdd ? ADD_SUBMT_HELP_ID : EDIT_PATH_NAME_HELP_ID));