From ba1e9c8f4d6d65a5d5a73f1721bf2b03e42aa50e Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sat, 28 Feb 2015 17:01:39 +0100 Subject: Linux/MacOSX: A configuration option for default hash and default TrueCrypt mode used for mounting volumes (Menu Settings -> Default Mount Parameters). Implement priority of command line arguments over default values. --- src/Main/Forms/MainFrame.cpp | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/Main/Forms/MainFrame.cpp (limited to 'src/Main/Forms/MainFrame.cpp') diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp old mode 100644 new mode 100755 index 08184005..41c6ae7d --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -625,6 +625,14 @@ namespace VeraCrypt try { MountOptions mountOptions (GetPreferences().DefaultMountOptions); + if (CmdLine->ArgTrueCryptMode) + { + mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + } + if (CmdLine->ArgHash) + { + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); + } if (SlotListCtrl->GetSelectedItemCount() == 1) mountOptions.SlotNumber = SelectedSlotNumber; @@ -642,6 +650,14 @@ namespace VeraCrypt try { MountOptions mountOptions (GetPreferences().DefaultMountOptions); + if (CmdLine->ArgTrueCryptMode) + { + mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + } + if (CmdLine->ArgHash) + { + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); + } Gui->MountAllFavoriteVolumes (mountOptions); } catch (exception &e) @@ -664,10 +680,13 @@ namespace VeraCrypt MountOptions mountOptions (GetPreferences().DefaultMountOptions); mountOptions.SlotNumber = SelectedSlotNumber; mountOptions.Path = GetSelectedVolumePath(); - mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + if (CmdLine->ArgTrueCryptMode) + { + mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + } if (CmdLine->ArgHash) { - mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, CmdLine->ArgTrueCryptMode); + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); } try @@ -837,6 +856,13 @@ namespace VeraCrypt dialog.ShowModal(); } + void MainFrame::OnDefaultMountParametersMenuItemSelected(wxCommandEvent& event) + { + PreferencesDialog dialog (this); + dialog.SelectPage (dialog.DefaultMountOptionsPage); + dialog.ShowModal(); + } + void MainFrame::OnDeviceChange (const DirectoryPath &mountPoint) { // Check if any host device has been removed and force dismount of volumes accordingly @@ -886,10 +912,13 @@ namespace VeraCrypt SetVolumePath (favorite.Path); MountOptions mountOptions (GetPreferences().DefaultMountOptions); - mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + if (CmdLine->ArgTrueCryptMode) + { + mountOptions.TrueCryptMode = CmdLine->ArgTrueCryptMode; + } if (CmdLine->ArgHash) { - mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, CmdLine->ArgTrueCryptMode); + mountOptions.Kdf = Pkcs5Kdf::GetAlgorithm (*CmdLine->ArgHash, mountOptions.TrueCryptMode); } favorite.ToMountOptions (mountOptions); -- cgit v1.2.3