VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-26 22:01:04 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2015-06-26 22:07:17 +0200
commitda8aec4292ab27928f4f9a2f2645c46029de7553 (patch)
tree2eb3a1c503bda9f5a601f598a6bce9559f5890d8
parentd73df9bbd4e70f38a1f1ddc28e7bd45eb0edcc92 (diff)
downloadVeraCrypt-da8aec4292ab27928f4f9a2f2645c46029de7553.tar.gz
VeraCrypt-da8aec4292ab27928f4f9a2f2645c46029de7553.zip
Linux: don't ask for PIM if TrueCryptMode enabled, both in command line and GUI
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/Forms.cpp2
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/Forms.h1
-rwxr-xr-xsrc/Main/Forms/TrueCrypt.fbp2
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/VolumePasswordPanel.cpp35
-rwxr-xr-x[-rw-r--r--]src/Main/Forms/VolumePasswordPanel.h1
-rwxr-xr-x[-rw-r--r--]src/Main/TextUserInterface.cpp8
6 files changed, 36 insertions, 13 deletions
diff --git a/src/Main/Forms/Forms.cpp b/src/Main/Forms/Forms.cpp
index 0cfd9562..20f2bfdd 100644..100755
--- a/src/Main/Forms/Forms.cpp
+++ b/src/Main/Forms/Forms.cpp
@@ -3281,6 +3281,7 @@ VolumePasswordPanelBase::VolumePasswordPanelBase( wxWindow* parent, wxWindowID i
KeyfilesButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
KeyfilesButton->Connect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
KeyfilesButton->Connect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this );
+ TrueCryptModeCheckBox->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnTrueCryptModeChecked ), NULL, this );
}
VolumePasswordPanelBase::~VolumePasswordPanelBase()
@@ -3294,6 +3295,7 @@ VolumePasswordPanelBase::~VolumePasswordPanelBase()
KeyfilesButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonClick ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_RIGHT_DOWN, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightDown ), NULL, this );
KeyfilesButton->Disconnect( wxEVT_RIGHT_UP, wxMouseEventHandler( VolumePasswordPanelBase::OnKeyfilesButtonRightClick ), NULL, this );
+ TrueCryptModeCheckBox->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( VolumePasswordPanelBase::OnTrueCryptModeChecked ), NULL, this );
}
diff --git a/src/Main/Forms/Forms.h b/src/Main/Forms/Forms.h
index e2d462f0..358e937a 100644..100755
--- a/src/Main/Forms/Forms.h
+++ b/src/Main/Forms/Forms.h
@@ -983,6 +983,7 @@ namespace VeraCrypt
virtual void OnKeyfilesButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonRightDown( wxMouseEvent& event ) { event.Skip(); }
virtual void OnKeyfilesButtonRightClick( wxMouseEvent& event ) { event.Skip(); }
+ virtual void OnTrueCryptModeChecked( wxCommandEvent& event ) { event.Skip(); }
public:
diff --git a/src/Main/Forms/TrueCrypt.fbp b/src/Main/Forms/TrueCrypt.fbp
index 24b98f19..8a7705da 100755
--- a/src/Main/Forms/TrueCrypt.fbp
+++ b/src/Main/Forms/TrueCrypt.fbp
@@ -26720,7 +26720,7 @@
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
- <event name="OnCheckBox"></event>
+ <event name="OnCheckBox">OnTrueCryptModeChecked</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
diff --git a/src/Main/Forms/VolumePasswordPanel.cpp b/src/Main/Forms/VolumePasswordPanel.cpp
index d4200b66..5385d6c8 100644..100755
--- a/src/Main/Forms/VolumePasswordPanel.cpp
+++ b/src/Main/Forms/VolumePasswordPanel.cpp
@@ -73,6 +73,12 @@ namespace VeraCrypt
if (options && !disableTruecryptMode)
{
TrueCryptModeCheckBox->SetValue (options->TrueCryptMode);
+ if (options->TrueCryptMode)
+ {
+ VolumePimStaticText->Enable (false);
+ VolumePimTextCtrl->Enable (false);
+ VolumePinHelpStaticText->Enable (false);
+ }
}
if (enablePkcs5Prf)
@@ -218,15 +224,20 @@ namespace VeraCrypt
int VolumePasswordPanel::GetVolumePim () const
{
- wxString pinStr (VolumePimTextCtrl->GetValue());
- long pin = 0;
- if (pinStr.IsEmpty())
- return 0;
- if (pinStr.ToLong (&pin))
- return (int) pin;
+ 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 -1;
- }
+ return 0;
+ }
bool VolumePasswordPanel::GetTrueCryptMode () const
{
@@ -384,4 +395,12 @@ namespace VeraCrypt
}
}
}
+
+ void VolumePasswordPanel::OnTrueCryptModeChecked( wxCommandEvent& event )
+ {
+ bool bEnablePIM = !GetTrueCryptMode ();
+ VolumePimStaticText->Enable (bEnablePIM);
+ VolumePimTextCtrl->Enable (bEnablePIM);
+ VolumePinHelpStaticText->Enable (bEnablePIM);
+ }
}
diff --git a/src/Main/Forms/VolumePasswordPanel.h b/src/Main/Forms/VolumePasswordPanel.h
index 45e0dd8c..f090a2bc 100644..100755
--- a/src/Main/Forms/VolumePasswordPanel.h
+++ b/src/Main/Forms/VolumePasswordPanel.h
@@ -50,6 +50,7 @@ namespace VeraCrypt
void OnUpdate () { UpdateEvent.Raise(); }
void OnUseKeyfilesCheckBoxClick (wxCommandEvent& event) { OnUpdate(); }
void WipeTextCtrl (wxTextCtrl *textCtrl);
+ void OnTrueCryptModeChecked( wxCommandEvent& event );
shared_ptr <KeyfileList> Keyfiles;
shared_ptr <Functor> UpdateCallback;
diff --git a/src/Main/TextUserInterface.cpp b/src/Main/TextUserInterface.cpp
index 190aaf76..50153eb9 100644..100755
--- a/src/Main/TextUserInterface.cpp
+++ b/src/Main/TextUserInterface.cpp
@@ -444,7 +444,7 @@ namespace VeraCrypt
}
// current PIM
- if (!Preferences.NonInteractive && (pim < 0))
+ if (!truecryptMode && !Preferences.NonInteractive && (pim < 0))
{
pim = AskPim (_("Enter current PIM"));
}
@@ -1120,7 +1120,7 @@ namespace VeraCrypt
if (!options.Password)
options.Password = AskPassword();
- if (options.Pim < 0)
+ if (!options.TrueCryptMode && (options.Pim < 0))
options.Pim = AskPim (_("Enter PIM"));
if (!options.Keyfiles)
@@ -1198,7 +1198,7 @@ namespace VeraCrypt
}
}
- if (options.Pim < 0)
+ if (!options.TrueCryptMode && (options.Pim < 0))
{
options.Pim = AskPim (StringFormatter (_("Enter PIM for {0}"), wstring (*options.Path)));
}
@@ -1217,7 +1217,7 @@ namespace VeraCrypt
{
if (!options.ProtectionPassword)
options.ProtectionPassword = AskPassword (_("Enter password for hidden volume"));
- if (options.ProtectionPim < 0)
+ if (!options.TrueCryptMode && (options.ProtectionPim < 0))
options.ProtectionPim = AskPim (_("Enter PIM for hidden volume"));
if (!options.ProtectionKeyfiles)
options.ProtectionKeyfiles = AskKeyfiles (_("Enter keyfile for hidden volume"));