source: filezilla/trunk/fuentes/src/interface/asksavepassworddialog.cpp @ 130

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

First release to xenial

File size: 1.6 KB
Line 
1#include "filezilla.h"
2#include "asksavepassworddialog.h"
3#include "Options.h"
4#include "filezillaapp.h"
5#include "xrc_helper.h"
6#include "sitemanager.h"
7
8BEGIN_EVENT_TABLE(CAskSavePasswordDialog, wxDialogEx)
9EVT_RADIOBUTTON(XRCID("ID_REMEMBER_YES"), CAskSavePasswordDialog::OnRadioButtonChanged)
10EVT_RADIOBUTTON(XRCID("ID_REMEMBER_NO"), CAskSavePasswordDialog::OnRadioButtonChanged)
11END_EVENT_TABLE()
12
13bool CAskSavePasswordDialog::Create(wxWindow*)
14{
15        if (!Load(0, _T("ID_ASK_SAVE_PASSWORD"))) {
16                return false;
17        }
18
19        wxButton* ok = XRCCTRL(*this, "wxID_OK", wxButton);
20        if (ok)
21                ok->Enable(false);
22
23        wxGetApp().GetWrapEngine()->WrapRecursive(this, 2, "");
24
25        return true;
26}
27
28
29bool CAskSavePasswordDialog::Run(wxWindow* parent)
30{
31        bool ret = true;
32
33        if (COptions::Get()->GetOptionVal(OPTION_DEFAULT_KIOSKMODE) == 0 && COptions::Get()->GetOptionVal(OPTION_PROMPTPASSWORDSAVE) != 0 && !CSiteManager::HasSites()) {
34                CAskSavePasswordDialog dlg;
35                if (dlg.Create(parent)) {
36                        ret = dlg.ShowModal() == wxID_OK;
37                        if (ret) {
38                                if (xrc_call(dlg, "ID_REMEMBER_NO", &wxRadioButton::GetValue)) {
39                                        COptions::Get()->SetOption(OPTION_DEFAULT_KIOSKMODE, 1);
40                                }
41                                COptions::Get()->SetOption(OPTION_PROMPTPASSWORDSAVE, 0);
42                        }
43                }
44        }
45        else
46                COptions::Get()->SetOption(OPTION_PROMPTPASSWORDSAVE, 0);
47
48        return ret;
49}
50
51void CAskSavePasswordDialog::OnRadioButtonChanged(wxCommandEvent&)
52{
53        wxRadioButton* yes = XRCCTRL(*this, "ID_REMEMBER_NO", wxRadioButton);
54        wxRadioButton* no = XRCCTRL(*this, "ID_REMEMBER_YES", wxRadioButton);
55        wxButton* ok = XRCCTRL(*this, "wxID_OK", wxButton);
56        if (yes && no && ok)
57                ok->Enable(yes->GetValue() || no->GetValue());
58}
Note: See TracBrowser for help on using the repository browser.