Lines 85-90
Link Here
|
85 |
{ |
85 |
{ |
86 |
wxXmlResource::Get()->LoadDialog(this, GetParent(), _T("ID_SITEMANAGER")); |
86 |
wxXmlResource::Get()->LoadDialog(this, GetParent(), _T("ID_SITEMANAGER")); |
87 |
|
87 |
|
|
|
88 |
wxChoice *pProtocol = XRCCTRL(*this, "ID_PROTOCOL", wxChoice); |
89 |
pProtocol->Append(CServer::GetProtocolName(FTP)); |
90 |
pProtocol->Append(CServer::GetProtocolName(SFTP)); |
91 |
pProtocol->Append(CServer::GetProtocolName(FTPS)); |
92 |
pProtocol->Append(CServer::GetProtocolName(FTPES)); |
93 |
|
88 |
wxChoice *pChoice = XRCCTRL(*this, "ID_SERVERTYPE", wxChoice); |
94 |
wxChoice *pChoice = XRCCTRL(*this, "ID_SERVERTYPE", wxChoice); |
89 |
wxASSERT(pChoice); |
95 |
wxASSERT(pChoice); |
90 |
pChoice->Append(_T("Unix")); |
96 |
pChoice->Append(_T("Unix")); |
Lines 414-421
Link Here
|
414 |
return false; |
420 |
return false; |
415 |
} |
421 |
} |
416 |
|
422 |
|
417 |
const wxString& protocol = XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->GetStringSelection(); |
423 |
wxString protocolName = XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->GetStringSelection(); |
418 |
if (protocol == _("SFTP") && |
424 |
enum ServerProtocol protocol = CServer::GetProtocolFromName(protocolName); |
|
|
425 |
if (protocol == SFTP && |
419 |
XRCCTRL(*this, "ID_LOGONTYPE", wxChoice)->GetStringSelection() == _("Account")) |
426 |
XRCCTRL(*this, "ID_LOGONTYPE", wxChoice)->GetStringSelection() == _("Account")) |
420 |
{ |
427 |
{ |
421 |
XRCCTRL(*this, "ID_LOGONTYPE", wxChoice)->SetFocus(); |
428 |
XRCCTRL(*this, "ID_LOGONTYPE", wxChoice)->SetFocus(); |
Lines 424-433
Link Here
|
424 |
} |
431 |
} |
425 |
|
432 |
|
426 |
CServer server; |
433 |
CServer server; |
427 |
if (protocol == _("FTP")) |
434 |
if (protocol != UNKNOWN) |
428 |
server.SetProtocol(FTP); |
435 |
server.SetProtocol(protocol); |
429 |
else if (protocol == _("SFTP")) |
|
|
430 |
server.SetProtocol(SFTP); |
431 |
|
436 |
|
432 |
unsigned long port; |
437 |
unsigned long port; |
433 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->GetValue().ToULong(&port); |
438 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->GetValue().ToULong(&port); |
Lines 443-458
Link Here
|
443 |
XRCCTRL(*this, "ID_HOST", wxTextCtrl)->SetValue(server.GetHost()); |
448 |
XRCCTRL(*this, "ID_HOST", wxTextCtrl)->SetValue(server.GetHost()); |
444 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), server.GetPort())); |
449 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->SetValue(wxString::Format(_T("%d"), server.GetPort())); |
445 |
|
450 |
|
446 |
switch (server.GetProtocol()) |
451 |
protocolName = CServer::GetProtocolName(server.GetProtocol()); |
447 |
{ |
452 |
if (protocolName == _T("")) |
448 |
case SFTP: |
453 |
CServer::GetProtocolName(FTP); |
449 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(_("SFTP")); |
454 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(protocolName); |
450 |
break; |
|
|
451 |
case FTP: |
452 |
default: |
453 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(_("FTP")); |
454 |
break; |
455 |
} |
456 |
|
455 |
|
457 |
if (XRCCTRL(*this, "ID_CHARSET_CUSTOM", wxRadioButton)->GetValue()) |
456 |
if (XRCCTRL(*this, "ID_CHARSET_CUSTOM", wxRadioButton)->GetValue()) |
458 |
{ |
457 |
{ |
Lines 664-674
Link Here
|
664 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->GetValue().ToULong(&port); |
663 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->GetValue().ToULong(&port); |
665 |
data->m_server.SetHost(XRCCTRL(*this, "ID_HOST", wxTextCtrl)->GetValue(), port); |
664 |
data->m_server.SetHost(XRCCTRL(*this, "ID_HOST", wxTextCtrl)->GetValue(), port); |
666 |
|
665 |
|
667 |
wxString protocol = XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->GetStringSelection(); |
666 |
const wxString& protocolName = XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->GetStringSelection(); |
668 |
if (protocol == _("FTP")) |
667 |
const enum ServerProtocol protocol = CServer::GetProtocolFromName(protocolName); |
669 |
data->m_server.SetProtocol(FTP); |
668 |
if (protocol != UNKNOWN) |
670 |
else if (protocol == _("SFTP")) |
669 |
data->m_server.SetProtocol(protocol); |
671 |
data->m_server.SetProtocol(SFTP); |
|
|
672 |
else |
670 |
else |
673 |
data->m_server.SetProtocol(FTP); |
671 |
data->m_server.SetProtocol(FTP); |
674 |
|
672 |
|
Lines 863-878
Link Here
|
863 |
else |
861 |
else |
864 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->SetValue(_T("")); |
862 |
XRCCTRL(*this, "ID_PORT", wxTextCtrl)->SetValue(_T("")); |
865 |
|
863 |
|
866 |
switch (data->m_server.GetProtocol()) |
864 |
const wxString& protocolName = CServer::GetProtocolName(data->m_server.GetProtocol()); |
867 |
{ |
865 |
if (protocolName != _T("")) |
868 |
case SFTP: |
866 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(protocolName); |
869 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(_("SFTP")); |
867 |
else |
870 |
break; |
868 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(CServer::GetProtocolName(FTP)); |
871 |
case FTP: |
|
|
872 |
default: |
873 |
XRCCTRL(*this, "ID_PROTOCOL", wxChoice)->SetStringSelection(_("FTP")); |
874 |
break; |
875 |
} |
876 |
|
869 |
|
877 |
XRCCTRL(*this, "ID_USER", wxTextCtrl)->Enable(data->m_server.GetLogonType() != ANONYMOUS); |
870 |
XRCCTRL(*this, "ID_USER", wxTextCtrl)->Enable(data->m_server.GetLogonType() != ANONYMOUS); |
878 |
XRCCTRL(*this, "ID_PASS", wxTextCtrl)->Enable(data->m_server.GetLogonType() == NORMAL || data->m_server.GetLogonType() == ACCOUNT); |
871 |
XRCCTRL(*this, "ID_PASS", wxTextCtrl)->Enable(data->m_server.GetLogonType() == NORMAL || data->m_server.GetLogonType() == ACCOUNT); |