diff options
Diffstat (limited to 'src/libs/7zip/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp')
-rw-r--r-- | src/libs/7zip/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/libs/7zip/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp b/src/libs/7zip/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp new file mode 100644 index 000000000..7dba2ad5d --- /dev/null +++ b/src/libs/7zip/unix/CPP/7zip/UI/Console/OpenCallbackConsole.cpp @@ -0,0 +1,58 @@ +// OpenCallbackConsole.cpp + +#include "StdAfx.h" + +#include "OpenCallbackConsole.h" + +#include "ConsoleClose.h" +#include "UserInputUtils.h" + +HRESULT COpenCallbackConsole::Open_CheckBreak() +{ + if (NConsoleClose::TestBreakSignal()) + return E_ABORT; + return S_OK; +} + +HRESULT COpenCallbackConsole::Open_SetTotal(const UInt64 *, const UInt64 *) +{ + return Open_CheckBreak(); +} + +HRESULT COpenCallbackConsole::Open_SetCompleted(const UInt64 *, const UInt64 *) +{ + return Open_CheckBreak(); +} + +#ifndef _NO_CRYPTO + +HRESULT COpenCallbackConsole::Open_CryptoGetTextPassword(BSTR *password) +{ + PasswordWasAsked = true; + RINOK(Open_CheckBreak()); + if (!PasswordIsDefined) + { + Password = GetPassword(OutStream); + PasswordIsDefined = true; + } + return StringToBstr(Password, password); +} + +HRESULT COpenCallbackConsole::Open_GetPasswordIfAny(UString &password) +{ + if (PasswordIsDefined) + password = Password; + return S_OK; +} + +bool COpenCallbackConsole::Open_WasPasswordAsked() +{ + return PasswordWasAsked; +} + +void COpenCallbackConsole::Open_ClearPasswordWasAskedFlag() +{ + PasswordWasAsked = false; +} + +#endif |