diff options
Diffstat (limited to 'src/Main/Forms/MainFrame.cpp')
-rw-r--r-- | src/Main/Forms/MainFrame.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index de1c99a4..77f371d8 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -57,60 +57,61 @@ namespace VeraCrypt wxBusyCursor busy; SetName (Application::GetName()); SetTitle (Application::GetName()); SetIcon (Resources::GetVeraCryptIcon()); #if defined(TC_UNIX) && !defined(TC_MACOSX) try { string fifoPath = GetShowRequestFifoPath(); remove (fifoPath.c_str()); throw_sys_if (mkfifo (fifoPath.c_str(), S_IRUSR | S_IWUSR) == -1); ShowRequestFifo = open (fifoPath.c_str(), O_RDONLY | O_NONBLOCK); throw_sys_if (ShowRequestFifo == -1); } catch (...) { #ifdef DEBUG throw; #endif } #endif InitControls(); InitPreferences(); InitTaskBarIcon(); InitEvents(); InitMessageFilter(); + InitWindowPrivacy(); if (!GetPreferences().SecurityTokenModule.IsEmpty() && !SecurityToken::IsInitialized()) { try { Gui->InitSecurityTokenLibrary(); } catch (exception &e) { Gui->ShowError (e); } } Connect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnQuit ) ); Connect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) ); Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); #ifdef TC_MACOSX Connect( wxID_ANY, wxEVT_MOVE, wxMoveEventHandler( MainFrame::OnMoveHandler ) ); #endif } MainFrame::~MainFrame () { #if defined(TC_UNIX) && !defined(TC_MACOSX) if (ShowRequestFifo != -1) { try { @@ -443,60 +444,66 @@ namespace VeraCrypt PDEV_BROADCAST_HDR hdr = (PDEV_BROADCAST_HDR) lParam; if (wParam == DBT_DEVICEREMOVECOMPLETE && hdr->dbch_devicetype == DBT_DEVTYP_VOLUME) { PDEV_BROADCAST_VOLUME vol = (PDEV_BROADCAST_VOLUME) lParam; for (wchar_t driveNo = 0; driveNo < 26; ++driveNo) { if (vol->dbcv_unitmask & (1 << driveNo)) frame->OnDeviceChange (wstring (StringFormatter (L"{0}:\\", wchar_t (L'A' + driveNo)))); } } else { frame->OnDeviceChange (); } } return CallWindowProc (MainFrameWndProc, hwnd, message, wParam, lParam); } #endif void MainFrame::InitMessageFilter () { #ifdef TC_WINDOWS HWND mainFrameHwnd = static_cast <HWND> (GetHandle()); MainFrameWndProc = (WNDPROC) GetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC); SetWindowLongPtr (mainFrameHwnd, GWL_WNDPROC, (LONG_PTR) MainFrameWndProcFilter); #endif } + + void MainFrame::InitWindowPrivacy () + { + Gui->SetContentProtection(!CmdLine->ArgAllowScreencapture); + } + void MainFrame::InitPreferences () { try { LoadPreferences(); VolumeSlotNumber lastSelectedSlotNumber = GetPreferences().LastSelectedSlotNumber; if (Core->IsSlotNumberValid (lastSelectedSlotNumber)) { long slotIndex = SlotNumberToItemIndex (lastSelectedSlotNumber); if (slotIndex >= 0) { SlotListCtrl->SetItemState (slotIndex, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED); SlotListCtrl->EnsureVisible (slotIndex); } } LoadFavoriteVolumes(); VolumeHistory::Load(); if (VolumePathComboBox->GetValue().empty() && !VolumeHistory::Get().empty()) SetVolumePath (VolumeHistory::Get().front()); } catch (exception &e) { Gui->ShowError (e); Gui->ShowError (LangString["LINUX_ERROR_LOADING_CONFIG"] + wstring (Application::GetConfigFilePath (L""))); } } @@ -1041,60 +1048,71 @@ namespace VeraCrypt } break; case Hotkey::Id::ShowHideApplication: Gui->SetBackgroundMode (!Gui->IsInBackgroundMode()); break; case Hotkey::Id::WipeCache: WipeCache(); Gui->ShowInfo ("PASSWORD_CACHE_WIPED"); break; default: assert (false); break; } #endif // TC_WINDOWS } void MainFrame::OnHotkeysMenuItemSelected (wxCommandEvent& event) { #ifdef TC_MACOSX if (Gui->IsInBackgroundMode()) Gui->SetBackgroundMode (false); #endif PreferencesDialog dialog (this); dialog.SelectPage (dialog.HotkeysPage); dialog.ShowModal(); } + void MainFrame::OnLanguageMenuItemSelected (wxCommandEvent& event) + { +#ifdef TC_MACOSX + if (Gui->IsInBackgroundMode()) + Gui->SetBackgroundMode (false); +#endif + PreferencesDialog dialog (this); + dialog.SelectPage (dialog.LanguagesPage); + dialog.ShowModal(); + } + void MainFrame::OnLegalNoticesMenuItemSelected (wxCommandEvent& event) { #ifdef TC_MACOSX if (Gui->IsInBackgroundMode()) Gui->SetBackgroundMode (false); #endif LegalNoticesDialog dialog (this); dialog.ShowModal(); } void MainFrame::OnListChanged () { OnListItemSelectionChanged(); UpdateControls(); } void MainFrame::OnListItemActivated (wxListEvent& event) { if (IsMountedSlotSelected()) OpenSelectedVolume(); else MountVolume(); } void MainFrame::OnListItemDeleted (long itemIndex) { if (SelectedItemIndex > itemIndex) --SelectedItemIndex; } @@ -1399,61 +1417,61 @@ namespace VeraCrypt static bool previousState = false; if (running && !previousState) { previousState = true; Gui->OnAutoDismountAllEvent(); } else { previousState = running; } } #endif } } if (Gui->IsInBackgroundMode()) { if (!GetPreferences().BackgroundTaskEnabled) { Close (true); } else if (MountedVolumes.empty() && (GetPreferences().CloseBackgroundTaskOnNoVolumes || Core->IsInPortableMode())) { Close (true); } } #if defined(TC_UNIX) && !defined(TC_MACOSX) try { - byte buf[128]; + uint8 buf[128]; if (read (ShowRequestFifo, buf, sizeof (buf)) > 0 && Gui->IsInBackgroundMode()) Gui->SetBackgroundMode (false); } catch (...) { #ifdef DEBUG throw; #endif } #endif } catch (exception &e) { Gui->ShowError (e); } } void MainFrame::OnVolumeButtonClick (wxCommandEvent& event) { if (IsMountedSlotSelected()) DismountVolume(); else MountVolume(); } void MainFrame::OnVolumePropertiesButtonClick (wxCommandEvent& event) { shared_ptr <VolumeInfo> selectedVolume = GetSelectedVolume(); if (selectedVolume) { |