"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/interface/settings/optionspage_connection.cpp" between
FileZilla_3.48.0_src.tar.bz2 and FileZilla_3.48.1_src.tar.bz2

About: FileZilla is a fast and feature-rich cross-platform FTP, FTPS and SFTP client with an intuitive graphical user interface.

optionspage_connection.cpp  (FileZilla_3.48.0_src.tar.bz2):optionspage_connection.cpp  (FileZilla_3.48.1_src.tar.bz2)
#include <filezilla.h> #include <filezilla.h>
#include "../Options.h"
#include "settingsdialog.h" #include "settingsdialog.h"
#include "optionspage.h" #include "optionspage.h"
#include "optionspage_connection.h" #include "optionspage_connection.h"
#include "../netconfwizard.h"
BEGIN_EVENT_TABLE(COptionsPageConnection, COptionsPage) #include "../Options.h"
EVT_BUTTON(XRCID("ID_RUNWIZARD"), COptionsPageConnection::OnWizard) #include "../textctrlex.h"
END_EVENT_TABLE()
bool COptionsPageConnection::LoadPage() #include <wx/statbox.h>
struct COptionsPageConnection::impl
{
wxTextCtrlEx* timeout_{};
wxTextCtrlEx* tries_{};
wxTextCtrlEx* delay_{};
};
COptionsPageConnection::COptionsPageConnection()
: impl_(std::make_unique<impl>())
{ {
bool failure = false;
SetTextFromOption(XRCID("ID_RETRIES"), OPTION_RECONNECTCOUNT, failure);
SetTextFromOption(XRCID("ID_RETRYDELAY"), OPTION_RECONNECTDELAY, failure)
;
SetTextFromOption(XRCID("ID_TIMEOUT"), OPTION_TIMEOUT, failure);
return !failure;
} }
bool COptionsPageConnection::SavePage() COptionsPageConnection::~COptionsPageConnection()
{ {
SetIntOptionFromText(XRCID("ID_RETRIES"), OPTION_RECONNECTCOUNT);
SetIntOptionFromText(XRCID("ID_RETRYDELAY"), OPTION_RECONNECTDELAY);
SetOptionFromText(XRCID("ID_TIMEOUT"), OPTION_TIMEOUT);
return true;
} }
bool COptionsPageConnection::Validate() bool COptionsPageConnection::CreateControls(wxWindow* parent)
{ {
wxTextCtrl* pRetries = XRCCTRL(*this, "ID_RETRIES", wxTextCtrl); auto const& lay = m_pOwner->layout();
Create(parent);
auto main = lay.createFlex(1);
main->AddGrowableCol(0);
SetSizer(main);
{
auto [box, inner] = lay.createStatBox(main, _("Timeout"), 1);
auto row = lay.createFlex(3);
inner->Add(row);
row->Add(new wxStaticText(box, -1, _("Time&out in seconds:")), la
y.valign);
impl_->timeout_ = new wxTextCtrlEx(box, -1, wxString(), wxDefault
Position, wxSize(lay.dlgUnits(22), -1));
impl_->timeout_->SetMaxLength(4);
row->Add(impl_->timeout_, lay.valign);
row->Add(new wxStaticText(box, -1, _("(10-9999, 0 to disable)")),
lay.valign);
inner->Add(new wxStaticText(box, -1, _("If no data is sent or rec
eived during an operation for longer than the specified time, the connection wil
l be closed and FileZilla will try to reconnect.")));
}
{
auto [box, inner] = lay.createStatBox(main, _("Reconnection setti
ngs"), 1);
auto rows = lay.createFlex(3);
inner->Add(rows);
rows->Add(new wxStaticText(box, -1, _("&Maximum number of retries
:")), lay.valign);
impl_->tries_ = new wxTextCtrlEx(box, -1, wxString(), wxDefaultPo
sition, wxSize(lay.dlgUnits(22), -1));
impl_->tries_->SetMaxLength(2);
rows->Add(impl_->tries_, lay.valign);
rows->Add(new wxStaticText(box, -1, _("(0-99)")), lay.valign);
rows->Add(new wxStaticText(box, -1, _("&Delay between failed logi
n attempts:")), lay.valign);
impl_->delay_ = new wxTextCtrlEx(box, -1, wxString(), wxDefaultPo
sition, wxSize(lay.dlgUnits(22), -1));
impl_->delay_->SetMaxLength(3);
rows->Add(impl_->delay_, lay.valign);
rows->Add(new wxStaticText(box, -1, _("(0-999 seconds)")), lay.va
lign);
inner->Add(new wxStaticText(box, -1, _("Please note that some ser
vers might ban you if you try to reconnect too often or in too short intervals."
)));
}
return true;
}
long retries; bool COptionsPageConnection::LoadPage()
if (!pRetries->GetValue().ToLong(&retries) || retries < 0 || retries > 99 {
) impl_->timeout_->ChangeValue(fz::to_wstring(m_pOptions->GetOptionVal(OPTI
return DisplayError(pRetries, _("Number of retries has to be betw ON_TIMEOUT)));
een 0 and 99.")); impl_->tries_->ChangeValue(fz::to_wstring(m_pOptions->GetOptionVal(OPTION
_RECONNECTCOUNT)));
wxTextCtrl* pDelay = XRCCTRL(*this, "ID_RETRYDELAY", wxTextCtrl); impl_->delay_->ChangeValue(fz::to_wstring(m_pOptions->GetOptionVal(OPTION
_RECONNECTDELAY)));
long delay; return true;
if (!pDelay->GetValue().ToLong(&delay) || delay < 0 || delay > 999) }
return DisplayError(pDelay, _("Delay between failed connection at
tempts has to be between 1 and 999 seconds."));
long timeout;
wxTextCtrl *pTimeout = XRCCTRL(*this, "ID_TIMEOUT", wxTextCtrl);
if (!pTimeout->GetValue().ToLong(&timeout) || ((timeout < 10 || timeout >
9999) && timeout != 0))
return DisplayError(pTimeout, _("Please enter a timeout between 1
0 and 9999 seconds or 0 to disable timeouts."));
bool COptionsPageConnection::SavePage()
{
m_pOptions->SetOption(OPTION_TIMEOUT, impl_->timeout_->GetValue().ToStdWs
tring());
m_pOptions->SetOption(OPTION_RECONNECTCOUNT, impl_->tries_->GetValue().To
StdWstring());
m_pOptions->SetOption(OPTION_RECONNECTDELAY, impl_->delay_->GetValue().To
StdWstring());
return true; return true;
} }
void COptionsPageConnection::OnWizard(wxCommandEvent&) bool COptionsPageConnection::Validate()
{ {
CNetConfWizard wizard(GetParent(), m_pOptions, m_pOwner->GetEngineContext auto const timeout = fz::to_integral<int>(impl_->timeout_->GetValue().ToS
()); tdWstring(), -1);
if (!wizard.Load()) if (timeout != 0 && (timeout < 10 || timeout > 9999)) {
return; return DisplayError(impl_->timeout_, _("Please enter a timeout be
if (wizard.Run()) tween 10 and 9999 seconds or 0 to disable timeouts."));
ReloadSettings(); }
auto const retries = fz::to_integral<int>(impl_->tries_->GetValue().ToStd
Wstring(), -1);
if (retries < 0 || retries > 99) {
return DisplayError(impl_->tries_, _("Number of retries has to be
between 0 and 99."));
}
auto const delay = fz::to_integral<int>(impl_->delay_->GetValue().ToStdWs
tring(), -1);
if (delay < 0 || delay > 999) {
return DisplayError(impl_->delay_, _("Delay between failed connec
tion attempts has to be between 1 and 999 seconds."));
}
return true;
} }
 End of changes. 13 change blocks. 
45 lines changed or deleted 106 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)