Révision | 29055 (tree) |
---|---|
l'heure | 2021-01-12 02:55:00 |
Auteur | stefankueng |
patch from Matthias (https://groups.google.com/g/tortoisesvn-dev/c/LNDlILw3llI/m/0CF1qKpzCQAJ)
I've developed two more "copy to clipboard" commands:
- Bug IDs
- Bug Urls
Both are derived from bugtraq information.
@@ -154,6 +154,8 @@ | ||
154 | 154 | ID_COPYCLIPBOARDURLVIEWERREV, |
155 | 155 | ID_COPYCLIPBOARDURLVIEWERPATHREV, |
156 | 156 | ID_COPYCLIPBOARDURLTSVNSHOWCOMPARE, |
157 | + ID_COPYCLIPBOARDBUGID, | |
158 | + ID_COPYCLIPBOARDBUGURL, | |
157 | 159 | ID_COPYCLIPBOARDRELPATH, |
158 | 160 | ID_COPYCLIPBOARDFILENAMES, |
159 | 161 | ID_CHECKOUT, |
@@ -2230,6 +2232,59 @@ | ||
2230 | 2232 | } |
2231 | 2233 | } |
2232 | 2234 | |
2235 | +std::set<CString> CLogDlg::GetSelectedBugIds() | |
2236 | +{ | |
2237 | + std::set<CString> setAllBugIDs; | |
2238 | + POSITION pos = m_LogList.GetFirstSelectedItemPosition(); | |
2239 | + if (pos != NULL) | |
2240 | + { | |
2241 | + while (pos) | |
2242 | + { | |
2243 | + int index = m_LogList.GetNextSelectedItem(pos); | |
2244 | + if (index >= (int)m_logEntries.GetVisibleCount()) | |
2245 | + continue; | |
2246 | + PLOGENTRYDATA pLogEntry = m_logEntries.GetVisible(index); | |
2247 | + if (pLogEntry == NULL) | |
2248 | + continue; | |
2249 | + | |
2250 | + CString logMessage = CUnicodeUtils::StdGetUnicode(pLogEntry->GetMessageW()).c_str(); | |
2251 | + | |
2252 | + std::set<CString> setBugIDs = m_ProjectProperties.FindBugIDs(logMessage); | |
2253 | + setAllBugIDs.merge(setBugIDs); | |
2254 | + | |
2255 | + } | |
2256 | + } | |
2257 | + return setAllBugIDs; | |
2258 | +} | |
2259 | + | |
2260 | +void CLogDlg::CopySelectionToClipBoardBugId() | |
2261 | +{ | |
2262 | + std::set<CString> selectedBugIDs = GetSelectedBugIds(); | |
2263 | + CString sClipdata; | |
2264 | + std::set<CString>::iterator it; | |
2265 | + for (it = selectedBugIDs.begin(); it != selectedBugIDs.end(); ++it) { | |
2266 | + if (!sClipdata.IsEmpty()) { | |
2267 | + sClipdata += ", "; | |
2268 | + } | |
2269 | + sClipdata += *it; | |
2270 | + } | |
2271 | + CStringUtils::WriteAsciiStringToClipboard(sClipdata, GetSafeHwnd()); | |
2272 | +} | |
2273 | + | |
2274 | +void CLogDlg::CopySelectionToClipBoardBugUrl() | |
2275 | +{ | |
2276 | + std::set<CString> selectedBugIDs = GetSelectedBugIds(); | |
2277 | + CString sClipdata; | |
2278 | + std::set<CString>::iterator it; | |
2279 | + for (it = selectedBugIDs.begin(); it != selectedBugIDs.end(); ++it) { | |
2280 | + if (!sClipdata.IsEmpty()) { | |
2281 | + sClipdata += "\r\n"; | |
2282 | + } | |
2283 | + sClipdata += m_ProjectProperties.GetBugIDUrl(*it); | |
2284 | + } | |
2285 | + CStringUtils::WriteAsciiStringToClipboard(sClipdata, GetSafeHwnd()); | |
2286 | +} | |
2287 | + | |
2233 | 2288 | void CLogDlg::CopySelectionToClipBoard(bool bIncludeChangedList) |
2234 | 2289 | { |
2235 | 2290 | POSITION pos = m_LogList.GetFirstSelectedItemPosition(); |
@@ -5453,7 +5508,13 @@ | ||
5453 | 5508 | if (!m_ProjectProperties.sWebViewerPathRev.IsEmpty()) |
5454 | 5509 | clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDURLVIEWERPATHREV, IDS_LOG_POPUP_CLIPBOARD_URLVIEWERPATHREV, IDI_COPYCLIP); |
5455 | 5510 | clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDURLTSVNSHOWCOMPARE, IDS_LOG_POPUP_CLIPBOARD_TSVNSHOWCOMPARE, IDI_COPYCLIP); |
5511 | + if (!m_ProjectProperties.sWebViewerRev.IsEmpty()) | |
5512 | + clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDURLVIEWERREV, IDS_LOG_POPUP_CLIPBOARD_URLVIEWERREV, IDI_COPYCLIP); | |
5456 | 5513 | clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDFULLNOPATHS, IDS_LOG_POPUP_CLIPBOARD_FULLNOPATHS, IDI_COPYCLIP); |
5514 | + if (GetSelectedBugIds().size() > 0) { | |
5515 | + clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDBUGID, IDS_LOG_POPUP_CLIPBOARD_BUGID, IDI_COPYCLIP); | |
5516 | + clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDBUGURL, IDS_LOG_POPUP_CLIPBOARD_BUGURL, IDI_COPYCLIP); | |
5517 | + } | |
5457 | 5518 | clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDREVS, IDS_LOG_POPUP_CLIPBOARD_REVS, IDI_COPYCLIP); |
5458 | 5519 | clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDAUTHORS, IDS_LOG_POPUP_CLIPBOARD_AUTHORS, IDI_COPYCLIP); |
5459 | 5520 | clipSubMenu.AppendMenuIcon(ID_COPYCLIPBOARDMESSAGES, IDS_LOG_POPUP_CLIPBOARD_MSGS, IDI_COPYCLIP); |
@@ -5592,6 +5653,12 @@ | ||
5592 | 5653 | case ID_COPYCLIPBOARDURLTSVNSHOWCOMPARE: |
5593 | 5654 | CopySelectionToClipBoardTsvnShowCompare(); |
5594 | 5655 | break; |
5656 | + case ID_COPYCLIPBOARDBUGID: | |
5657 | + CopySelectionToClipBoardBugId(); | |
5658 | + break; | |
5659 | + case ID_COPYCLIPBOARDBUGURL: | |
5660 | + CopySelectionToClipBoardBugUrl(); | |
5661 | + break; | |
5595 | 5662 | case ID_COPYCLIPBOARDFULLNOPATHS: |
5596 | 5663 | CopySelectionToClipBoard(false); |
5597 | 5664 | break; |
@@ -276,6 +276,9 @@ | ||
276 | 276 | void CopySelectionToClipBoardViewerRev(); |
277 | 277 | void CopySelectionToClipBoardViewerPathRev(); |
278 | 278 | void CopySelectionToClipBoardTsvnShowCompare(); |
279 | + void CopySelectionToClipBoardBugId(); | |
280 | + std::set<CString> GetSelectedBugIds(); | |
281 | + void CopySelectionToClipBoardBugUrl(); | |
279 | 282 | void CopyCommaSeparatedRevisionsToClipboard(); |
280 | 283 | void CopyChangedSelectionToClipBoard(); |
281 | 284 | void CopyCommaSeparatedAuthorsToClipboard(); |