VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Main/Forms/WaitDialog.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main/Forms/WaitDialog.h')
-rw-r--r--src/Main/Forms/WaitDialog.h26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/Main/Forms/WaitDialog.h b/src/Main/Forms/WaitDialog.h
index a3b14179..89de8718 100644
--- a/src/Main/Forms/WaitDialog.h
+++ b/src/Main/Forms/WaitDialog.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013-2017 IDRIX. All rights reserved.
+ Copyright (c) 2013-2018 IDRIX. All rights reserved.
Governed by the Apache License 2.0 the full text of which is
contained in the file License.txt included in VeraCrypt binary and source
@@ -13,6 +13,7 @@
#include "Main/Main.h"
#include "Main/Application.h"
#include <wx/msgqueue.h>
+#include <wx/msgdlg.h>
namespace VeraCrypt
{
@@ -47,7 +48,7 @@ namespace VeraCrypt
{
public:
WaitDialog (wxWindow *parent, const wxString& label, WaitThreadRoutine* pRoutine)
- : WaitDialogBase(parent), WaitThreadUI(pRoutine), m_timer (this)
+ : WaitDialogBase(parent), WaitThreadUI(pRoutine), m_bThreadRunning (false), m_timer (this)
{
WaitStaticText->SetLabel (label);
WaitProgessBar->Pulse();
@@ -76,6 +77,7 @@ namespace VeraCrypt
{
m_thread->Run();
m_timer.Start(100);
+ m_bThreadRunning = true;
}
int GetCharWidth (wxWindow *window) const
@@ -144,9 +146,19 @@ namespace VeraCrypt
pin = wxT("");
}
- // virtual void OnWaitDialogClose( wxCloseEvent& event ) { }
+ virtual void OnWaitDialogClose( wxCloseEvent& event )
+ {
+ if (event.CanVeto () && m_bThreadRunning)
+ {
+ event.Veto ();
+ }
+ else
+ event.Skip ();
+ }
+
void OnThreadCompletion(wxCommandEvent &)
{
+ m_bThreadRunning = false;
m_queue.Clear();
EndModal(0);
}
@@ -154,7 +166,7 @@ namespace VeraCrypt
void OnAdminPasswordRequest(wxCommandEvent &)
{
- wxPasswordEntryDialog dialog (this, _("Enter your user password or administrator password:"), _("Administrator privileges required"));
+ wxPasswordEntryDialog dialog (this, LangString["LINUX_ADMIN_PW_QUERY"], LangString["LINUX_ADMIN_PW_QUERY_TITLE"]);
if (dialog.ShowModal() != wxID_OK)
m_queue.Post(wxT(""));
else
@@ -185,8 +197,9 @@ namespace VeraCrypt
pParam->m_style |= wxSTAY_ON_TOP;
}
-
- int iResult = wxMessageBox (pParam->m_message, pParam->m_caption, pParam->m_style, this);
+ wxMessageDialog cur(this, pParam->m_message, pParam->m_caption, pParam->m_style);
+ cur.SetYesNoLabels(LangString["UISTR_YES"], LangString["UISTR_NO"]);
+ int iResult = (cur.ShowModal() == wxID_YES ? wxYES : wxNO);
delete pParam;
m_queue.Post(wxString::Format(wxT("%d"), iResult));
}
@@ -202,6 +215,7 @@ namespace VeraCrypt
protected:
WaitThread* m_thread;
+ bool m_bThreadRunning;
wxTimer m_timer;
wxMessageQueue<wxString> m_queue;
};