#18 "SAVE MASK COMBO HISTORY TOO" PATCH

open
nobody
None
5
2012-12-07
2004-10-11
Anonymous
No

SAVE MASK COMBO HISTORY TOO!

In 7-zip File Manager, when selecting files by extensions
with "Edit/Select..." menu (or "Grey +"), "Select" combo
box displays the "*" mask, but doesn't save the history
of masks used.

This little patch (for v.4.08b) saves them into the
system Registry, like folder history, etc.

diff -ur ori/7zip/FileManager/PanelSelect.cpp
src/7zip/FileManager/PanelSelect.cpp
--- ori/7zip/FileManager/PanelSelect.cpp Mon Sep
29 18:35:08 2003
+++ src/7zip/FileManager/PanelSelect.cpp Sun Oct
10 13:44:55 2004
@@ -13,6 +13,8 @@

#include "LangUtils.h"

+#include "ViewSettings.h"
+
void CPanel::OnShiftSelectMessage()
{
int focusedItem = _listView.GetFocusedItem();
@@ -124,13 +126,24 @@
LangLoadStringW(IDS_DESELECT, 0x03020251);
comboDialog.Static = LangLoadStringW
(IDS_SELECT_MASK, 0x03020252);
comboDialog.Value = L"*";
+
+ UStringVector maskHistory;
+ ReadMaskHistory(maskHistory);
+ for (int i=0; i < maskHistory.Size(); i++)
+ comboDialog.Strings.Add(GetSystemString
(maskHistory[i]));
+
if (comboDialog.Create(GetParent()) == IDCANCEL)
return;
UString mask = GetUnicodeString(comboDialog.Value);
- for (int i = 0; i < _selectedStatusVector.Size(); i++)
+ for (i = 0; i < _selectedStatusVector.Size(); i++)
if (CompareWildCardWithName(mask, GetItemName
(i)))
_selectedStatusVector[i] = selectMode;
_listView.RedrawAllItems();
+
+ AddUniqueStringToHeadOfList
(maskHistory,GetUnicodeString(comboDialog.Value));
+ while (maskHistory.Size() > 20)
+ maskHistory.DeleteBack();
+ SaveMaskHistory(maskHistory);
}

void CPanel::SelectByType(bool selectMode)
diff -ur ori/7zip/FileManager/ViewSettings.cpp
src/7zip/FileManager/ViewSettings.cpp
--- ori/7zip/FileManager/ViewSettings.cpp Wed Sep
29 16:53:08 2004
+++ src/7zip/FileManager/ViewSettings.cpp Sun Oct
10 12:16:25 2004
@@ -24,6 +24,7 @@
static const TCHAR *kFolderHistoryValueName = TEXT
("FolderHistory");
static const TCHAR *kFastFoldersValueName = TEXT
("FolderShortcuts");
static const TCHAR *kCopyHistoryValueName = TEXT
("CopyHistory");
+static const TCHAR *kMaskHistoryValueName = TEXT
("MaskHistory");

/*
class CColumnInfoSpec
@@ -414,6 +415,11 @@
{ SaveStringList(kCopyHistoryValueName, folders); }
void ReadCopyHistory(UStringVector &folders)
{ ReadStringList(kCopyHistoryValueName, folders); }
+
+void SaveMaskHistory(const UStringVector
&maskHistory)
+ { SaveStringList(kMaskHistoryValueName,
maskHistory); }
+void ReadMaskHistory(UStringVector &maskHistory)
+ { ReadStringList(kMaskHistoryValueName,
maskHistory); }

void AddUniqueStringToHeadOfList(UStringVector &list,
const UString &string)
diff -ur ori/7zip/FileManager/ViewSettings.h
src/7zip/FileManager/ViewSettings.h
--- ori/7zip/FileManager/ViewSettings.h Wed Sep
29 00:52:04 2004
+++ src/7zip/FileManager/ViewSettings.h Sun Oct
10 12:17:22 2004
@@ -93,6 +93,9 @@
void SaveCopyHistory(const UStringVector &folders);
void ReadCopyHistory(UStringVector &folders);

+void SaveMaskHistory(const UStringVector
&maskHistory);
+void ReadMaskHistory(UStringVector &maskHistory);
+
void AddUniqueStringToHeadOfList(UStringVector &list,
const UString &string);

Discussion