VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/VolumePimWizardPage.cpp
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-13 21:49:08 (GMT)
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-09-13 21:51:06 (GMT)
commit24f3b5230cc1ea7e6fb084294f04df10ede17e2f (patch)
treeb2efe5d7522a31c7c6cd21db2fcf9af38a4ca6c5 /src/Main/Forms/VolumePimWizardPage.cpp
parent7e73208e62b441f836f27433a4e297a0e07233b8 (diff)
downloadVeraCrypt-24f3b5230cc1ea7e6fb084294f04df10ede17e2f.zip
VeraCrypt-24f3b5230cc1ea7e6fb084294f04df10ede17e2f.tar.gz
Linux/MacOSX: Mask/unmask PIM value in GUI the same way as the password
Diffstat (limited to 'src/Main/Forms/VolumePimWizardPage.cpp')
-rw-r--r--src/Main/Forms/VolumePimWizardPage.cpp46
1 files changed, 40 insertions, 6 deletions
diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp
index 36dc4c7..8f98cb5 100644
--- a/src/Main/Forms/VolumePimWizardPage.cpp
+++ b/src/Main/Forms/VolumePimWizardPage.cpp
@@ -23,10 +23,7 @@ namespace VeraCrypt
VolumePimWizardPage::VolumePimWizardPage (wxPanel* parent)
: VolumePimWizardPageBase (parent)
{
- wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
- const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
- validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
- VolumePimTextCtrl->SetValidator (validator);
+ SetPimValidator ();
}
VolumePimWizardPage::~VolumePimWizardPage ()
@@ -85,6 +82,43 @@ namespace VeraCrypt
{
VolumePimHelpStaticText->SetForegroundColour(*wxBLACK);
VolumePimHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]);
- }
+ }
+ Fit();
+ Layout();
+ }
+
+ void VolumePimWizardPage::SetPimValidator ()
+ {
+ wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST); // wxFILTER_NUMERIC does not exclude - . , etc.
+ const wxChar *valArr[] = { L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" };
+ validator.SetIncludes (wxArrayString (array_capacity (valArr), (const wxChar **) &valArr));
+ VolumePimTextCtrl->SetValidator (validator);
+ }
+
+ void VolumePimWizardPage::OnDisplayPimCheckBoxClick( wxCommandEvent& event )
+ {
+ FreezeScope freeze (this);
+
+ bool display = event.IsChecked ();
+
+ wxTextCtrl *newTextCtrl = new wxTextCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, display ? 0 : wxTE_PASSWORD);
+ newTextCtrl->SetMaxLength (10);
+ newTextCtrl->SetValue (VolumePimTextCtrl->GetValue());
+ newTextCtrl->SetMinSize (VolumePimTextCtrl->GetSize());
+
+ PimSizer->Replace (VolumePimTextCtrl, newTextCtrl);
+ VolumePimTextCtrl->Show (false);
+ VolumePimTextCtrl->SetValue (wxString (L'X', VolumePimTextCtrl->GetLineLength(0)));
+ GetVolumePim ();
+
+ Fit();
+ Layout();
+ newTextCtrl->SetMinSize (VolumePimTextCtrl->GetMinSize());
+
+ newTextCtrl->Connect (wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (VolumePimWizardPage::OnPimChanged), nullptr, this);
+ delete VolumePimTextCtrl;
+ VolumePimTextCtrl = newTextCtrl;
+ SetPimValidator ();
+ OnPimChanged (GetVolumePim ());
}
-}
+} \ No newline at end of file