1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2025-11-11 19:08:26 -06:00

MacOSX: solve issue volumes not auto-dismounting when quitting VeraCrypt. restore main VeraCrypt window if is in background when we need to display various dialogs

This commit is contained in:
Mounir IDRASSI
2015-04-06 18:49:19 +02:00
parent a0ebc22d1f
commit 32f11001c0
2 changed files with 63 additions and 2 deletions

View File

@@ -90,6 +90,7 @@ namespace VeraCrypt
} }
} }
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_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); Connect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); Connect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
@@ -110,6 +111,7 @@ namespace VeraCrypt
} }
#endif #endif
Disconnect( wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler( MainFrame::OnQuit ) );
Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) ); Disconnect( wxID_ANY, wxEVT_COMMAND_UPDATE_VOLUME_LIST, wxCommandEventHandler( MainFrame::OnUpdateVolumeList ) );
Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) ); Disconnect( wxID_ANY, wxEVT_COMMAND_PREF_UPDATED, wxCommandEventHandler( MainFrame::OnPreferencesUpdated ) );
Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) ); Disconnect( wxID_ANY, wxEVT_COMMAND_OPEN_VOLUME_REQUEST, wxCommandEventHandler( MainFrame::OnOpenVolumeSystemRequest ) );
@@ -181,7 +183,10 @@ namespace VeraCrypt
return; return;
} }
#endif #endif
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
ChangePasswordDialog dialog (this, volumePath, mode); ChangePasswordDialog dialog (this, volumePath, mode);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -702,6 +707,10 @@ namespace VeraCrypt
void MainFrame::OnAboutMenuItemSelected (wxCommandEvent& event) void MainFrame::OnAboutMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
AboutDialog dialog (this); AboutDialog dialog (this);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -750,6 +759,10 @@ namespace VeraCrypt
void MainFrame::OnBenchmarkMenuItemSelected (wxCommandEvent& event) void MainFrame::OnBenchmarkMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
BenchmarkDialog dialog (this); BenchmarkDialog dialog (this);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -851,6 +864,10 @@ namespace VeraCrypt
void MainFrame::OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event) void MainFrame::OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
PreferencesDialog dialog (this); PreferencesDialog dialog (this);
dialog.SelectPage (dialog.DefaultKeyfilesPage); dialog.SelectPage (dialog.DefaultKeyfilesPage);
dialog.ShowModal(); dialog.ShowModal();
@@ -858,6 +875,10 @@ namespace VeraCrypt
void MainFrame::OnDefaultMountParametersMenuItemSelected(wxCommandEvent& event) void MainFrame::OnDefaultMountParametersMenuItemSelected(wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
PreferencesDialog dialog (this); PreferencesDialog dialog (this);
dialog.SelectPage (dialog.DefaultMountOptionsPage); dialog.SelectPage (dialog.DefaultMountOptionsPage);
dialog.ShowModal(); dialog.ShowModal();
@@ -895,6 +916,10 @@ namespace VeraCrypt
void MainFrame::OnEncryptionTestMenuItemSelected (wxCommandEvent& event) void MainFrame::OnEncryptionTestMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
EncryptionTestDialog dialog (this); EncryptionTestDialog dialog (this);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -1018,6 +1043,10 @@ namespace VeraCrypt
void MainFrame::OnHotkeysMenuItemSelected (wxCommandEvent& event) void MainFrame::OnHotkeysMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
PreferencesDialog dialog (this); PreferencesDialog dialog (this);
dialog.SelectPage (dialog.HotkeysPage); dialog.SelectPage (dialog.HotkeysPage);
dialog.ShowModal(); dialog.ShowModal();
@@ -1025,6 +1054,10 @@ namespace VeraCrypt
void MainFrame::OnLegalNoticesMenuItemSelected (wxCommandEvent& event) void MainFrame::OnLegalNoticesMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
LegalNoticesDialog dialog (this); LegalNoticesDialog dialog (this);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -1138,6 +1171,10 @@ namespace VeraCrypt
{ {
try try
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
SecurityTokenKeyfilesDialog dialog (this, false); SecurityTokenKeyfilesDialog dialog (this, false);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -1187,6 +1224,10 @@ namespace VeraCrypt
void MainFrame::OnPreferencesMenuItemSelected (wxCommandEvent& event) void MainFrame::OnPreferencesMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
PreferencesDialog dialog (this); PreferencesDialog dialog (this);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -1236,6 +1277,10 @@ namespace VeraCrypt
void MainFrame::OnSecurityTokenPreferencesMenuItemSelected (wxCommandEvent& event) void MainFrame::OnSecurityTokenPreferencesMenuItemSelected (wxCommandEvent& event)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
PreferencesDialog dialog (this); PreferencesDialog dialog (this);
dialog.SelectPage (dialog.SecurityTokensPage); dialog.SelectPage (dialog.SecurityTokensPage);
dialog.ShowModal(); dialog.ShowModal();
@@ -1396,6 +1441,10 @@ namespace VeraCrypt
shared_ptr <VolumeInfo> selectedVolume = GetSelectedVolume(); shared_ptr <VolumeInfo> selectedVolume = GetSelectedVolume();
if (selectedVolume) if (selectedVolume)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
VolumePropertiesDialog dialog (this, *selectedVolume); VolumePropertiesDialog dialog (this, *selectedVolume);
dialog.ShowModal(); dialog.ShowModal();
} }
@@ -1452,6 +1501,10 @@ namespace VeraCrypt
void MainFrame::OrganizeFavorites (const FavoriteVolumeList &favorites, size_t newItemCount) void MainFrame::OrganizeFavorites (const FavoriteVolumeList &favorites, size_t newItemCount)
{ {
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
FavoriteVolumesDialog dialog (this, favorites, newItemCount); FavoriteVolumesDialog dialog (this, favorites, newItemCount);
if (dialog.ShowModal() == wxID_OK) if (dialog.ShowModal() == wxID_OK)

View File

@@ -67,6 +67,7 @@ namespace VeraCrypt
void MountAllFavorites (); void MountAllFavorites ();
void MountVolume (); void MountVolume ();
void OnAboutMenuItemSelected (wxCommandEvent& event); void OnAboutMenuItemSelected (wxCommandEvent& event);
void OnQuit(wxCommandEvent& event) { Close(true); }
void OnActivate (wxActivateEvent& event); void OnActivate (wxActivateEvent& event);
void OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event); void OnAddAllMountedToFavoritesMenuItemSelected (wxCommandEvent& event);
void OnAddToFavoritesMenuItemSelected (wxCommandEvent& event); void OnAddToFavoritesMenuItemSelected (wxCommandEvent& event);
@@ -82,7 +83,14 @@ namespace VeraCrypt
void OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event); void OnCloseAllSecurityTokenSessionsMenuItemSelected (wxCommandEvent& event);
void OnDonateMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"donate"); } void OnDonateMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"donate"); }
void OnContactMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"contact"); } void OnContactMenuItemSelected (wxCommandEvent& event) { Gui->OpenHomepageLink (this, L"contact"); }
void OnCreateKeyfileMenuItemSelected (wxCommandEvent& event) { Gui->CreateKeyfile(); } void OnCreateKeyfileMenuItemSelected (wxCommandEvent& event)
{
#ifdef TC_MACOSX
if (Gui->IsInBackgroundMode())
Gui->SetBackgroundMode (false);
#endif
Gui->CreateKeyfile();
}
void OnCreateVolumeButtonClick (wxCommandEvent& event); void OnCreateVolumeButtonClick (wxCommandEvent& event);
void OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event); void OnDefaultKeyfilesMenuItemSelected (wxCommandEvent& event);
void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event ); void OnDefaultMountParametersMenuItemSelected( wxCommandEvent& event );