Skip to content

Commit

Permalink
When you press the "Clear all recent items" button in the Shell Integ…
Browse files Browse the repository at this point in the history
…ration category of the Options dialog, delete not only the Jump List but also the history saved by CSuperComboBox. refs #2555
  • Loading branch information
sdottaka committed Nov 24, 2024
1 parent 5a0ee74 commit 85b7633
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Src/Common/SuperComboBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions Src/Common/SuperComboBox.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
18 changes: 18 additions & 0 deletions Src/PropShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "Win_VersionHelper.h"
#include "MergeCmdLineInfo.h"
#include "JumpList.h"
#include "SuperComboBox.h"
#include "Merge.h"

#ifdef _DEBUG
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 85b7633

Please sign in to comment.