From 85b763341671fc235412cbdfc965be3fb6ceffd6 Mon Sep 17 00:00:00 2001 From: sdottaka Date: Sun, 24 Nov 2024 20:13:16 +0900 Subject: [PATCH] When you press the "Clear all recent items" button in the Shell Integration category of the Options dialog, delete not only the Jump List but also the history saved by CSuperComboBox. refs #2555 --- Src/Common/SuperComboBox.cpp | 5 +++++ Src/Common/SuperComboBox.h | 1 + Src/PropShell.cpp | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/Src/Common/SuperComboBox.cpp b/Src/Common/SuperComboBox.cpp index 8ce33f06b18..bc04b61e9b5 100644 --- a/Src/Common/SuperComboBox.cpp +++ b/Src/Common/SuperComboBox.cpp @@ -321,6 +321,11 @@ void CSuperComboBox::SaveState(LPCTSTR szRegSubKey) AfxGetApp()->WriteProfileInt(szRegSubKey, _T("Empty"), strItem.IsEmpty()); } +void CSuperComboBox::ClearState(LPCTSTR szRegSubKey) +{ + AfxGetApp()->WriteProfileString(szRegSubKey, nullptr, nullptr); +} + BOOL CSuperComboBox::OnEditchange() { if (m_bHasImageList) diff --git a/Src/Common/SuperComboBox.h b/Src/Common/SuperComboBox.h index ddec4f3ff0c..8a54d050c83 100644 --- a/Src/Common/SuperComboBox.h +++ b/Src/Common/SuperComboBox.h @@ -63,6 +63,7 @@ class CSuperComboBox : public CComboBoxEx void SetFileControlStates(bool bCanBeEmpty = false, int nMaxItems = -1); void SaveState(LPCTSTR szRegSubKey); void LoadState(LPCTSTR szRegSubKey); + static void ClearState(LPCTSTR szRegSubKey); bool AttachSystemImageList(); int AddString(LPCTSTR lpszItem); int InsertString(int nIndex, LPCTSTR lpszItem); diff --git a/Src/PropShell.cpp b/Src/PropShell.cpp index 8a316506ac7..3f5413bbf55 100644 --- a/Src/PropShell.cpp +++ b/Src/PropShell.cpp @@ -16,6 +16,7 @@ #include "Win_VersionHelper.h" #include "MergeCmdLineInfo.h" #include "JumpList.h" +#include "SuperComboBox.h" #include "Merge.h" #ifdef _DEBUG @@ -433,6 +434,23 @@ void PropShell::OnUnregisterWinMergeContextMenu() void PropShell::OnClearAllRecentItems() { JumpList::RemoveRecentDocs(); + for (const auto& name : { + _T("ReportFiles"), + _T("Files\\Left"), + _T("Files\\Right"), + _T("Files\\Option"), + _T("Files\\Ext"), + _T("Files\\Unpacker"), + _T("Files\\Prediffer"), + _T("Files\\EditorScript"), + _T("Files\\DiffFileResult"), + _T("Files\\DiffFile1"), + _T("Files\\DiffFile2"), + _T("PatchCreator\\DiffContext"), + }) + { + CSuperComboBox::ClearState(name); + } } void PropShell::OnTimer(UINT_PTR nIDEvent)