From 6d0d0ea30781d563741e6886dc7ff99a8b6432a1 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 9 Mar 2013 22:45:17 +0100 Subject: [PATCH] Fixed issue #1542: Can send pull request email Signed-off-by: Sven Strickroth Signed-off-by: Sup Yut Sum --- src/Changelog.txt | 1 + src/Resources/TortoiseProcENG.rc | 1 + src/TortoiseProc/AppUtils.cpp | 29 +++++++++++++++++++++++++++++ src/TortoiseProc/RequestPullDlg.cpp | 6 ++++++ src/TortoiseProc/RequestPullDlg.h | 5 ++++- src/TortoiseProc/SendMailDlg.cpp | 13 +++++++++++-- src/TortoiseProc/SendMailDlg.h | 3 ++- 7 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index a18aa8f00..5ad501cb0 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -23,6 +23,7 @@ Released: unreleased * Fixed issue #1663: F5 does not refresh the revision graph * Fixed issue #522: Store password for HTTP * Fixed issue #1660: Save Push Dialog "Push all branches" and "Use Thin Pack" options + * Fixed issue #1542: Can send pull request email == Bug Fixes == * Fixed issue #1642: Incorrect behavior if repo is located on root of drive diff --git a/src/Resources/TortoiseProcENG.rc b/src/Resources/TortoiseProcENG.rc index 730ec5943..87d2c19dd 100644 --- a/src/Resources/TortoiseProcENG.rc +++ b/src/Resources/TortoiseProcENG.rc @@ -1098,6 +1098,7 @@ BEGIN CONTROL "",IDC_COMBOBOXEX_URL,"ComboBoxEx32",CBS_DROPDOWN | CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP,62,25,242,54 LTEXT "End",IDC_STATIC_REMOTE_BRANCH,7,46,13,8 EDITTEXT IDC_REMOTE_BRANCH,62,44,242,13,ES_AUTOHSCROLL + CONTROL "Send Mail after create",IDC_CHECK_SENDMAIL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,60,166,10 DEFPUSHBUTTON "OK",IDOK,141,70,50,14 PUSHBUTTON "Cancel",IDCANCEL,197,70,50,14 PUSHBUTTON "Help",IDHELP,254,70,50,14 diff --git a/src/TortoiseProc/AppUtils.cpp b/src/TortoiseProc/AppUtils.cpp index 28daa50b7..f1163d21b 100644 --- a/src/TortoiseProc/AppUtils.cpp +++ b/src/TortoiseProc/AppUtils.cpp @@ -2453,6 +2453,35 @@ bool CAppUtils::RequestPull(CString endrevision, CString repositoryUrl) sysProgressDlg.Stop(); + if (dlg.m_bSendMail) + { + CSendMailDlg dlg; + dlg.m_PathList = CTGitPathList(CTGitPath(tempFileName)); + dlg.m_bCustomSubject = true; + + if (dlg.DoModal() == IDOK) + { + if(dlg.m_PathList.GetCount() == 0) + return FALSE; + + CGitProgressDlg progDlg; + + theApp.m_pMainWnd = &progDlg; + progDlg.SetCommand(CGitProgressList::GitProgress_SendMail); + + progDlg.SetPathList(dlg.m_PathList); + progDlg.SetItemCount(dlg.m_PathList.GetCount()); + + CSendMailCombineable sendMailCombineable(dlg.m_To, dlg.m_CC, dlg.m_Subject, !!dlg.m_bAttachment, !!dlg.m_bCombine, !!dlg.m_bUseMAPI); + progDlg.SetSendMailOption(&sendMailCombineable); + + progDlg.DoModal(); + + return true; + } + return false; + } + CAppUtils::LaunchAlternativeEditor(tempFileName); } return true; diff --git a/src/TortoiseProc/RequestPullDlg.cpp b/src/TortoiseProc/RequestPullDlg.cpp index e954f881e..ea18baaac 100644 --- a/src/TortoiseProc/RequestPullDlg.cpp +++ b/src/TortoiseProc/RequestPullDlg.cpp @@ -1,5 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control +// Copyright (C) 2011-2013 - TortoiseGit // Copyright (C) 2011-2013 Sven Strickroth, // with code of PullFetchDlg.cpp @@ -31,7 +32,9 @@ IMPLEMENT_DYNAMIC(CRequestPullDlg, CHorizontalResizableStandAloneDialog) CRequestPullDlg::CRequestPullDlg(CWnd* pParent /*=NULL*/) : CHorizontalResizableStandAloneDialog(CRequestPullDlg::IDD, pParent) + , m_regSendMail(_T("Software\\TortoiseGit\\TortoiseProc\\RequestPull\\SendMail"), FALSE) { + m_bSendMail = m_regSendMail; } CRequestPullDlg::~CRequestPullDlg() @@ -44,6 +47,7 @@ void CRequestPullDlg::DoDataExchange(CDataExchange* pDX) DDX_Control(pDX, IDC_COMBOBOXEX_LOCAL_BRANCH, m_cStartRevision); DDX_Control(pDX, IDC_COMBOBOXEX_URL, m_cRepositoryURL); DDX_Control(pDX, IDC_REMOTE_BRANCH, m_cEndRevision); + DDX_Check(pDX, IDC_CHECK_SENDMAIL, m_bSendMail); } @@ -134,6 +138,8 @@ void CRequestPullDlg::OnBnClickedOk() if(m_StartRevision.Find(_T("remotes/")) == 0) m_StartRevision = m_StartRevision.Mid(8); + m_regSendMail = m_bSendMail; + CHorizontalResizableStandAloneDialog::OnOK(); } diff --git a/src/TortoiseProc/RequestPullDlg.h b/src/TortoiseProc/RequestPullDlg.h index 0cd348195..46f17e09d 100644 --- a/src/TortoiseProc/RequestPullDlg.h +++ b/src/TortoiseProc/RequestPullDlg.h @@ -1,6 +1,7 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2011 Sven Strickroth, +// Copyright (C) 2011-2013 - TortoiseGit +// Copyright (C) 2011,2013 Sven Strickroth, // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -50,8 +51,10 @@ protected: CRegString m_RegStartRevision; CRegString m_RegRepositoryURL; CRegString m_RegEndRevision; + CRegDWORD m_regSendMail; public: + BOOL m_bSendMail; CString m_StartRevision; CString m_RepositoryURL; CString m_EndRevision; diff --git a/src/TortoiseProc/SendMailDlg.cpp b/src/TortoiseProc/SendMailDlg.cpp index e2ced8a40..51887d900 100644 --- a/src/TortoiseProc/SendMailDlg.cpp +++ b/src/TortoiseProc/SendMailDlg.cpp @@ -35,6 +35,7 @@ CSendMailDlg::CSendMailDlg(CWnd* pParent /*=NULL*/) , m_To(_T("")) , m_CC(_T("")) , m_Subject(_T("")) + , m_bCustomSubject(FALSE) , m_regAttach(_T("Software\\TortoiseGit\\TortoiseProc\\SendMail\\Attach"),0) , m_regCombine(_T("Software\\TortoiseGit\\TortoiseProc\\SendMail\\Combine"),0) @@ -143,6 +144,9 @@ BOOL CSendMailDlg::OnInitDialog() m_ctrlList.SetCheck(i,true); } + if (m_PathList.GetCount() == 1) + m_ctrlList.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED); + // m_ctrlCC.AddSearchString(_T("Tortoisegit-dev@google.com")); // m_ctrlTO.AddSearchString(_T("Tortoisegit-dev@google.com")); this->UpdateData(FALSE); @@ -165,6 +169,10 @@ BOOL CSendMailDlg::OnInitDialog() void CSendMailDlg::OnBnClickedSendmailCombine() { this->UpdateData(); + + if (m_bCustomSubject) + return; + this->GetDlgItem(IDC_SENDMAIL_SUBJECT)->EnableWindow(this->m_bCombine); if(m_bCombine) GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(this->m_Subject); @@ -241,7 +249,8 @@ void CSendMailDlg::UpdateSubject() void CSendMailDlg::OnLvnItemchangedSendmailPatchs(NMHDR * /*pNMHDR*/, LRESULT *pResult) { - UpdateSubject(); + if (!m_bCustomSubject) + UpdateSubject(); *pResult = 0; } @@ -262,7 +271,7 @@ void CSendMailDlg::OnNMDblclkSendmailPatchs(NMHDR *pNMHDR, LRESULT *pResult) void CSendMailDlg::OnEnChangeSendmailSubject() { this->UpdateData(); - if(this->m_bCombine) + if (m_bCombine || m_bCustomSubject) GetDlgItem(IDC_SENDMAIL_SUBJECT)->GetWindowText(this->m_Subject); } diff --git a/src/TortoiseProc/SendMailDlg.h b/src/TortoiseProc/SendMailDlg.h index 803e28550..6b13a4ff3 100644 --- a/src/TortoiseProc/SendMailDlg.h +++ b/src/TortoiseProc/SendMailDlg.h @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2011 - TortoiseGit +// Copyright (C) 2008-2013 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -58,6 +58,7 @@ public: CString m_To; CString m_CC; CString m_Subject; + BOOL m_bCustomSubject; BOOL m_bAttachment; BOOL m_bCombine; BOOL m_bUseMAPI; -- 2.11.4.GIT