Index: src/ch/FeedbackHandler.cpp =================================================================== diff -u -r671f4b1792a20d98b186f4e0a9cc6a620dede019 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/ch/FeedbackHandler.cpp (.../FeedbackHandler.cpp) (revision 671f4b1792a20d98b186f4e0a9cc6a620dede019) +++ src/ch/FeedbackHandler.cpp (.../FeedbackHandler.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -28,60 +28,57 @@ using namespace chcore; CFeedbackHandler::CFeedbackHandler() : - chcore::TFeedbackHandlerBase() + TFeedbackHandlerBase() { } CFeedbackHandler::~CFeedbackHandler() { } -chcore::EFeedbackResult CFeedbackHandler::FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) +TFeedbackResult CFeedbackHandler::FileError(const TString& strSrcPath, const TString& strDstPath, EFileError /*eFileError*/, unsigned long ulError) { - chcore::EFeedbackResult eResult = TFeedbackHandlerBase::FileError(strSrcPath, strDstPath, eFileError, ulError); - if (eResult == chcore::eResult_Unknown) - { - CFeedbackFileErrorDlg dlg(strSrcPath.c_str(), strDstPath.c_str(), ulError); - eResult = (chcore::EFeedbackResult)dlg.DoModal(); - - if (dlg.m_bAllItems) - SetFileErrorPermanentResponse(eResult); - } + if(HasFileErrorPermanentResponse()) + return TFeedbackResult(GetFileErrorPermanentResponse(), true); - return eResult; + CFeedbackFileErrorDlg dlg(strSrcPath.c_str(), strDstPath.c_str(), ulError); + EFeedbackResult eResult = (EFeedbackResult)dlg.DoModal(); + + if (dlg.m_bAllItems) + SetFileErrorPermanentResponse(eResult); + + return TFeedbackResult(eResult, false); } -chcore::EFeedbackResult CFeedbackHandler::FileAlreadyExists(const TFileInfoPtr& spSrcFileInfo, const TFileInfoPtr& spDstFileInfo) +TFeedbackResult CFeedbackHandler::FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) { - chcore::EFeedbackResult eResult = TFeedbackHandlerBase::FileAlreadyExists(spSrcFileInfo, spDstFileInfo); - if (eResult == chcore::eResult_Unknown) - { - CFeedbackReplaceDlg dlg(spSrcFileInfo, spDstFileInfo); - eResult = (EFeedbackResult)dlg.DoModal(); + if(HasFileAlreadyExistsPermanentResponse()) + return TFeedbackResult(GetFileAlreadyExistsPermanentResponse(), true); - if(dlg.m_bAllItems) - SetFileAlreadyExistsPermanentResponse(eResult); - } + CFeedbackReplaceDlg dlg(spSrcFileInfo, spDstFileInfo); + EFeedbackResult eResult = (EFeedbackResult)dlg.DoModal(); - return eResult; + if(dlg.m_bAllItems) + SetFileAlreadyExistsPermanentResponse(eResult); + + return TFeedbackResult(eResult, false); } -chcore::EFeedbackResult CFeedbackHandler::NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) +TFeedbackResult CFeedbackHandler::NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) { - chcore::EFeedbackResult eResult = TFeedbackHandlerBase::NotEnoughSpace(strSrcPath, strDstPath, ullRequiredSize); - if (eResult == chcore::eResult_Unknown) - { - CFeedbackNotEnoughSpaceDlg dlg(ullRequiredSize, strSrcPath.c_str(), strDstPath.c_str()); - eResult = (EFeedbackResult) dlg.DoModal(); + if(HasNotEnoughSpacePermanentResponse()) + return TFeedbackResult(GetNotEnoughSpacePermanentResponse(), true); - if (dlg.m_bAllItems) - SetNotEnoughSpacePermanentResponse(eResult); - } + CFeedbackNotEnoughSpaceDlg dlg(ullRequiredSize, strSrcPath.c_str(), strDstPath.c_str()); + EFeedbackResult eResult = (EFeedbackResult) dlg.DoModal(); - return eResult; + if (dlg.m_bAllItems) + SetNotEnoughSpacePermanentResponse(eResult); + + return TFeedbackResult(eResult, false); } -chcore::EFeedbackResult CFeedbackHandler::OperationFinished() +TFeedbackResult CFeedbackHandler::OperationFinished() { if (GetPropValue(GetConfig())) { @@ -92,10 +89,10 @@ PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); } - return eResult_Unknown; + return TFeedbackResult(eResult_Unknown, true); } -chcore::EFeedbackResult CFeedbackHandler::OperationError() +TFeedbackResult CFeedbackHandler::OperationError() { if (GetPropValue(GetConfig())) { @@ -106,5 +103,5 @@ PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); } - return eResult_Unknown; + return TFeedbackResult(eResult_Unknown, true); } Index: src/ch/FeedbackHandler.h =================================================================== diff -u -r2755e12daeccb1935f569e7235e685e566b0b098 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/ch/FeedbackHandler.h (.../FeedbackHandler.h) (revision 2755e12daeccb1935f569e7235e685e566b0b098) +++ src/ch/FeedbackHandler.h (.../FeedbackHandler.h) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -23,18 +23,19 @@ #include "../libchcore/TFeedbackHandlerBase.h" #include "../libchcore/EFeedbackResult.h" #include "../libchcore/EFileError.h" +#include "../libchcore/TFeedbackResult.h" class CFeedbackHandler : public chcore::TFeedbackHandlerBase { public: CFeedbackHandler(); virtual ~CFeedbackHandler(); - virtual chcore::EFeedbackResult FileError(const chcore::TString& strSrcPath, const chcore::TString& strDstPath, chcore::EFileError eFileError, unsigned long ulError) override; - virtual chcore::EFeedbackResult FileAlreadyExists(const chcore::TFileInfoPtr& spSrcFileInfo, const chcore::TFileInfoPtr& spDstFileInfo) override; - virtual chcore::EFeedbackResult NotEnoughSpace(const chcore::TString& strSrcPath, const chcore::TString& strDstPath, unsigned long long ullRequiredSize) override; - virtual chcore::EFeedbackResult OperationFinished() override; - virtual chcore::EFeedbackResult OperationError() override; + virtual chcore::TFeedbackResult FileError(const chcore::TString& strSrcPath, const chcore::TString& strDstPath, chcore::EFileError eFileError, unsigned long ulError) override; + virtual chcore::TFeedbackResult FileAlreadyExists(const chcore::TFileInfo& spSrcFileInfo, const chcore::TFileInfo& spDstFileInfo) override; + virtual chcore::TFeedbackResult NotEnoughSpace(const chcore::TString& strSrcPath, const chcore::TString& strDstPath, unsigned long long ullRequiredSize) override; + virtual chcore::TFeedbackResult OperationFinished() override; + virtual chcore::TFeedbackResult OperationError() override; protected: friend class CFeedbackHandlerFactory; Index: src/ch/FeedbackReplaceDlg.cpp =================================================================== diff -u -r671f4b1792a20d98b186f4e0a9cc6a620dede019 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/ch/FeedbackReplaceDlg.cpp (.../FeedbackReplaceDlg.cpp) (revision 671f4b1792a20d98b186f4e0a9cc6a620dede019) +++ src/ch/FeedbackReplaceDlg.cpp (.../FeedbackReplaceDlg.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -13,10 +13,10 @@ IMPLEMENT_DYNAMIC(CFeedbackReplaceDlg, ictranslate::CLanguageDialog) -CFeedbackReplaceDlg::CFeedbackReplaceDlg(const chcore::TFileInfoPtr& spSrcFile, const chcore::TFileInfoPtr& spDstFile, CWnd* pParent /*=NULL*/) +CFeedbackReplaceDlg::CFeedbackReplaceDlg(const chcore::TFileInfo& spSrcFile, const chcore::TFileInfo& spDstFile, CWnd* pParent /*=NULL*/) : ictranslate::CLanguageDialog(IDD_FEEDBACK_REPLACE_DIALOG, pParent), - m_spSrcFile(spSrcFile), - m_spDstFile(spDstFile), + m_rSrcFile(spSrcFile), + m_rDstFile(spDstFile), m_bAllItems(FALSE) { } @@ -81,10 +81,6 @@ void CFeedbackReplaceDlg::RefreshFilesInfo() { - BOOST_ASSERT(m_spSrcFile && m_spDstFile); - if(!m_spSrcFile || !m_spDstFile) - return; - // load template ictranslate::CResourceManager& rManager = GetResManager(); @@ -96,35 +92,31 @@ strTemplate += rManager.LoadString(IDS_INFO_MODIFIED_STRING); ictranslate::CFormat fmt(strTemplate); - fmt.SetParam(_T("%filename"), m_spSrcFile->GetFullFilePath().ToString()); - fmt.SetParam(_T("%size"), m_spSrcFile->GetLength64()); + fmt.SetParam(_T("%filename"), m_rSrcFile.GetFullFilePath().ToString()); + fmt.SetParam(_T("%size"), m_rSrcFile.GetLength64()); - COleDateTime dtTemp = m_spSrcFile->GetLastWriteTime().GetAsFiletime(); + COleDateTime dtTemp = m_rSrcFile.GetLastWriteTime().GetAsFiletime(); fmt.SetParam(_T("%datemod"), dtTemp.Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT)); m_ctlSrcInfo.SetWindowText(fmt); fmt.SetFormat(strTemplate); - fmt.SetParam(_T("%filename"), m_spDstFile->GetFullFilePath().ToString()); - fmt.SetParam(_T("%size"), m_spDstFile->GetLength64()); - dtTemp = m_spDstFile->GetLastWriteTime().GetAsFiletime(); + fmt.SetParam(_T("%filename"), m_rDstFile.GetFullFilePath().ToString()); + fmt.SetParam(_T("%size"), m_rDstFile.GetLength64()); + dtTemp = m_rDstFile.GetLastWriteTime().GetAsFiletime(); fmt.SetParam(_T("%datemod"), dtTemp.Format(LOCALE_NOUSEROVERRIDE, LANG_USER_DEFAULT)); m_ctlDstInfo.SetWindowText(fmt); } void CFeedbackReplaceDlg::RefreshImages() { - BOOST_ASSERT(m_spSrcFile && m_spDstFile); - if(!m_spSrcFile || !m_spDstFile) - return; - SHFILEINFO shfi; - DWORD_PTR dwRes = SHGetFileInfo(m_spSrcFile->GetFullFilePath().ToString(), 0, &shfi, sizeof(shfi), SHGFI_ICON); + DWORD_PTR dwRes = SHGetFileInfo(m_rSrcFile.GetFullFilePath().ToString(), 0, &shfi, sizeof(shfi), SHGFI_ICON); if(dwRes) m_ctlSrcIcon.SetIcon(shfi.hIcon); - dwRes = SHGetFileInfo(m_spDstFile->GetFullFilePath().ToString(), 0, &shfi, sizeof(shfi), SHGFI_ICON); + dwRes = SHGetFileInfo(m_rDstFile.GetFullFilePath().ToString(), 0, &shfi, sizeof(shfi), SHGFI_ICON); if(dwRes) m_ctlDstIcon.SetIcon(shfi.hIcon); } Index: src/ch/FeedbackReplaceDlg.h =================================================================== diff -u -r2aea3ad6f3c68be709ac65c70d9646eafe3b034c -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/ch/FeedbackReplaceDlg.h (.../FeedbackReplaceDlg.h) (revision 2aea3ad6f3c68be709ac65c70d9646eafe3b034c) +++ src/ch/FeedbackReplaceDlg.h (.../FeedbackReplaceDlg.h) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -24,7 +24,7 @@ DECLARE_DYNAMIC(CFeedbackReplaceDlg) public: - CFeedbackReplaceDlg(const chcore::TFileInfoPtr& spSrcFile, const chcore::TFileInfoPtr& spDstFile, CWnd* pParent = NULL); // standard constructor + CFeedbackReplaceDlg(const chcore::TFileInfo& spSrcFile, const chcore::TFileInfo& spDstFile, CWnd* pParent = NULL); // standard constructor virtual ~CFeedbackReplaceDlg(); virtual BOOL OnInitDialog(); @@ -45,8 +45,8 @@ BOOL m_bAllItems; protected: - const chcore::TFileInfoPtr m_spSrcFile; - const chcore::TFileInfoPtr m_spDstFile; + const chcore::TFileInfo& m_rSrcFile; + const chcore::TFileInfo& m_rDstFile; public: afx_msg void OnBnClickedReplaceButton(); Index: src/libchcore/IFeedbackHandler.h =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/IFeedbackHandler.h (.../IFeedbackHandler.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/IFeedbackHandler.h (.../IFeedbackHandler.h) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -22,26 +22,28 @@ #include "libchcore.h" #include "EFeedbackResult.h" #include "TString.h" -#include "TFileInfo.h" #include "ISerializerRowReader.h" #include "ISerializerRowData.h" #include "EFileError.h" +#include "TFeedbackResult.h" namespace chcore { + class TFileInfo; + class LIBCHCORE_API IFeedbackHandler { public: virtual ~IFeedbackHandler(); // requests with some processing data - virtual EFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) = 0; - virtual EFeedbackResult FileAlreadyExists(const TFileInfoPtr& spSrcFileInfo, const TFileInfoPtr& spDstFileInfo) = 0; - virtual EFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) = 0; + virtual TFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) = 0; + virtual TFeedbackResult FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) = 0; + virtual TFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) = 0; // no-data requests - virtual EFeedbackResult OperationFinished() = 0; - virtual EFeedbackResult OperationError() = 0; + virtual TFeedbackResult OperationFinished() = 0; + virtual TFeedbackResult OperationError() = 0; // reset permanent states virtual void RestoreDefaults() = 0; Index: src/libchcore/TFeedbackHandlerBase.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TFeedbackHandlerBase.cpp (.../TFeedbackHandlerBase.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TFeedbackHandlerBase.cpp (.../TFeedbackHandlerBase.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -115,29 +115,30 @@ m_eOperationFinished = EFeedbackResult::eResult_Unknown; m_eOperationError = EFeedbackResult::eResult_Unknown; } +/* - EFeedbackResult TFeedbackHandlerBase::FileError(const TString& /*strSrcPath*/, const TString& /*strDstPath*/, EFileError /*eFileError*/, unsigned long /*ulError*/) + TFeedbackResult TFeedbackHandlerBase::FileError(const TString& / *strSrcPath* /, const TString& / *strDstPath* /, EFileError / *eFileError* /, unsigned long / *ulError* /) { - return m_eFileError; + return TFeedbackResult(m_eFileError, HasFileErrorPermanentResponse()); } - EFeedbackResult TFeedbackHandlerBase::FileAlreadyExists(const TFileInfoPtr& /*spSrcFileInfo*/, const TFileInfoPtr& /*spDstFileInfo*/) + TFeedbackResult TFeedbackHandlerBase::FileAlreadyExists(const TFileInfo& / *rSrcFileInfo* /, const TFileInfo& / *rDstFileInfo* /) { return m_eFileAlreadyExists; } - EFeedbackResult TFeedbackHandlerBase::NotEnoughSpace(const TString& /*strSrcPath*/, const TString& /*strDstPath*/, unsigned long long /*ullRequiredSize*/) + TFeedbackResult TFeedbackHandlerBase::NotEnoughSpace(const TString& / *strSrcPath* /, const TString& / *strDstPath* /, unsigned long long / *ullRequiredSize* /) { return m_eNotEnoughSpace; } - EFeedbackResult TFeedbackHandlerBase::OperationFinished() + TFeedbackResult TFeedbackHandlerBase::OperationFinished() { return m_eOperationFinished; } - EFeedbackResult TFeedbackHandlerBase::OperationError() + TFeedbackResult TFeedbackHandlerBase::OperationError() { return m_eOperationError; - } + }*/ } Index: src/libchcore/TFeedbackHandlerBase.h =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TFeedbackHandlerBase.h (.../TFeedbackHandlerBase.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TFeedbackHandlerBase.h (.../TFeedbackHandlerBase.h) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -35,22 +35,27 @@ TFeedbackHandlerBase(); virtual ~TFeedbackHandlerBase(); - virtual EFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) override; - virtual EFeedbackResult FileAlreadyExists(const TFileInfoPtr& spSrcFileInfo, const TFileInfoPtr& spDstFileInfo) override; - virtual EFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) override; +/* + virtual TFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) override; + virtual TFeedbackResult FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) override; + virtual TFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) override; - virtual EFeedbackResult OperationFinished() override; - virtual EFeedbackResult OperationError() override; + virtual TFeedbackResult OperationFinished() override; + virtual TFeedbackResult OperationError() override; +*/ // marking responses as permanent void SetFileErrorPermanentResponse(EFeedbackResult ePermanentResult) { m_eFileError = ePermanentResult; } EFeedbackResult GetFileErrorPermanentResponse() const { return m_eFileError; } + bool HasFileErrorPermanentResponse() const { return m_eFileError != EFeedbackResult::eResult_Unknown; } void SetFileAlreadyExistsPermanentResponse(EFeedbackResult ePermanentResult) { m_eFileAlreadyExists = ePermanentResult; } EFeedbackResult GetFileAlreadyExistsPermanentResponse() const { return m_eFileAlreadyExists; } + bool HasFileAlreadyExistsPermanentResponse() const { return m_eFileAlreadyExists != EFeedbackResult::eResult_Unknown; } void SetNotEnoughSpacePermanentResponse(EFeedbackResult ePermanentResult) { m_eNotEnoughSpace = ePermanentResult; } EFeedbackResult GetNotEnoughSpacePermanentResponse() const { return m_eNotEnoughSpace; } + bool HasNotEnoughSpacePermanentResponse() const { return m_eNotEnoughSpace != EFeedbackResult::eResult_Unknown; } // resets the permanent status from all responses virtual void RestoreDefaults() override; Index: src/libchcore/TFeedbackHandlerWrapper.cpp =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TFeedbackHandlerWrapper.cpp (.../TFeedbackHandlerWrapper.cpp) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TFeedbackHandlerWrapper.cpp (.../TFeedbackHandlerWrapper.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -32,35 +32,35 @@ { } - EFeedbackResult TFeedbackHandlerWrapper::FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) + TFeedbackResult TFeedbackHandlerWrapper::FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) { TScopedRunningTimeTrackerPause scopedTimePause(m_rTimeGuard); return m_spFeedbackHandler->FileError(strSrcPath, strDstPath, eFileError, ulError); } - EFeedbackResult TFeedbackHandlerWrapper::FileAlreadyExists(const TFileInfoPtr& spSrcFileInfo, const TFileInfoPtr& spDstFileInfo) + TFeedbackResult TFeedbackHandlerWrapper::FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) { TScopedRunningTimeTrackerPause scopedTimePause(m_rTimeGuard); return m_spFeedbackHandler->FileAlreadyExists(spSrcFileInfo, spDstFileInfo); } - EFeedbackResult TFeedbackHandlerWrapper::NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) + TFeedbackResult TFeedbackHandlerWrapper::NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) { TScopedRunningTimeTrackerPause scopedTimePause(m_rTimeGuard); return m_spFeedbackHandler->NotEnoughSpace(strSrcPath, strDstPath, ullRequiredSize); } - EFeedbackResult TFeedbackHandlerWrapper::OperationFinished() + TFeedbackResult TFeedbackHandlerWrapper::OperationFinished() { TScopedRunningTimeTrackerPause scopedTimePause(m_rTimeGuard); return m_spFeedbackHandler->OperationFinished(); } - EFeedbackResult TFeedbackHandlerWrapper::OperationError() + TFeedbackResult TFeedbackHandlerWrapper::OperationError() { TScopedRunningTimeTrackerPause scopedTimePause(m_rTimeGuard); Index: src/libchcore/TFeedbackHandlerWrapper.h =================================================================== diff -u -re96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TFeedbackHandlerWrapper.h (.../TFeedbackHandlerWrapper.h) (revision e96806b7f8ff7ca7e9f4afbea603e6351a3dc3e3) +++ src/libchcore/TFeedbackHandlerWrapper.h (.../TFeedbackHandlerWrapper.h) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -36,11 +36,11 @@ TFeedbackHandlerWrapper(const TFeedbackHandlerWrapper&) = delete; TFeedbackHandlerWrapper& operator=(const TFeedbackHandlerWrapper&) = delete; - virtual EFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) override; - virtual EFeedbackResult FileAlreadyExists(const TFileInfoPtr& spSrcFileInfo, const TFileInfoPtr& spDstFileInfo) override; - virtual EFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) override; - virtual EFeedbackResult OperationFinished() override; - virtual EFeedbackResult OperationError() override; + virtual TFeedbackResult FileError(const TString& strSrcPath, const TString& strDstPath, EFileError eFileError, unsigned long ulError) override; + virtual TFeedbackResult FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) override; + virtual TFeedbackResult NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) override; + virtual TFeedbackResult OperationFinished() override; + virtual TFeedbackResult OperationError() override; virtual void RestoreDefaults() override; Index: src/libchcore/TFeedbackResult.cpp =================================================================== diff -u --- src/libchcore/TFeedbackResult.cpp (revision 0) +++ src/libchcore/TFeedbackResult.cpp (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -0,0 +1,39 @@ +// ============================================================================ +// Copyright (C) 2001-2015 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#include "stdafx.h" +#include "TFeedbackResult.h" + +namespace chcore +{ + TFeedbackResult::TFeedbackResult(EFeedbackResult eFeedbackResult, bool bAutomatedReply) : + m_eFeedbackResult(eFeedbackResult), + m_bAutomatedReply(bAutomatedReply) + { + } + + EFeedbackResult TFeedbackResult::GetResult() const + { + return m_eFeedbackResult; + } + + bool TFeedbackResult::IsAutomatedReply() const + { + return m_bAutomatedReply; + } +} Index: src/libchcore/TFeedbackResult.h =================================================================== diff -u --- src/libchcore/TFeedbackResult.h (revision 0) +++ src/libchcore/TFeedbackResult.h (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -0,0 +1,41 @@ +// ============================================================================ +// Copyright (C) 2001-2015 by Jozef Starosczyk +// ixen@copyhandler.com +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU Library General Public License +// (version 2) as published by the Free Software Foundation; +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU Library General Public +// License along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// ============================================================================ +#ifndef __TFEEDBACKRESULT_H__ +#define __TFEEDBACKRESULT_H__ + +#include "libchcore.h" +#include "EFeedbackResult.h" + +namespace chcore +{ + class LIBCHCORE_API TFeedbackResult + { + public: + TFeedbackResult(EFeedbackResult eFeedbackResult, bool bAutomatedReply); + + EFeedbackResult GetResult() const; + bool IsAutomatedReply() const; + + private: + EFeedbackResult m_eFeedbackResult; + bool m_bAutomatedReply; + }; +} + +#endif Index: src/libchcore/TFilesystemFeedbackWrapper.cpp =================================================================== diff -u -r25722a1d39e5d4bb49c5a60cbee3dda6c02cb193 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision 25722a1d39e5d4bb49c5a60cbee3dda6c02cb193) +++ src/libchcore/TFilesystemFeedbackWrapper.cpp (.../TFilesystemFeedbackWrapper.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -20,6 +20,7 @@ #include "TFilesystemFeedbackWrapper.h" #include #include "TFileException.h" +#include "TFileInfo.h" namespace chcore { @@ -60,8 +61,8 @@ strFormat.Replace(_T("%path"), pathDirectory.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathDirectory.ToWString(), TString(), EFileError::eCreateError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathDirectory.ToWString(), TString(), EFileError::eCreateError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -118,8 +119,8 @@ strFormat.Replace(_T("%path"), pathDestination.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathDestination.ToWString(), TString(), EFileError::eCheckForFreeSpace, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathDestination.ToWString(), TString(), EFileError::eCheckForFreeSpace, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -147,8 +148,8 @@ strFormat.Replace(_t("%availablesize"), boost::lexical_cast(ullAvailableSize).c_str()); m_rLog.logw(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->NotEnoughSpace(pathFirstSrc.ToWString(), pathDestination.ToWString(), ullNeededSize); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->NotEnoughSpace(pathFirstSrc.ToWString(), pathDestination.ToWString(), ullNeededSize); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: m_rLog.logi(_T("Cancel request while checking for free space on disk.")); @@ -211,8 +212,8 @@ strFormat.Replace(_T("%path"), spFileInfo->GetFullFilePath().ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(spFileInfo->GetFullFilePath().ToWString(), TString(), EFileError::eDeleteError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(spFileInfo->GetFullFilePath().ToWString(), TString(), EFileError::eDeleteError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: m_rLog.logi(_T("Cancel request while deleting file.")); @@ -275,8 +276,8 @@ strFormat.Replace(_T("%path"), spFileInfo->GetFullFilePath().ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(spFileInfo->GetFullFilePath().ToWString(), TString(), EFileError::eDeleteError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(spFileInfo->GetFullFilePath().ToWString(), TString(), EFileError::eDeleteError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: m_rLog.logi(_T("Cancel request while deleting file.")); @@ -337,8 +338,8 @@ strFormat.Replace(_T("%dstpath"), pathDestination.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathSrc.ToWString(), pathDestination.ToWString(), EFileError::eFastMoveError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathSrc.ToWString(), pathDestination.ToWString(), EFileError::eFastMoveError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -383,8 +384,8 @@ dwLastError = e.GetNativeError(); } - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathCurrent.ToWString(), TString(), EFileError::eFastMoveError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathCurrent.ToWString(), TString(), EFileError::eFastMoveError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; Index: src/libchcore/TFilesystemFileFeedbackWrapper.cpp =================================================================== diff -u -r41383599835bbab64d854eed179a7db21a59c6bf -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision 41383599835bbab64d854eed179a7db21a59c6bf) +++ src/libchcore/TFilesystemFileFeedbackWrapper.cpp (.../TFilesystemFileFeedbackWrapper.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -21,6 +21,7 @@ #include "TFileException.h" #include #include +#include "TFileInfo.h" namespace chcore { @@ -52,8 +53,8 @@ dwLastError = e.GetNativeError(); } - EFeedbackResult frResult = m_spFeedbackHandler->FileError(fileSrc->GetFilePath().ToWString(), TString(), EFileError::eCreateError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(fileSrc->GetFilePath().ToWString(), TString(), EFileError::eCreateError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Skip: break; // will return INVALID_HANDLE_VALUE @@ -88,7 +89,8 @@ BOOST_ASSERT(FALSE); // unknown result THROW_CORE_EXCEPTION(eErr_UnhandledCase); } - } while (bRetry); + } + while(bRetry); return TSubTaskBase::eSubResult_Continue; } @@ -114,8 +116,8 @@ dwLastError = e.GetNativeError(); } - EFeedbackResult frResult = m_spFeedbackHandler->FileError(fileDst->GetFilePath().ToWString(), TString(), EFileError::eCreateError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(fileDst->GetFilePath().ToWString(), TString(), EFileError::eCreateError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Retry: { @@ -196,8 +198,8 @@ fileDst->GetFileInfo(*spDstFileInfo); // src and dst files are the same - EFeedbackResult frResult = m_spFeedbackHandler->FileAlreadyExists(spSrcFileInfo, spDstFileInfo); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileAlreadyExists(*spSrcFileInfo, *spDstFileInfo); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Overwrite: ullSeekTo = 0; @@ -229,8 +231,8 @@ } else { - EFeedbackResult frResult = m_spFeedbackHandler->FileError(fileDst->GetFilePath().ToWString(), TString(), EFileError::eCreateError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(fileDst->GetFilePath().ToWString(), TString(), EFileError::eCreateError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Retry: { @@ -295,8 +297,8 @@ strFormat.Replace(_t("%path"), pathFile.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eResizeError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eResizeError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -347,8 +349,8 @@ strFormat.Replace(_t("%path"), pathFile.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eReadError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eReadError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -400,8 +402,8 @@ strFormat.Replace(_t("%path"), pathFile.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eWriteError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eWriteError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -452,8 +454,8 @@ strFormat.Replace(_t("%path"), pathFile.ToString()); m_rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eFinalizeError, dwLastError); - switch (frResult) + TFeedbackResult frResult = m_spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eFinalizeError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; Index: src/libchcore/TSubTaskCopyMove.cpp =================================================================== diff -u -r41383599835bbab64d854eed179a7db21a59c6bf -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 41383599835bbab64d854eed179a7db21a59c6bf) +++ src/libchcore/TSubTaskCopyMove.cpp (.../TSubTaskCopyMove.cpp) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -744,8 +744,8 @@ strFormat.Replace(_t("%path"), pathFile.ToString()); rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eReadError, dwLastError); - switch(frResult) + TFeedbackResult frResult = spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eReadError, dwLastError); + switch(frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; @@ -783,8 +783,8 @@ strFormat.Replace(_t("%path"), pathFile.ToString()); rLog.loge(strFormat.c_str()); - EFeedbackResult frResult = spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eWriteError, dwLastError); - switch (frResult) + TFeedbackResult frResult = spFeedbackHandler->FileError(pathFile.ToWString(), TString(), EFileError::eWriteError, dwLastError); + switch (frResult.GetResult()) { case EFeedbackResult::eResult_Cancel: return TSubTaskBase::eSubResult_CancelRequest; Index: src/libchcore/libchcore.vc140.vcxproj =================================================================== diff -u -r09d769045d1d5c45d8df16d209c754b872348c26 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/libchcore.vc140.vcxproj (.../libchcore.vc140.vcxproj) (revision 09d769045d1d5c45d8df16d209c754b872348c26) +++ src/libchcore/libchcore.vc140.vcxproj (.../libchcore.vc140.vcxproj) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -532,6 +532,7 @@ + @@ -766,6 +767,7 @@ + Index: src/libchcore/libchcore.vc140.vcxproj.filters =================================================================== diff -u -r09d769045d1d5c45d8df16d209c754b872348c26 -r4d1f8110906889d56552771fb58a6de86bc54a29 --- src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision 09d769045d1d5c45d8df16d209c754b872348c26) +++ src/libchcore/libchcore.vc140.vcxproj.filters (.../libchcore.vc140.vcxproj.filters) (revision 4d1f8110906889d56552771fb58a6de86bc54a29) @@ -473,6 +473,9 @@ Source Files\SubTasks + + Source Files\Feedback + @@ -865,5 +868,8 @@ Source Files\SubTasks + + Source Files\Feedback + \ No newline at end of file