diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2008-08-13 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:56 +0300 |
commit | 173c07e166fdf6fcd20f18ea73008f1b628945df (patch) | |
tree | 13ebea85cdc4c16ae93714ff0627ee9f91ad7e08 /CPP/7zip/UI/FileManager/OpenCallback.cpp | |
parent | 3901bf0ab88106a5b031cba7bc18d60cdebf7eef (diff) |
4.59 beta
Diffstat (limited to 'CPP/7zip/UI/FileManager/OpenCallback.cpp')
-rwxr-xr-x | CPP/7zip/UI/FileManager/OpenCallback.cpp | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/CPP/7zip/UI/FileManager/OpenCallback.cpp b/CPP/7zip/UI/FileManager/OpenCallback.cpp index 70ec3f39..be40fc1c 100755 --- a/CPP/7zip/UI/FileManager/OpenCallback.cpp +++ b/CPP/7zip/UI/FileManager/OpenCallback.cpp @@ -11,69 +11,80 @@ #include "PasswordDialog.h" -STDMETHODIMP COpenArchiveCallback::SetTotal(const UINT64 * /* numFiles */, const UINT64 * /* numBytes */) +STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 *numFiles, const UInt64 *numBytes) { + { + NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + _numFilesTotalDefined = (numFiles != NULL); + _numBytesTotalDefined = (numBytes != NULL); + if (_numFilesTotalDefined) + { + ProgressDialog.ProgressSynch.SetNumFilesTotal(*numFiles); + ProgressDialog.ProgressSynch.SetProgress(*numFiles, 0); + } + else if (_numBytesTotalDefined) + ProgressDialog.ProgressSynch.SetProgress(*numBytes, 0); + } return S_OK; } -STDMETHODIMP COpenArchiveCallback::SetCompleted(const UINT64 * /* numFiles */, const UINT64 * /* numBytes */) +STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *numFiles, const UInt64 *numBytes) { + NWindows::NSynchronization::CCriticalSectionLock lock(_criticalSection); + RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause()); + if (numFiles != NULL) + { + ProgressDialog.ProgressSynch.SetNumFilesCur(*numFiles); + if (_numFilesTotalDefined) + ProgressDialog.ProgressSynch.SetPos(*numFiles); + } + if (numBytes != NULL && _numBytesTotalDefined) + ProgressDialog.ProgressSynch.SetPos(*numBytes); return S_OK; } -STDMETHODIMP COpenArchiveCallback::SetTotal(const UINT64 /* total */) +STDMETHODIMP COpenArchiveCallback::SetTotal(const UInt64 total) { + ProgressDialog.ProgressSynch.SetProgress(total, 0); return S_OK; } -STDMETHODIMP COpenArchiveCallback::SetCompleted(const UINT64 * /* completed */) +STDMETHODIMP COpenArchiveCallback::SetCompleted(const UInt64 *completed) { + RINOK(ProgressDialog.ProgressSynch.ProcessStopAndPause()); + if (completed != NULL) + ProgressDialog.ProgressSynch.SetPos(*completed); return S_OK; } STDMETHODIMP COpenArchiveCallback::GetProperty(PROPID propID, PROPVARIANT *value) { - NWindows::NCOM::CPropVariant propVariant; + NWindows::NCOM::CPropVariant prop; if (_subArchiveMode) { switch(propID) { - case kpidName: - propVariant = _subArchiveName; - break; + case kpidName: prop = _subArchiveName; break; } - propVariant.Detach(value); - return S_OK; } - switch(propID) + else { - case kpidName: - propVariant = _fileInfo.Name; - break; - case kpidIsFolder: - propVariant = _fileInfo.IsDirectory(); - break; - case kpidSize: - propVariant = _fileInfo.Size; - break; - case kpidAttributes: - propVariant = (UINT32)_fileInfo.Attributes; - break; - case kpidLastAccessTime: - propVariant = _fileInfo.LastAccessTime; - break; - case kpidCreationTime: - propVariant = _fileInfo.CreationTime; - break; - case kpidLastWriteTime: - propVariant = _fileInfo.LastWriteTime; - break; + switch(propID) + { + case kpidName: prop = _fileInfo.Name; break; + case kpidIsDir: prop = _fileInfo.IsDir(); break; + case kpidSize: prop = _fileInfo.Size; break; + case kpidAttrib: prop = (UInt32)_fileInfo.Attrib; break; + case kpidCTime: prop = _fileInfo.CTime; break; + case kpidATime: prop = _fileInfo.ATime; break; + case kpidMTime: prop = _fileInfo.MTime; break; + } } - propVariant.Detach(value); + prop.Detach(value); return S_OK; } -STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, +STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, IInStream **inStream) { *inStream = NULL; @@ -86,7 +97,7 @@ STDMETHODIMP COpenArchiveCallback::GetStream(const wchar_t *name, if (!NWindows::NFile::NFind::FindFile(fullPath, fileInfo)) return S_FALSE; _fileInfo = fileInfo; - if (_fileInfo.IsDirectory()) + if (_fileInfo.IsDir()) return S_FALSE; CInFileStream *inFile = new CInFileStream; CMyComPtr<IInStream> inStreamTemp = inFile; @@ -103,7 +114,7 @@ STDMETHODIMP COpenArchiveCallback::CryptoGetTextPassword(BSTR *password) { CPasswordDialog dialog; - if (dialog.Create(ParentWindow) == IDCANCEL) + if (dialog.Create(ProgressDialog) == IDCANCEL) return E_ABORT; Password = dialog.Password; |