/*************************************************************************** * Copyright (C) 2001-2008 by Józef 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 "../libchcore/TFileInfo.h" #include "FeedbackHandler.h" #include "FeedbackReplaceDlg.h" #include "FeedbackFileErrorDlg.h" #include "FeedbackNotEnoughSpaceDlg.h" #include "ch.h" #include "mmsystem.h" using namespace chcore; CFeedbackHandler::CFeedbackHandler() : TFeedbackHandlerBase() { } CFeedbackHandler::~CFeedbackHandler() { } TFeedbackResult CFeedbackHandler::FileError(const TString& strSrcPath, const TString& strDstPath, EFileError /*eFileError*/, unsigned long ulError) { if(HasFileErrorPermanentResponse()) return TFeedbackResult(GetFileErrorPermanentResponse(), true); CFeedbackFileErrorDlg dlg(strSrcPath.c_str(), strDstPath.c_str(), ulError); EFeedbackResult eResult = (EFeedbackResult)dlg.DoModal(); if (dlg.m_bAllItems) SetFileErrorPermanentResponse(eResult); return TFeedbackResult(eResult, false); } TFeedbackResult CFeedbackHandler::FileAlreadyExists(const TFileInfo& spSrcFileInfo, const TFileInfo& spDstFileInfo) { if(HasFileAlreadyExistsPermanentResponse()) return TFeedbackResult(GetFileAlreadyExistsPermanentResponse(), true); CFeedbackReplaceDlg dlg(spSrcFileInfo, spDstFileInfo); EFeedbackResult eResult = (EFeedbackResult)dlg.DoModal(); if(dlg.m_bAllItems) SetFileAlreadyExistsPermanentResponse(eResult); return TFeedbackResult(eResult, false); } TFeedbackResult CFeedbackHandler::NotEnoughSpace(const TString& strSrcPath, const TString& strDstPath, unsigned long long ullRequiredSize) { if(HasNotEnoughSpacePermanentResponse()) return TFeedbackResult(GetNotEnoughSpacePermanentResponse(), true); CFeedbackNotEnoughSpaceDlg dlg(ullRequiredSize, strSrcPath.c_str(), strDstPath.c_str()); EFeedbackResult eResult = (EFeedbackResult) dlg.DoModal(); if (dlg.m_bAllItems) SetNotEnoughSpacePermanentResponse(eResult); return TFeedbackResult(eResult, false); } TFeedbackResult CFeedbackHandler::OperationFinished() { if (GetPropValue(GetConfig())) { CString strPath = GetPropValue(GetConfig()); GetApp().ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)); strPath.ReleaseBuffer(); PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); } return TFeedbackResult(eResult_Unknown, true); } TFeedbackResult CFeedbackHandler::OperationError() { if (GetPropValue(GetConfig())) { CString strPath = GetPropValue(GetConfig()); GetApp().ExpandPath(strPath.GetBufferSetLength(_MAX_PATH)); strPath.ReleaseBuffer(); PlaySound(strPath, NULL, SND_FILENAME | SND_ASYNC); } return TFeedbackResult(eResult_Unknown, true); }