-
Notifications
You must be signed in to change notification settings - Fork 1
/
FtpAdvancedDialog.cpp
106 lines (84 loc) · 2.94 KB
/
FtpAdvancedDialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// FtpAdvancedDialog.cpp : implementation file
//
#include "stdafx.h"
#include "resource.h"
#include "cedtElement.h"
#include "FtpAdvancedDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFtpAdvancedDialog dialog
CFtpAdvancedDialog::CFtpAdvancedDialog(CWnd* pParent /*=NULL*/)
: CDialog(CFtpAdvancedDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CFtpAdvancedDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CFtpAdvancedDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFtpAdvancedDialog)
DDX_Control(pDX, IDC_DEFAULT_PORT, m_chkDefaultPort);
DDX_Control(pDX, IDC_PORT_NUMBER, m_edtPortNumber);
DDX_Control(pDX, IDC_PASSIVE_MODE, m_chkPassiveMode);
DDX_Control(pDX, IDC_USE_WININET, m_chkUseWinInet);
DDX_Control(pDX, IDC_SERVER_TYPE, m_cmbServerType);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFtpAdvancedDialog, CDialog)
//{{AFX_MSG_MAP(CFtpAdvancedDialog)
ON_CBN_SELCHANGE(IDC_SERVER_TYPE, OnSelchangeServerType)
ON_BN_CLICKED(IDC_USE_WININET, OnUseWininet)
ON_BN_CLICKED(IDC_PASSIVE_MODE, OnPassiveMode)
ON_EN_CHANGE(IDC_PORT_NUMBER, OnChangePortNumber)
ON_BN_CLICKED(IDC_DEFAULT_PORT, OnDefaultPort)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFtpAdvancedDialog message handlers
BOOL CFtpAdvancedDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_cmbServerType.InsertString(0, "Generic FTP Server");
// m_cmbServerType.InsertString(1, "Hewlett-Packard Server");
// m_cmbServerType.InsertString(2, "Sun Microsystems Server");
m_cmbServerType.SetCurSel( m_nServerType );
m_cmbServerType.EnableWindow( ! m_bUseWinInet );
m_chkUseWinInet.SetCheck( m_bUseWinInet );
m_chkPassiveMode.SetCheck( m_bPassiveMode );
CString szPortNumber; szPortNumber.Format("%d", m_nPortNumber );
m_edtPortNumber.SetWindowText( szPortNumber );
BOOL bDefaultPort = ( m_nPortNumber == 21 );
m_edtPortNumber.EnableWindow( ! bDefaultPort );
m_chkDefaultPort.SetCheck( bDefaultPort );
return TRUE;
}
void CFtpAdvancedDialog::OnSelchangeServerType()
{
m_nServerType = m_cmbServerType.GetCurSel();
}
void CFtpAdvancedDialog::OnUseWininet()
{
m_bUseWinInet = m_chkUseWinInet.GetCheck();
if( m_bUseWinInet ) m_cmbServerType.SetCurSel( m_nServerType = 0 );
m_cmbServerType.EnableWindow( ! m_bUseWinInet );
}
void CFtpAdvancedDialog::OnPassiveMode()
{
m_bPassiveMode = m_chkPassiveMode.GetCheck();
}
void CFtpAdvancedDialog::OnChangePortNumber()
{
CString szPortNumber; m_edtPortNumber.GetWindowText( szPortNumber );
m_nPortNumber = atoi( szPortNumber );
}
void CFtpAdvancedDialog::OnDefaultPort()
{
BOOL bDefaultPort = m_chkDefaultPort.GetCheck();
if( bDefaultPort ) { m_nPortNumber = 21; m_edtPortNumber.SetWindowText( "21" ); }
m_edtPortNumber.EnableWindow( ! bDefaultPort );
}