diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-06-28 20:19:19 +0200 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2015-06-28 20:25:22 +0200 |
commit | 439e0a9588f83e93b609563bcef0a03b13928534 (patch) | |
tree | 371492ae2fdb8c448deaa82358ac26e846f7a021 /src/Main/Forms | |
parent | da8aec4292ab27928f4f9a2f2645c46029de7553 (diff) | |
download | VeraCrypt-439e0a9588f83e93b609563bcef0a03b13928534.tar.gz VeraCrypt-439e0a9588f83e93b609563bcef0a03b13928534.zip |
Linux/MacOSX: Add dedicated PIM page in the volume creation wizard. Correct PIM value check logic.
Diffstat (limited to 'src/Main/Forms')
-rw-r--r--[-rwxr-xr-x] | src/Main/Forms/Forms.cpp | 53 | ||||
-rw-r--r--[-rwxr-xr-x] | src/Main/Forms/Forms.h | 26 | ||||
-rw-r--r--[-rwxr-xr-x] | src/Main/Forms/TrueCrypt.fbp | 432 | ||||
-rw-r--r-- | src/Main/Forms/VolumeCreationWizard.cpp | 45 | ||||
-rw-r--r-- | src/Main/Forms/VolumeCreationWizard.h | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | src/Main/Forms/VolumePasswordPanel.cpp | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | src/Main/Forms/VolumePasswordPanel.h | 0 | ||||
-rw-r--r-- | src/Main/Forms/VolumePimWizardPage.cpp | 67 | ||||
-rw-r--r-- | src/Main/Forms/VolumePimWizardPage.h | 40 |
9 files changed, 659 insertions, 10 deletions
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp index 20f2bfdd..76013e1a 100755..100644 --- a/src/Main/Forms/Forms.cpp +++ b/src/Main/Forms/Forms.cpp @@ -3329,6 +3329,59 @@ VolumePasswordWizardPageBase::~VolumePasswordWizardPageBase() {
}
+VolumePimWizardPageBase::VolumePimWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
+{
+ wxBoxSizer* bSizer101;
+ bSizer101 = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bSizer102;
+ bSizer102 = new wxBoxSizer( wxVERTICAL );
+
+ PimPanelSizer = new wxBoxSizer( wxVERTICAL );
+
+ PimSizer = new wxBoxSizer( wxHORIZONTAL );
+
+ VolumePimStaticText = new wxStaticText( this, wxID_ANY, _("Volume PIM:"), wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePimStaticText->Wrap( -1 );
+ PimSizer->Add( VolumePimStaticText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+ VolumePimTextCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePimTextCtrl->SetMaxLength( 10 );
+ PimSizer->Add( VolumePimTextCtrl, 0, wxALL, 5 );
+
+ VolumePinHelpStaticText = new wxStaticText( this, wxID_ANY, _("(Empty or 0 for default iterations)"), wxDefaultPosition, wxDefaultSize, 0 );
+ VolumePinHelpStaticText->Wrap( -1 );
+ PimSizer->Add( VolumePinHelpStaticText, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
+
+
+ PimPanelSizer->Add( PimSizer, 1, wxEXPAND, 5 );
+
+
+ bSizer102->Add( PimPanelSizer, 0, wxEXPAND, 5 );
+
+ InfoStaticText = new wxStaticText( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ InfoStaticText->Wrap( -1 );
+ bSizer102->Add( InfoStaticText, 0, wxALL|wxEXPAND, 5 );
+
+
+ bSizer101->Add( bSizer102, 1, wxEXPAND, 5 );
+
+
+ this->SetSizer( bSizer101 );
+ this->Layout();
+ bSizer101->Fit( this );
+
+ // Connect Events
+ VolumePimTextCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePimWizardPageBase::OnPimChanged ), NULL, this );
+}
+
+VolumePimWizardPageBase::~VolumePimWizardPageBase()
+{
+ // Disconnect Events
+ VolumePimTextCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( VolumePimWizardPageBase::OnPimChanged ), NULL, this );
+
+}
+
VolumeSizeWizardPageBase::VolumeSizeWizardPageBase( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : WizardPage( parent, id, pos, size, style )
{
wxBoxSizer* bSizer98;
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h index 358e937a..143e5c8d 100755..100644 --- a/src/Main/Forms/Forms.h +++ b/src/Main/Forms/Forms.h @@ -1012,6 +1012,32 @@ namespace VeraCrypt };
///////////////////////////////////////////////////////////////////////////////
+ /// Class VolumePimWizardPageBase
+ ///////////////////////////////////////////////////////////////////////////////
+ class VolumePimWizardPageBase : public WizardPage
+ {
+ private:
+
+ protected:
+ wxBoxSizer* PimPanelSizer;
+ wxBoxSizer* PimSizer;
+ wxStaticText* VolumePimStaticText;
+ wxTextCtrl* VolumePimTextCtrl;
+ wxStaticText* VolumePinHelpStaticText;
+ wxStaticText* InfoStaticText;
+
+ // Virtual event handlers, overide them in your derived class
+ virtual void OnPimChanged( wxCommandEvent& event ) { event.Skip(); }
+
+
+ public:
+
+ VolumePimWizardPageBase( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL );
+ ~VolumePimWizardPageBase();
+
+ };
+
+ ///////////////////////////////////////////////////////////////////////////////
/// Class VolumeSizeWizardPageBase
///////////////////////////////////////////////////////////////////////////////
class VolumeSizeWizardPageBase : public WizardPage
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp index 8a7705da..10472f11 100755..100644 --- a/src/Main/Forms/TrueCrypt.fbp +++ b/src/Main/Forms/TrueCrypt.fbp @@ -27118,6 +27118,438 @@ <property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
+ <property name="name">VolumePimWizardPageBase</property>
+ <property name="pos"></property>
+ <property name="size">-1,-1</property>
+ <property name="subclass">WizardPage; WizardPage.h</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style">wxTAB_TRAVERSAL</property>
+ <event name="OnAuiFindManager"></event>
+ <event name="OnAuiPaneButton"></event>
+ <event name="OnAuiPaneClose"></event>
+ <event name="OnAuiPaneMaximize"></event>
+ <event name="OnAuiPaneRestore"></event>
+ <event name="OnAuiRender"></event>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnInitDialog"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer101</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">bSizer102</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">none</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">PimPanelSizer</property>
+ <property name="orient">wxVERTICAL</property>
+ <property name="permission">protected</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxEXPAND</property>
+ <property name="proportion">1</property>
+ <object class="wxBoxSizer" expanded="0">
+ <property name="minimum_size"></property>
+ <property name="name">PimSizer</property>
+ <property name="orient">wxHORIZONTAL</property>
+ <property name="permission">protected</property>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">Volume PIM:</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">VolumePimStaticText</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL</property>
+ <property name="proportion">0</property>
+ <object class="wxTextCtrl" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="maxlength">10</property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">VolumePimTextCtrl</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="validator_data_type"></property>
+ <property name="validator_style">wxFILTER_NUMERIC</property>
+ <property name="validator_type">wxDefaultValidator</property>
+ <property name="validator_variable"></property>
+ <property name="value"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnText">OnPimChanged</event>
+ <event name="OnTextEnter"></event>
+ <event name="OnTextMaxLen"></event>
+ <event name="OnTextURL"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
+ <property name="proportion">1</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label">(Empty or 0 for default iterations)</property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">VolumePinHelpStaticText</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem" expanded="0">
+ <property name="border">5</property>
+ <property name="flag">wxALL|wxEXPAND</property>
+ <property name="proportion">0</property>
+ <object class="wxStaticText" expanded="0">
+ <property name="BottomDockable">1</property>
+ <property name="LeftDockable">1</property>
+ <property name="RightDockable">1</property>
+ <property name="TopDockable">1</property>
+ <property name="aui_layer"></property>
+ <property name="aui_name"></property>
+ <property name="aui_position"></property>
+ <property name="aui_row"></property>
+ <property name="best_size"></property>
+ <property name="bg"></property>
+ <property name="caption"></property>
+ <property name="caption_visible">1</property>
+ <property name="center_pane">0</property>
+ <property name="close_button">1</property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="default_pane">0</property>
+ <property name="dock">Dock</property>
+ <property name="dock_fixed">0</property>
+ <property name="docking">Left</property>
+ <property name="enabled">1</property>
+ <property name="fg"></property>
+ <property name="floatable">1</property>
+ <property name="font"></property>
+ <property name="gripper">0</property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="label"></property>
+ <property name="max_size"></property>
+ <property name="maximize_button">0</property>
+ <property name="maximum_size"></property>
+ <property name="min_size"></property>
+ <property name="minimize_button">0</property>
+ <property name="minimum_size"></property>
+ <property name="moveable">1</property>
+ <property name="name">InfoStaticText</property>
+ <property name="pane_border">1</property>
+ <property name="pane_position"></property>
+ <property name="pane_size"></property>
+ <property name="permission">protected</property>
+ <property name="pin_button">1</property>
+ <property name="pos"></property>
+ <property name="resize">Resizable</property>
+ <property name="show">1</property>
+ <property name="size"></property>
+ <property name="style"></property>
+ <property name="subclass"></property>
+ <property name="toolbar_pane">0</property>
+ <property name="tooltip"></property>
+ <property name="window_extra_style"></property>
+ <property name="window_name"></property>
+ <property name="window_style"></property>
+ <property name="wrap">-1</property>
+ <event name="OnChar"></event>
+ <event name="OnEnterWindow"></event>
+ <event name="OnEraseBackground"></event>
+ <event name="OnKeyDown"></event>
+ <event name="OnKeyUp"></event>
+ <event name="OnKillFocus"></event>
+ <event name="OnLeaveWindow"></event>
+ <event name="OnLeftDClick"></event>
+ <event name="OnLeftDown"></event>
+ <event name="OnLeftUp"></event>
+ <event name="OnMiddleDClick"></event>
+ <event name="OnMiddleDown"></event>
+ <event name="OnMiddleUp"></event>
+ <event name="OnMotion"></event>
+ <event name="OnMouseEvents"></event>
+ <event name="OnMouseWheel"></event>
+ <event name="OnPaint"></event>
+ <event name="OnRightDClick"></event>
+ <event name="OnRightDown"></event>
+ <event name="OnRightUp"></event>
+ <event name="OnSetFocus"></event>
+ <event name="OnSize"></event>
+ <event name="OnUpdateUI"></event>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="Panel" expanded="0">
+ <property name="aui_managed">0</property>
+ <property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
+ <property name="bg"></property>
+ <property name="context_help"></property>
+ <property name="context_menu">1</property>
+ <property name="enabled">1</property>
+ <property name="event_handler">impl_virtual</property>
+ <property name="fg"></property>
+ <property name="font"></property>
+ <property name="hidden">0</property>
+ <property name="id">wxID_ANY</property>
+ <property name="maximum_size"></property>
+ <property name="minimum_size"></property>
<property name="name">VolumeSizeWizardPageBase</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
diff --git a/src/Main/Forms/VolumeCreationWizard.cpp b/src/Main/Forms/VolumeCreationWizard.cpp index e7f3fb46..8382127a 100644 --- a/src/Main/Forms/VolumeCreationWizard.cpp +++ b/src/Main/Forms/VolumeCreationWizard.cpp @@ -26,6 +26,7 @@ #include "VolumeFormatOptionsWizardPage.h" #include "VolumeLocationWizardPage.h" #include "VolumePasswordWizardPage.h" +#include "VolumePimWizardPage.h" #include "VolumeSizeWizardPage.h" #include "WaitDialog.h" @@ -196,6 +197,21 @@ namespace VeraCrypt page->SetPageText (LangString[OuterVolume ? "PASSWORD_HIDDENVOL_HOST_HELP" : "PASSWORD_HELP"]); return page; } + + case Step::VolumePim: + { + VolumePimWizardPage *page = new VolumePimWizardPage (GetPageParent()); + + if (OuterVolume) + page->SetPageTitle (LangString["PIM_HIDVOL_HOST_TITLE"]); + else if (SelectedVolumeType == VolumeType::Hidden) + page->SetPageTitle (LangString["PIM_HIDVOL_TITLE"]); + else + page->SetPageTitle (LangString["PIM_TITLE"]); + + page->SetPageText (LangString["PIM_HELP"]); + return page; + } case Step::LargeFilesSupport: { @@ -708,7 +724,6 @@ namespace VeraCrypt { VolumePasswordWizardPage *page = dynamic_cast <VolumePasswordWizardPage *> (GetCurrentPage()); Password = page->GetPassword(); - Pim = page->GetVolumePim(); Kdf = page->GetPkcs5Kdf(); Keyfiles = page->GetKeyfiles(); @@ -726,18 +741,32 @@ namespace VeraCrypt if (Password->Size() < VolumePassword::WarningSizeThreshold) { - if (Pim < 485) - { - Gui->ShowError ("PIM_REQUIRE_LONG_PASSWORD"); - return GetCurrentStep(); - } - if (!Gui->AskYesNo (LangString["PASSWORD_LENGTH_WARNING"], false, true)) { return GetCurrentStep(); } } - else if (Pim < 485) + } + + return Step::VolumePim; + } + + case Step::VolumePim: + { + VolumePimWizardPage *page = dynamic_cast <VolumePimWizardPage *> (GetCurrentPage()); + Pim = page->GetVolumePim(); + + if (forward && Password && !Password->IsEmpty()) + { + if (Password->Size() < VolumePassword::WarningSizeThreshold) + { + if (Pim > 0 && Pim < 485) + { + Gui->ShowError ("PIM_REQUIRE_LONG_PASSWORD"); + return GetCurrentStep(); + } + } + else if (Pim > 0 && Pim < 485) { if (!Gui->AskYesNo (LangString["PIM_SMALL_WARNING"], false, true)) { diff --git a/src/Main/Forms/VolumeCreationWizard.h b/src/Main/Forms/VolumeCreationWizard.h index 839a9993..105a2c59 100644 --- a/src/Main/Forms/VolumeCreationWizard.h +++ b/src/Main/Forms/VolumeCreationWizard.h @@ -31,6 +31,7 @@ namespace VeraCrypt EncryptionOptions, VolumeSize, VolumePassword, + VolumePim, LargeFilesSupport, FormatOptions, CrossPlatformSupport, diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp index 5385d6c8..8c0133eb 100755..100644 --- a/src/Main/Forms/VolumePasswordPanel.cpp +++ b/src/Main/Forms/VolumePasswordPanel.cpp @@ -55,8 +55,9 @@ namespace VeraCrypt PasswordTextCtrl->Show (enablePassword); DisplayPasswordCheckBox->Show (enablePassword); - VolumePimTextCtrl->Show (enablePassword); - VolumePinHelpStaticText->Show (enablePassword); + VolumePimStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword))); + VolumePimTextCtrl->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword))); + VolumePinHelpStaticText->Show (enablePassword && (!enableConfirmation || (enablePkcs5Prf && !isMountPassword))); ConfirmPasswordStaticText->Show (enableConfirmation); ConfirmPasswordTextCtrl->Show (enableConfirmation); diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h index f090a2bc..f090a2bc 100755..100644 --- a/src/Main/Forms/VolumePasswordPanel.h +++ b/src/Main/Forms/VolumePasswordPanel.h diff --git a/src/Main/Forms/VolumePimWizardPage.cpp b/src/Main/Forms/VolumePimWizardPage.cpp new file mode 100644 index 00000000..d7176bb2 --- /dev/null +++ b/src/Main/Forms/VolumePimWizardPage.cpp @@ -0,0 +1,67 @@ +/* + Copyright (c) 2015 Mounir IDRASSI for the VeraCrypt project. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "System.h" +#include "Main/GraphicUserInterface.h" +#include "VolumePimWizardPage.h" + +namespace VeraCrypt +{ + VolumePimWizardPage::VolumePimWizardPage (wxPanel* parent) + : VolumePimWizardPageBase (parent) + { + } + + VolumePimWizardPage::~VolumePimWizardPage () + { + } + + int VolumePimWizardPage::GetVolumePim () const + { + if (VolumePimTextCtrl->IsEnabled ()) + { + wxString pinStr (VolumePimTextCtrl->GetValue()); + long pin = 0; + if (pinStr.IsEmpty()) + return 0; + if (pinStr.ToLong (&pin)) + return (int) pin; + else + return -1; + } + else + return 0; + } + + bool VolumePimWizardPage::IsValid () + { + return true; + } + + void VolumePimWizardPage::OnPimChanged (wxCommandEvent& event) + { + if (GetVolumePim() != 0) + { + VolumePinHelpStaticText->SetForegroundColour(*wxRED); + VolumePinHelpStaticText->SetLabel(LangString["PIM_CHANGE_WARNING"]); + } + else + { + VolumePinHelpStaticText->SetForegroundColour(*wxBLACK); + VolumePinHelpStaticText->SetLabel(LangString["IDC_PIM_HELP"]); + } + } +} diff --git a/src/Main/Forms/VolumePimWizardPage.h b/src/Main/Forms/VolumePimWizardPage.h new file mode 100644 index 00000000..eff35e1e --- /dev/null +++ b/src/Main/Forms/VolumePimWizardPage.h @@ -0,0 +1,40 @@ +/* + Copyright (c) 2015 Mounir IDRASSI for the VeraCrypt project. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#ifndef VC_HEADER_Main_Forms_VolumePimWizardPage +#define VC_HEADER_Main_Forms_VolumePimWizardPage + +#include "Forms.h" + +namespace VeraCrypt +{ + class VolumePimWizardPage : public VolumePimWizardPageBase + { + public: + VolumePimWizardPage (wxPanel* parent); + ~VolumePimWizardPage (); + + int GetVolumePim () const; + bool IsValid (); + void SetMaxStaticTextWidth (int width) { InfoStaticText->Wrap (width); } + void SetPageText (const wxString &text) { InfoStaticText->SetLabel (text); } + + protected: + void OnPimChanged (wxCommandEvent& event); + }; +} + +#endif // VC_HEADER_Main_Forms_VolumePimWizardPage |