ADD: cm_SetSortMode command (#2642)

This commit is contained in:
j2969719 2025-12-10 08:29:36 +03:00 committed by GitHub
commit 039bc46b18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 64 additions and 1 deletions

View file

@ -2871,6 +2871,13 @@ object frmMain: TfrmMain
HelpType = htKeyword
OnExecute = actExecute
end
object actSetSortMode: TAction
Tag = 7
Category = 'Configuration'
Caption = 'Set Sort Mode'
HelpType = htKeyword
OnExecute = actExecute
end
end
object pmHotList: TPopupMenu
Images = imgLstDirectoryHotlist

View file

@ -232,6 +232,7 @@ type
actConfigToolbars: TAction;
actDebugShowCommandParameters: TAction;
actOpenDriveByIndex: TAction;
actSetSortMode: TAction;
btnF10: TSpeedButton;
btnF3: TSpeedButton;
btnF4: TSpeedButton;

View file

@ -385,6 +385,7 @@ type
procedure cm_OpenDriveByIndex(const Params: array of string);
procedure cm_AddPlugin(const Params: array of string);
procedure cm_LoadList(const Params: array of string);
procedure cm_SetSortMode(const Params: array of string);
// Internal commands
procedure cm_ExecuteToolbarItem(const Params: array of string);
@ -413,7 +414,7 @@ uses fOptionsPluginsBase, fOptionsPluginsDSX, fOptionsPluginsWCX,
uHotDir, DCXmlConfig, dmCommonData, fOptionsFrame, foptionsDirectoryHotlist,
fMainCommandsDlg, uConnectionManager, fOptionsFavoriteTabs, fTreeViewMenu,
uArchiveFileSource, fOptionsHotKeys, fBenchmark, uAdministrator, uWcxArchiveFileSource,
uColumnsFileView
uColumnsFileView, uTypes
;
resourcestring
@ -5672,5 +5673,59 @@ begin
end;
end;
procedure TMainCommands.cm_SetSortMode(const Params: array of string);
var
Param, Value: String;
State: Boolean;
begin
for Param in Params do
begin
if GetParamValue(Param, 'casesensitivity', Value) then
begin
if Value = 'notsensitive' then
gSortCaseSensitivity:= cstNotSensitive
else if Value = 'locale' then
gSortCaseSensitivity:= cstLocale
else if Value = 'charvalue' then
gSortCaseSensitivity:= cstCharValue;
end
else if GetParamValue(Param, 'foldermode', Value) then
begin
if Value = 'nameshowfirst' then
gSortFolderMode:= sfmSortNameShowFirst
else if Value = 'likefileshowfirst' then
gSortFolderMode:= sfmSortLikeFileShowFirst
else if Value = 'likefile' then
gSortFolderMode:= sfmSortLikeFile;
end
else if GetParamBoolValue(Param, 'natural', State) then
gSortNatural:= State
else if GetParamBoolValue(Param, 'special', State) then
gSortSpecial:= State
else if GetParamValue(Param, 'newfiles', Value) then
begin
if Value = 'top' then
gNewFilesPosition:= nfpTop
else if Value = 'topafterdirectories' then
gNewFilesPosition:= nfpTopAfterDirectories
else if Value = 'sortedposition' then
gNewFilesPosition:= nfpSortedPosition
else if Value = 'bottom' then
gNewFilesPosition:= nfpBottom;
end
else if GetParamValue(Param, 'updatedfiles', Value) then
begin
if Value = 'nochange' then
gUpdatedFilesPosition:= ufpNoChange
else if Value = 'sameasnewfiles' then
gUpdatedFilesPosition:= ufpSameAsNewFiles
else if Value = 'sortedposition' then
gUpdatedFilesPosition:= ufpSortedPosition;
end
end;
frmMain.ActiveFrame.Reload(True);
frmMain.NotActiveFrame.Reload(True);
end;
end.