source: filezilla/trunk/fuentes/src/interface/settings/optionspage_connection.cpp @ 3185

Last change on this file since 3185 was 3185, checked in by jrpelegrina, 2 years ago

Update new version: 3.15.02

File size: 1.9 KB
Line 
1#include <filezilla.h>
2#include "../Options.h"
3#include "settingsdialog.h"
4#include "optionspage.h"
5#include "optionspage_connection.h"
6#include "../netconfwizard.h"
7
8BEGIN_EVENT_TABLE(COptionsPageConnection, COptionsPage)
9EVT_BUTTON(XRCID("ID_RUNWIZARD"), COptionsPageConnection::OnWizard)
10END_EVENT_TABLE()
11
12bool COptionsPageConnection::LoadPage()
13{
14        bool failure = false;
15        SetTextFromOption(XRCID("ID_RETRIES"), OPTION_RECONNECTCOUNT, failure);
16        SetTextFromOption(XRCID("ID_RETRYDELAY"), OPTION_RECONNECTDELAY, failure);
17        SetTextFromOption(XRCID("ID_TIMEOUT"), OPTION_TIMEOUT, failure);
18        return !failure;
19}
20
21bool COptionsPageConnection::SavePage()
22{
23        SetIntOptionFromText(XRCID("ID_RETRIES"), OPTION_RECONNECTCOUNT);
24        SetIntOptionFromText(XRCID("ID_RETRYDELAY"), OPTION_RECONNECTDELAY);
25        SetOptionFromText(XRCID("ID_TIMEOUT"), OPTION_TIMEOUT);
26        return true;
27}
28
29bool COptionsPageConnection::Validate()
30{
31        wxTextCtrl* pRetries = XRCCTRL(*this, "ID_RETRIES", wxTextCtrl);
32
33        long retries;
34        if (!pRetries->GetValue().ToLong(&retries) || retries < 0 || retries > 99)
35                return DisplayError(pRetries, _("Number of retries has to be between 0 and 99."));
36
37        wxTextCtrl* pDelay = XRCCTRL(*this, "ID_RETRYDELAY", wxTextCtrl);
38
39        long delay;
40        if (!pDelay->GetValue().ToLong(&delay) || delay < 0 || delay > 999)
41                return DisplayError(pDelay, _("Delay between failed connection attempts has to be between 1 and 999 seconds."));
42
43        long timeout;
44        wxTextCtrl *pTimeout = XRCCTRL(*this, "ID_TIMEOUT", wxTextCtrl);
45        if (!pTimeout->GetValue().ToLong(&timeout) || ((timeout < 10 || timeout > 9999) && timeout != 0))
46                return DisplayError(pTimeout, _("Please enter a timeout between 10 and 9999 seconds or 0 to disable timeouts."));
47
48        return true;
49}
50
51void COptionsPageConnection::OnWizard(wxCommandEvent&)
52{
53        CNetConfWizard wizard(GetParent(), m_pOptions, m_pOwner->GetEngineContext());
54        if (!wizard.Load())
55                return;
56        if (wizard.Run())
57                ReloadSettings();
58}
Note: See TracBrowser for help on using the repository browser.