Index: src/ch/FeedbackNotEnoughSpaceDlg.cpp =================================================================== diff -u -r4797e4b6b266900bfdcdf4ca6eda47c216ad9db1 -r3921d82d9605d98b2281f3f42d9f9c8385b89a3e --- src/ch/FeedbackNotEnoughSpaceDlg.cpp (.../FeedbackNotEnoughSpaceDlg.cpp) (revision 4797e4b6b266900bfdcdf4ca6eda47c216ad9db1) +++ src/ch/FeedbackNotEnoughSpaceDlg.cpp (.../FeedbackNotEnoughSpaceDlg.cpp) (revision 3921d82d9605d98b2281f3f42d9f9c8385b89a3e) @@ -18,12 +18,10 @@ ***************************************************************************/ #include "stdafx.h" #include "ch.h" -#include "../libchcore/TFileInfo.h" #include "FeedbackNotEnoughSpaceDlg.h" #include "StringHelpers.h" -#include "FeedbackHandler.h" -#include "FileSupport.h" #include "resource.h" +#include "../libchengine/EFeedbackResult.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -34,12 +32,12 @@ ///////////////////////////////////////////////////////////////////////////// // CFeedbackNotEnoughSpaceDlg dialog - CFeedbackNotEnoughSpaceDlg::CFeedbackNotEnoughSpaceDlg(unsigned long long ullSizeRequired, const wchar_t* pszSrcPath, const wchar_t* pszDstPath) :ictranslate::CLanguageDialog(IDD_FEEDBACK_NOTENOUGHSPACE_DIALOG), - m_bAllItems(FALSE), + m_strDisk(pszDstPath), m_ullRequired(ullSizeRequired), - m_strDisk(pszDstPath) + m_bAllItems(FALSE), + m_fsLocal(GetLogFileData()) { m_vstrFiles.push_back(pszSrcPath); } @@ -74,16 +72,27 @@ CWnd* pWnd=GetDlgItem(IDC_HEADER_STATIC); if (pWnd) - pWnd->SetWindowText(fmt); + pWnd->SetWindowText(fmt.ToString()); // now the sizes pWnd=GetDlgItem(IDC_REQUIRED_STATIC); if (pWnd) pWnd->SetWindowText(GetSizeString(m_ullRequired)); - unsigned long long ullFree; + + unsigned long long ullFree = 0, ullTotal = 0; pWnd=GetDlgItem(IDC_AVAILABLE_STATIC); - if (pWnd && GetDynamicFreeSpace(m_strDisk, &ullFree, nullptr)) + if(pWnd) + { + try + { + m_fsLocal.GetDynamicFreeSpace(chcore::PathFromString(m_strDisk), ullFree, ullTotal); + } + catch(const std::exception&) + { + ullFree = 0; + } pWnd->SetWindowText(GetSizeString(ullFree)); + } } BOOL CFeedbackNotEnoughSpaceDlg::OnInitDialog() @@ -133,17 +142,27 @@ if (nIDEvent == 1601) { // update free space - unsigned long long ullFree; CWnd *pWnd=GetDlgItem(IDC_AVAILABLE_STATIC); - if (pWnd && GetDynamicFreeSpace(m_strDisk, &ullFree, nullptr)) + if (pWnd) { + unsigned long long ullFree = 0; + try + { + unsigned long long ullTotal = 0; + m_fsLocal.GetDynamicFreeSpace(chcore::PathFromString(m_strDisk), ullFree, ullTotal); + } + catch(const std::exception&) + { + ullFree = 0; + } + pWnd->SetWindowText(GetSizeString(ullFree)); // end dialog if this is enough if (m_ullRequired <= ullFree) { CLanguageDialog::OnTimer(nIDEvent); - EndDialog(chcore::EFeedbackResult::eResult_Retry); + EndDialog(chengine::EFeedbackResult::eResult_Retry); } } } @@ -154,22 +173,28 @@ void CFeedbackNotEnoughSpaceDlg::OnRetryButton() { UpdateData(TRUE); - EndDialog(chcore::EFeedbackResult::eResult_Retry); + EndDialog(chengine::EFeedbackResult::eResult_Retry); } void CFeedbackNotEnoughSpaceDlg::OnIgnoreButton() { UpdateData(TRUE); - EndDialog(chcore::EFeedbackResult::eResult_Ignore); + EndDialog(chengine::EFeedbackResult::eResult_Ignore); } void CFeedbackNotEnoughSpaceDlg::OnLanguageChanged() { UpdateDialog(); } +void CFeedbackNotEnoughSpaceDlg::OnCancel() +{ + UpdateData(TRUE); + EndDialog(chengine::EFeedbackResult::eResult_Cancel); +} + void CFeedbackNotEnoughSpaceDlg::OnBnClickedCancel() { UpdateData(TRUE); - EndDialog(chcore::EFeedbackResult::eResult_Cancel); + EndDialog(chengine::EFeedbackResult::eResult_Cancel); }