Clone
ixen
committed
on 12 Nov 20
Changed calculation of destination paths for special copy options when rename is used.
src/ch/StatusDlg.cpp (+10 -1)
9 9 *   This program is distributed in the hope that it will be useful,       *
10 10 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11 11 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12 12 *   GNU General Public License for more details.                          *
13 13 *                                                                         *
14 14 *   You should have received a copy of the GNU Library General Public     *
15 15 *   License along with this program; if not, write to the                 *
16 16 *   Free Software Foundation, Inc.,                                       *
17 17 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18 18 ***************************************************************************/
19 19 #include "stdafx.h"
20 20 #include "ch.h"
21 21 #include "resource.h"
22 22 #include "StatusDlg.h"
23 23 #include "BufferSizeDlg.h"
24 24 #include "StringHelpers.h"
25 25 #include "StaticEx.h"
26 26 #include "Structs.h"
27 27 #include "CfgProperties.h"
28 28 #include "../libchengine/TTaskManager.h"
  29 #include "../libchengine/TLocalFilesystem.h"
29 30
30 31 #ifdef _DEBUG
31 32 #define new DEBUG_NEW
32 33 #undef THIS_FILE
33 34 static char THIS_FILE[] = __FILE__;
34 35 #endif
35 36
36 37 bool CStatusDlg::m_bLock=false;
37 38
38 39 /////////////////////////////////////////////////////////////////////////////
39 40 // CStatusDlg dialog
40 41
41 42 CStatusDlg::CStatusDlg(chengine::TTaskManager* pTasks, CWnd* pParent /*=nullptr*/)
42 43         : ictranslate::CLanguageDialog(IDD_STATUS_DIALOG, pParent, &m_bLock),
43 44         m_pTasks(pTasks),
44 45         m_spTaskMgrStats(new chengine::TTaskManagerStatsSnapshot)
45 46 {
46 47         RegisterStaticExControl(AfxGetInstanceHandle());
47 48 }
48 49
 
716 717
717 718 void CStatusDlg::OnSelectionChanged(NMHDR* /*pNMHDR*/, LRESULT* /*pResult*/)
718 719 {
719 720         TRACE("Received LVN_CHANGEDSELECTION\n");
720 721         RefreshStatus();
721 722 }
722 723
723 724 void CStatusDlg::OnCancel()
724 725 {
725 726         PostCloseMessage();
726 727         CLanguageDialog::OnCancel();
727 728 }
728 729
729 730 void CStatusDlg::OnShowLogButton()
730 731 {
731 732         // show log
732 733         chengine::TTaskPtr spTask = GetSelectedItemPointer();
733 734         if(!spTask)
734 735                 return;
735 736
736           ULONG_PTR hResult = (ULONG_PTR)ShellExecute(this->m_hWnd, _T("open"), _T("notepad.exe"), spTask->GetLogPath().ToString(), nullptr, SW_SHOWNORMAL);
  737         chcore::TSmartPath logPath = spTask->GetLogPath();
  738         chengine::TLocalFilesystem localFilesystem(GetLogFileData());
  739         if(!localFilesystem.PathExist(logPath))
  740         {
  741                 MsgBox(IDS_LOGFILEEMPTY_STRING, MB_OK | MB_ICONINFORMATION);
  742                 return;
  743         }
  744
  745         ULONG_PTR hResult = (ULONG_PTR)ShellExecute(this->m_hWnd, _T("open"), _T("notepad.exe"), logPath.ToString(), nullptr, SW_SHOWNORMAL);
737 746         if(hResult < 32)
738 747         {
739 748                 ictranslate::CFormat fmt(GetResManager().LoadString(IDS_SHELLEXECUTEERROR_STRING));
740 749                 fmt.SetParam(_T("%errno"), hResult);
741 750                 fmt.SetParam(_T("%path"), spTask->GetLogPath().ToString());
742 751                 AfxMessageBox(fmt.ToString());
743 752         }
744 753 }
745 754
746 755 LRESULT CStatusDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
747 756 {
748 757         if (message == WM_UPDATESTATUS)
749 758         {
750 759                 TRACE("Received WM_UPDATESTATUS\n");
751 760                 RefreshStatus();
752 761         }
753 762         return ictranslate::CLanguageDialog::WindowProc(message, wParam, lParam);
754 763 }
755 764
756 765 void CStatusDlg::OnStickButton()