other-licenses/7zstub/src/7zip/UI/GUI/OpenCallbackGUI.cpp

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     1 // OpenCallbackGUI.cpp
     3 #include "StdAfx.h"
     5 #include "OpenCallbackGUI.h"
     7 #include "Common/StdOutStream.h"
     8 #include "Common/StdInStream.h"
     9 #include "Common/StringConvert.h"
    11 #ifndef _NO_CRYPTO
    12 #include "../../FileManager/Resource/PasswordDialog/PasswordDialog.h"
    13 #endif
    15 HRESULT COpenCallbackGUI::CheckBreak()
    16 {
    17   return S_OK;
    18 }
    20 HRESULT COpenCallbackGUI::SetTotal(const UInt64 *files, const UInt64 *bytes)
    21 {
    22   return S_OK;
    23 }
    25 HRESULT COpenCallbackGUI::SetCompleted(const UInt64 *files, const UInt64 *bytes)
    26 {
    27   return S_OK;
    28 }
    30 #ifndef _NO_CRYPTO
    31 HRESULT COpenCallbackGUI::CryptoGetTextPassword(BSTR *password)
    32 {
    33   if (!PasswordIsDefined)
    34   {
    35     CPasswordDialog dialog;
    36     if (dialog.Create(ParentWindow) == IDCANCEL)
    37       return E_ABORT;
    38     Password = dialog.Password;
    39     PasswordIsDefined = true;
    40   }
    41   CMyComBSTR tempName(Password);
    42   *password = tempName.Detach();
    43   return S_OK;
    44 }
    46 HRESULT COpenCallbackGUI::GetPasswordIfAny(UString &password)
    47 {
    48   if (PasswordIsDefined)
    49     password = Password;
    50   return S_OK;
    51 }
    52 #endif  

mercurial