No need to explicitly initialize CString and use Empty() for clearing CString
[TortoiseGit.git] / src / TortoiseProc / DeleteConflictDlg.cpp
blobbc4189517cff5fdb8aba2ed14deee85b510fa01d
1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2009-2012, 2014-2015 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 // DeleteConflictDlg.cpp : implementation file
22 #include "stdafx.h"
23 #include "resource.h"
24 #include "DeleteConflictDlg.h"
25 #include "AppUtils.h"
26 #include "Git.h"
28 // CDeleteConflictDlg dialog
30 IMPLEMENT_DYNAMIC(CDeleteConflictDlg, CStandAloneDialog)
32 CDeleteConflictDlg::CDeleteConflictDlg(CWnd* pParent /*=NULL*/)
33 : CStandAloneDialog(CDeleteConflictDlg::IDD, pParent)
35 m_bShowModifiedButton = FALSE;
36 m_bIsDelete =FALSE;
39 CDeleteConflictDlg::~CDeleteConflictDlg()
43 void CDeleteConflictDlg::DoDataExchange(CDataExchange* pDX)
45 CDialog::DoDataExchange(pDX);
47 DDX_Text(pDX, IDC_LOCAL_STATUS, m_LocalStatus);
48 DDX_Text(pDX, IDC_REMOTE_STATUS, m_RemoteStatus);
49 DDX_Text(pDX, IDC_FROMHASH, m_LocalHash);
50 DDX_Text(pDX, IDC_TOHASH, m_RemoteHash);
54 BEGIN_MESSAGE_MAP(CDeleteConflictDlg, CStandAloneDialog)
55 ON_BN_CLICKED(IDC_LOG, OnBnClickedLog)
56 ON_BN_CLICKED(IDC_LOG2, OnBnClickedLog2)
57 ON_BN_CLICKED(IDC_DELETE, &CDeleteConflictDlg::OnBnClickedDelete)
58 ON_BN_CLICKED(IDC_MODIFY, &CDeleteConflictDlg::OnBnClickedModify)
59 ON_BN_CLICKED(IDHELP, &OnHelp)
60 END_MESSAGE_MAP()
63 BOOL CDeleteConflictDlg::OnInitDialog()
65 CStandAloneDialog::OnInitDialog();
67 if(this->m_bShowModifiedButton )
68 this->GetDlgItem(IDC_MODIFY)->SetWindowText(CString(MAKEINTRESOURCE(IDS_SVNACTION_MODIFIED)));
69 else
70 this->GetDlgItem(IDC_MODIFY)->SetWindowText(CString(MAKEINTRESOURCE(IDS_PROC_CREATED)));
71 if (m_LocalHash.IsEmpty())
72 GetDlgItem(IDC_LOG)->ShowWindow(SW_HIDE);
73 if (m_RemoteHash.IsEmpty())
74 GetDlgItem(IDC_LOG2)->ShowWindow(SW_HIDE);
76 CString sWindowTitle;
77 GetWindowText(sWindowTitle);
78 CAppUtils::SetWindowTitle(m_hWnd, this->m_File, sWindowTitle);
80 GetDlgItem(IDC_INFOLABEL)->SetWindowText(m_File);
82 GetDlgItem(IDCANCEL)->SetFocus();
84 return FALSE;
86 // CDeleteConflictDlg message handlers
88 void CDeleteConflictDlg::OnBnClickedLog()
90 ShowLog(m_LocalHash);
93 void CDeleteConflictDlg::OnBnClickedLog2()
95 ShowLog(m_RemoteHash);
98 void CDeleteConflictDlg::OnBnClickedDelete()
100 m_bIsDelete = TRUE;
101 OnOK();
104 void CDeleteConflictDlg::OnBnClickedModify()
106 m_bIsDelete = FALSE;
107 OnOK();
110 void CDeleteConflictDlg::ShowLog(CString hash)
112 CString sCmd;
113 sCmd.Format(_T("/command:log /path:\"%s\" /endrev:%s"), (LPCTSTR)g_Git.CombinePath(m_File), (LPCTSTR)hash);
114 CAppUtils::RunTortoiseGitProc(sCmd, false, false);