From: Frank Li Date: Wed, 15 Apr 2009 08:06:57 +0000 (+0800) Subject: Update Email Subject at sendmaildlg X-Git-Url: http://git.sourceforge.jp/view?p=tortoisegit%2FTortoiseGitJp.git;a=commitdiff_plain;h=5e335d580e8d857086646b478916738e8530dd0e Update Email Subject at sendmaildlg Signed-off-by: Frank Li --- diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index fac9095..234338e 100644 Binary files a/src/Resources/TortoiseProcENG.rc and b/src/Resources/TortoiseProcENG.rc differ diff --git a/src/TortoiseProc/Patch.cpp b/src/TortoiseProc/Patch.cpp new file mode 100644 index 0000000..c5622c4 --- /dev/null +++ b/src/TortoiseProc/Patch.cpp @@ -0,0 +1,42 @@ +#include "StdAfx.h" +#include "Patch.h" + +CPatch::CPatch() +{ + +} + +CPatch::~CPatch() +{ + + +} + +int CPatch::Parser(CString &pathfile) +{ + CString str; + + CStdioFile PatchFile; + + m_PathFile=pathfile; + if( ! PatchFile.Open(pathfile,CFile::modeRead) ) + return -1; + + int i=0; + while(PatchFile.ReadString(str)) + { + if(i==1) + this->m_Author=str.Right( str.GetLength() - 6 ); + if(i==2) + this->m_Date = str.Right( str.GetLength() - 6 ); + if(i==3) + this->m_Subject = str.Right( str.GetLength() - 8 ); + if(i==4) + break; + i++; + } + + + PatchFile.Close(); + +} \ No newline at end of file diff --git a/src/TortoiseProc/Patch.h b/src/TortoiseProc/Patch.h new file mode 100644 index 0000000..49ad7db --- /dev/null +++ b/src/TortoiseProc/Patch.h @@ -0,0 +1,17 @@ +#pragma once + +class CPatch +{ + + +public: + CPatch(); + ~CPatch(void); + int Parser(CString &pathfile); + + CString m_Author; + CString m_Date; + CString m_Subject; + CString m_PathFile; + CString m_Body; +}; diff --git a/src/TortoiseProc/SendMailDlg.cpp b/src/TortoiseProc/SendMailDlg.cpp index a92d4ef..dee06f9 100644 --- a/src/TortoiseProc/SendMailDlg.cpp +++ b/src/TortoiseProc/SendMailDlg.cpp @@ -104,12 +104,15 @@ void CSendMailDlg::OnBnClickedSendmailCombine() this->GetDlgItem(IDC_SENDMAIL_SUBJECT)->EnableWindow(this->m_bCombine); if(m_bCombine) GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(this->m_Subject); + + UpdateSubject(); } void CSendMailDlg::OnBnClickedOk() { this->UpdateData(); + if(this->m_To.IsEmpty() && this->m_CC.IsEmpty()) { CMessageBox::Show(NULL,IDS_ERR_ADDRESS_NO_EMPTY,IDS_APPNAME,MB_OK|MB_ICONERROR); @@ -131,13 +134,48 @@ void CSendMailDlg::OnBnClickedOk() m_AddressReg.Save(); } + this->m_PathList.Clear(); + for(int i=0;im_PathList.AddPath(path); + } + } OnOK(); // TODO: Add your control notification handler code here } +void CSendMailDlg::UpdateSubject() +{ + this->UpdateData(); + + if(!this->m_bCombine) + { + if(m_ctrlList.GetSelectedCount()==1) + { + POSITION pos=m_ctrlList.GetFirstSelectedItemPosition(); + int index=m_ctrlList.GetNextSelectedItem(pos); + if(this->m_MapPatch.find(index) == m_MapPatch.end() ) + { + m_MapPatch[index].Parser(m_ctrlList.GetItemText(index,0)); + } + GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(m_MapPatch[index].m_Subject); + } + else + { + GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(_T("")); + } + } +} + void CSendMailDlg::OnLvnItemchangedSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult) { LPNMLISTVIEW pNMLV = reinterpret_cast(pNMHDR); + + UpdateSubject(); // TODO: Add your control notification handler code here *pResult = 0; @@ -164,5 +202,7 @@ void CSendMailDlg::OnEnChangeSendmailSubject() // with the ENM_CHANGE flag ORed into the mask. // TODO: Add your control notification handler code here - GetDlgItem(IDC_SENDMAIL_SUBJECT)->GetWindowText(this->m_Subject); + this->UpdateData(); + if(this->m_bCombine) + GetDlgItem(IDC_SENDMAIL_SUBJECT)->GetWindowText(this->m_Subject); } diff --git a/src/TortoiseProc/SendMailDlg.h b/src/TortoiseProc/SendMailDlg.h index 836f942..571e50f 100644 --- a/src/TortoiseProc/SendMailDlg.h +++ b/src/TortoiseProc/SendMailDlg.h @@ -6,6 +6,7 @@ #include "ACEdit.h" #include "RegHistory.h" #include "TGitPath.h" +#include "patch.h" class CSendMailDlg : public CResizableStandAloneDialog { @@ -23,6 +24,8 @@ protected: virtual BOOL OnInitDialog(); DECLARE_MESSAGE_MAP() + void UpdateSubject(); + CHyperLink m_SmtpSetup; CACEdit m_ctrlCC; @@ -37,6 +40,9 @@ public: CListCtrl m_ctrlList; CTGitPathList m_PathList; + + std::map m_MapPatch; + afx_msg void OnBnClickedSendmailCombine(); afx_msg void OnBnClickedOk(); afx_msg void OnLvnItemchangedSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult); diff --git a/src/TortoiseProc/TortoiseProc.vcproj b/src/TortoiseProc/TortoiseProc.vcproj index 60c3f9f..7c20b83 100644 --- a/src/TortoiseProc/TortoiseProc.vcproj +++ b/src/TortoiseProc/TortoiseProc.vcproj @@ -403,6 +403,14 @@ > + + + + @@ -556,11 +564,11 @@ >