mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Read recent filters from registry following a numeric counter, instead of taking GetValueNames, which has a wrong sort order. See http://www.heidisql.com/forum.php?t=11161
This commit is contained in:
@ -8849,7 +8849,6 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.EnumerateRecentFilters;
|
procedure TMainForm.EnumerateRecentFilters;
|
||||||
var
|
var
|
||||||
flt: TStringList;
|
|
||||||
i: Integer;
|
i: Integer;
|
||||||
item: TMenuItem;
|
item: TMenuItem;
|
||||||
rx: TRegExpr;
|
rx: TRegExpr;
|
||||||
@ -8864,25 +8863,23 @@ begin
|
|||||||
Path := GetRegKeyTable+'\'+REGKEY_RECENTFILTERS;
|
Path := GetRegKeyTable+'\'+REGKEY_RECENTFILTERS;
|
||||||
if AppSettings.SessionPathExists(Path) then begin
|
if AppSettings.SessionPathExists(Path) then begin
|
||||||
AppSettings.SessionPath := Path;
|
AppSettings.SessionPath := Path;
|
||||||
flt := AppSettings.GetValueNames;
|
|
||||||
rx := TRegExpr.Create;
|
rx := TRegExpr.Create;
|
||||||
rx.Expression := '\s+';
|
rx.Expression := '\s+';
|
||||||
for i:=0 to flt.Count-1 do begin
|
for i:=1 to 20 do begin
|
||||||
// Previously introduced bugs stored some other settings here, see issue #2127
|
// Previously introduced bugs stored some other settings here, see issue #2127
|
||||||
if flt[i] <> IntToStr(MakeInt(flt[i])) then
|
|
||||||
continue;
|
|
||||||
item := TMenuItem.Create(popupFilter);
|
item := TMenuItem.Create(popupFilter);
|
||||||
capt := AppSettings.ReadString(flt[i]);
|
capt := AppSettings.ReadString(asRecentFilter, IntToStr(i));
|
||||||
|
if IsEmpty(capt) then
|
||||||
|
Break;
|
||||||
capt := rx.Replace(capt, ' ', True);
|
capt := rx.Replace(capt, ' ', True);
|
||||||
item.Hint := capt;
|
item.Hint := capt;
|
||||||
item.Caption := sstr(capt, 50);
|
item.Caption := sstr(capt, 50);
|
||||||
item.Tag := MakeInt(flt[i]);
|
item.Tag := i;
|
||||||
item.OnClick := LoadRecentFilter;
|
item.OnClick := LoadRecentFilter;
|
||||||
menuRecentFilters.Add(item);
|
menuRecentFilters.Add(item);
|
||||||
comboRecentFilters.Items.Add(sstr(capt, 100));
|
comboRecentFilters.Items.Add(sstr(capt, 100));
|
||||||
end;
|
end;
|
||||||
FreeAndNil(rx);
|
FreeAndNil(rx);
|
||||||
FreeAndNil(flt);
|
|
||||||
AppSettings.ResetPath;
|
AppSettings.ResetPath;
|
||||||
menuRecentFilters.Enabled := menuRecentFilters.Count > 0;
|
menuRecentFilters.Enabled := menuRecentFilters.Count > 0;
|
||||||
end;
|
end;
|
||||||
@ -8914,7 +8911,7 @@ begin
|
|||||||
SynMemoFilter.UndoList.AddGroupBreak;
|
SynMemoFilter.UndoList.AddGroupBreak;
|
||||||
SynMemoFilter.BeginUpdate;
|
SynMemoFilter.BeginUpdate;
|
||||||
SynMemoFilter.SelectAll;
|
SynMemoFilter.SelectAll;
|
||||||
SynMemoFilter.SelText := AppSettings.ReadString(IntToStr(key));
|
SynMemoFilter.SelText := AppSettings.ReadString(asRecentFilter, IntToStr(key));
|
||||||
SynMemoFilter.EndUpdate;
|
SynMemoFilter.EndUpdate;
|
||||||
AppSettings.ResetPath;
|
AppSettings.ResetPath;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user