Files
QsLog
YACReader
YACReaderLibrary
common
compressed_archive
unarr
7z_includes.h
README_7zip.txt
StdAfx.h
StdAfx.h.cpp
compressed_archive.cpp
compressed_archive.h
extract_callbacks.h
extract_delegate.h
libp7zip.patch
open_callbacks.h
wrapper.pri
custom_widgets
dependencies
files
images
release
shortcuts_management
tests
CHANGELOG.txt
COPYING.txt
INSTALL.txt
README.txt
YACReader.1
YACReader.desktop
YACReader.pro
YACReaderLibrary.1
YACReaderLibrary.desktop
background.png
cleanOSX.sh
compileOSX.sh
config.pri
create-dmg
generateVS2010Projects.bat
icon.icns
mktarball.sh
releaseOSX.sh
yacreader/compressed_archive/open_callbacks.h
2016-03-25 11:30:31 +01:00

54 lines
1.3 KiB
C++

#ifndef OPEN_CALLBACKS_H
#define OPEN_CALLBACKS_H
#include "7z_includes.h"
#include <QDebug>
//////////////////////////////////////////////////////////////
// Archive Open callback class
class CArchiveOpenCallback:
public IArchiveOpenCallback,
public ICryptoGetTextPassword,
public CMyUnknownImp
{
public:
MY_UNKNOWN_IMP1(ICryptoGetTextPassword)
STDMETHOD(SetTotal)(const UInt64 *files, const UInt64 *bytes);
STDMETHOD(SetCompleted)(const UInt64 *files, const UInt64 *bytes);
STDMETHOD(CryptoGetTextPassword)(BSTR *password);
bool PasswordIsDefined;
UString Password;
CArchiveOpenCallback() : PasswordIsDefined(false) {}
};
STDMETHODIMP CArchiveOpenCallback::SetTotal(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return S_OK;
}
STDMETHODIMP CArchiveOpenCallback::SetCompleted(const UInt64 * /* files */, const UInt64 * /* bytes */)
{
return S_OK;
}
STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
{
if (!PasswordIsDefined)
{
// You can ask real password here from user
// Password = GetPassword(OutStream);
// PasswordIsDefined = true;
qDebug() << "Password is not defined" << endl;
return E_ABORT;
}
return StringToBstr(Password, password);
}
#endif