OSDN Git Service

Send Mail Save attachment and combine status.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / SendMailDlg.cpp
index a92d4ef..1e78be1 100644 (file)
@@ -7,6 +7,7 @@
 #include "MessageBox.h"\r
 #include "commonresource.h"\r
 #include "AppUtils.h"\r
+\r
 // CSendMailDlg dialog\r
 \r
 IMPLEMENT_DYNAMIC(CSendMailDlg, CResizableStandAloneDialog)\r
@@ -16,9 +17,12 @@ CSendMailDlg::CSendMailDlg(CWnd* pParent /*=NULL*/)
        , m_To(_T(""))\r
        , m_CC(_T(""))\r
        , m_Subject(_T(""))\r
-       , m_bAttachment(FALSE)\r
-       , m_bCombine(FALSE)\r
+       \r
+       , m_regAttach(_T("Software\\TortoiseGit\\TortoiseProc\\SendMail\\Attach"),0)\r
+       , m_regCombine(_T("Software\\TortoiseGit\\TortoiseProc\\SendMail\\Combine"),0)\r
 {\r
+       m_bAttachment  = m_regAttach;\r
+       m_bCombine =     m_regCombine;\r
 \r
 }\r
 \r
@@ -104,12 +108,15 @@ void CSendMailDlg::OnBnClickedSendmailCombine()
        this->GetDlgItem(IDC_SENDMAIL_SUBJECT)->EnableWindow(this->m_bCombine);\r
        if(m_bCombine)\r
                GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(this->m_Subject);\r
+\r
+       UpdateSubject();\r
 }\r
 \r
 void CSendMailDlg::OnBnClickedOk()\r
 {\r
        \r
        this->UpdateData();\r
+\r
        if(this->m_To.IsEmpty() && this->m_CC.IsEmpty())\r
        {\r
                CMessageBox::Show(NULL,IDS_ERR_ADDRESS_NO_EMPTY,IDS_APPNAME,MB_OK|MB_ICONERROR);\r
@@ -131,13 +138,52 @@ void CSendMailDlg::OnBnClickedOk()
                m_AddressReg.Save();\r
        }       \r
        \r
+       this->m_PathList.Clear();\r
+       for(int i=0;i<m_ctrlList.GetItemCount();i++)\r
+       {\r
+               CTGitPath path;\r
+               if(m_ctrlList.GetCheck(i))\r
+               {\r
+                       path.SetFromWin(m_ctrlList.GetItemText(i,0));\r
+                       this->m_PathList.AddPath(path);\r
+               }\r
+       }\r
+\r
+       m_regAttach=m_bAttachment;\r
+       m_regCombine=m_bCombine;\r
+\r
        OnOK();\r
        // TODO: Add your control notification handler code here\r
 }\r
 \r
+void CSendMailDlg::UpdateSubject()\r
+{\r
+       this->UpdateData();\r
+\r
+       if(!this->m_bCombine)\r
+       {\r
+               if(m_ctrlList.GetSelectedCount()==1)\r
+               {\r
+                       POSITION pos=m_ctrlList.GetFirstSelectedItemPosition();\r
+                       int index=m_ctrlList.GetNextSelectedItem(pos);\r
+                       if(this->m_MapPatch.find(index) == m_MapPatch.end() )\r
+                       {\r
+                               m_MapPatch[index].Parser(m_ctrlList.GetItemText(index,0));\r
+                       }\r
+                       GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(m_MapPatch[index].m_Subject);\r
+               }\r
+               else\r
+               {\r
+                       GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(_T(""));\r
+               }\r
+       }\r
+}\r
+\r
 void CSendMailDlg::OnLvnItemchangedSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult)\r
 {\r
        LPNMLISTVIEW pNMLV = reinterpret_cast<LPNMLISTVIEW>(pNMHDR);\r
+       \r
+       UpdateSubject();\r
        // TODO: Add your control notification handler code here\r
        \r
        *pResult = 0;\r
@@ -164,5 +210,7 @@ void CSendMailDlg::OnEnChangeSendmailSubject()
        // with the ENM_CHANGE flag ORed into the mask.\r
 \r
        // TODO:  Add your control notification handler code here\r
-       GetDlgItem(IDC_SENDMAIL_SUBJECT)->GetWindowText(this->m_Subject);\r
+       this->UpdateData();\r
+       if(this->m_bCombine)\r
+               GetDlgItem(IDC_SENDMAIL_SUBJECT)->GetWindowText(this->m_Subject);\r
 }\r