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

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

Update new version: 3.15.02

File size: 3.5 KB
Line 
1#include <filezilla.h>
2#include "../Options.h"
3#include "settingsdialog.h"
4#include "optionspage.h"
5#include "optionspage_interface.h"
6#include "../Mainfrm.h"
7#include "../power_management.h"
8
9BEGIN_EVENT_TABLE(COptionsPageInterface, COptionsPage)
10EVT_CHECKBOX(XRCID("ID_FILEPANESWAP"), COptionsPageInterface::OnLayoutChange)
11EVT_CHOICE(XRCID("ID_FILEPANELAYOUT"), COptionsPageInterface::OnLayoutChange)
12EVT_CHOICE(XRCID("ID_MESSAGELOGPOS"), COptionsPageInterface::OnLayoutChange)
13END_EVENT_TABLE()
14
15bool COptionsPageInterface::LoadPage()
16{
17        bool failure = false;
18
19        SetCheckFromOption(XRCID("ID_FILEPANESWAP"), OPTION_FILEPANE_SWAP, failure);
20        SetChoice(XRCID("ID_FILEPANELAYOUT"), m_pOptions->GetOptionVal(OPTION_FILEPANE_LAYOUT), failure);
21
22        SetChoice(XRCID("ID_MESSAGELOGPOS"), m_pOptions->GetOptionVal(OPTION_MESSAGELOG_POSITION), failure);
23
24#ifndef __WXMAC__
25        SetCheckFromOption(XRCID("ID_MINIMIZE_TRAY"), OPTION_MINIMIZE_TRAY, failure);
26#endif
27
28        SetCheckFromOption(XRCID("ID_PREVENT_IDLESLEEP"), OPTION_PREVENT_IDLESLEEP, failure);
29
30        SetCheckFromOption(XRCID("ID_SPEED_DISPLAY"), OPTION_SPEED_DISPLAY, failure);
31
32        if (!CPowerManagement::IsSupported())
33                XRCCTRL(*this, "ID_PREVENT_IDLESLEEP", wxCheckBox)->Hide();
34
35        if (m_pOptions->OptionFromFzDefaultsXml(OPTION_DEFAULT_KIOSKMODE) || m_pOptions->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 2)
36        {
37                XRCCTRL(*this, "ID_DONT_SAVE_PASSWORDS", wxCheckBox)->SetValue(true);
38                XRCCTRL(*this, "ID_DONT_SAVE_PASSWORDS", wxCheckBox)->Disable();
39        }
40        else
41                SetCheckFromOption(XRCID("ID_DONT_SAVE_PASSWORDS"), OPTION_DEFAULT_KIOSKMODE, failure);
42
43        SetCheckFromOption(XRCID("ID_INTERFACE_SITEMANAGER_ON_STARTUP"), OPTION_INTERFACE_SITEMANAGER_ON_STARTUP, failure);
44
45        int action = m_pOptions->GetOptionVal(OPTION_ALREADYCONNECTED_CHOICE);
46        if( action & 2 ) {
47                action = 1 + (action & 1);
48        }
49        else {
50                action = 0;
51        }
52        SetChoice(XRCID("ID_NEWCONN_ACTION"), action, failure);
53
54        m_pOwner->RememberOldValue(OPTION_MESSAGELOG_POSITION);
55        m_pOwner->RememberOldValue(OPTION_FILEPANE_LAYOUT);
56        m_pOwner->RememberOldValue(OPTION_FILEPANE_SWAP);
57
58        return !failure;
59}
60
61bool COptionsPageInterface::SavePage()
62{
63        SetOptionFromCheck(XRCID("ID_FILEPANESWAP"), OPTION_FILEPANE_SWAP);
64        m_pOptions->SetOption(OPTION_FILEPANE_LAYOUT, GetChoice(XRCID("ID_FILEPANELAYOUT")));
65
66        m_pOptions->SetOption(OPTION_MESSAGELOG_POSITION, GetChoice(XRCID("ID_MESSAGELOGPOS")));
67
68#ifndef __WXMAC__
69        SetOptionFromCheck(XRCID("ID_MINIMIZE_TRAY"), OPTION_MINIMIZE_TRAY);
70#endif
71
72        SetOptionFromCheck(XRCID("ID_PREVENT_IDLESLEEP"), OPTION_PREVENT_IDLESLEEP);
73
74        SetOptionFromCheck(XRCID("ID_SPEED_DISPLAY"), OPTION_SPEED_DISPLAY);
75
76        if (!m_pOptions->OptionFromFzDefaultsXml(OPTION_DEFAULT_KIOSKMODE) && m_pOptions->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) != 2)
77                SetOptionFromCheck(XRCID("ID_DONT_SAVE_PASSWORDS"), OPTION_DEFAULT_KIOSKMODE);
78
79        SetOptionFromCheck(XRCID("ID_INTERFACE_SITEMANAGER_ON_STARTUP"), OPTION_INTERFACE_SITEMANAGER_ON_STARTUP);
80
81        int action = GetChoice(XRCID("ID_NEWCONN_ACTION"));
82        if( !action ) {
83                action = m_pOptions->GetOptionVal(OPTION_ALREADYCONNECTED_CHOICE) & 1;
84        }
85        else {
86                action += 1;
87        }
88        m_pOptions->SetOption(OPTION_ALREADYCONNECTED_CHOICE, action);
89
90        return true;
91}
92
93bool COptionsPageInterface::Validate()
94{
95        return true;
96}
97
98void COptionsPageInterface::OnLayoutChange(wxCommandEvent&)
99{
100        m_pOptions->SetOption(OPTION_FILEPANE_LAYOUT, GetChoice(XRCID("ID_FILEPANELAYOUT")));
101        m_pOptions->SetOption(OPTION_FILEPANE_SWAP, GetCheck(XRCID("ID_FILEPANESWAP")) ? 1 : 0);
102        m_pOptions->SetOption(OPTION_MESSAGELOG_POSITION, GetChoice(XRCID("ID_MESSAGELOGPOS")));
103}
Note: See TracBrowser for help on using the repository browser.