소스 검색

In file panel, file sorting by date and size is by default descending even when initiated by menu, toolbar or keyboard shortcut, consistently with sorting by clicking panel column header

See 4.1 change "In file panel, file sorting by date and size is by default descending"

Source commit: 27c0391d2b859926ce03c1e882199b6a8043e1db
Martin Prikryl 3 년 전
부모
커밋
224365680a
2개의 변경된 파일24개의 추가작업 그리고 31개의 파일을 삭제
  1. 1 7
      source/forms/NonVisual.cpp
  2. 23 24
      source/packages/my/IEListView.pas

+ 1 - 7
source/forms/NonVisual.cpp

@@ -55,13 +55,7 @@ TNonVisualDataModule *NonVisualDataModule;
     Action->Checked = false \
   )
 #define EXESORT(SIDE, NAME, LCOL, RCOL, NUM) \
-  EXE(SIDE ## SortBy ## NAME ## Action ## NUM, \
-    int Col = (ScpExplorer->IsSideLocalBrowser(os ## SIDE) ? LCOL : RCOL); \
-    if (COLPROPS(SIDE)->SortColumn == Col) \
-      COLPROPS(SIDE)->SortAscending = !COLPROPS(SIDE)->SortAscending; \
-    else \
-      COLPROPS(SIDE)->SortColumn = Col; \
-  )
+  EXE(SIDE ## SortBy ## NAME ## Action ## NUM, ScpExplorer->DirView(os ## SIDE)->SortBy(ScpExplorer->IsSideLocalBrowser(os ## SIDE) ? LCOL : RCOL))
 #define UPDSORTA(SIDE, NUM) if (Action == SIDE ## SortAscendingAction ## NUM) { \
   SIDE ## SortAscendingAction ## NUM->Enabled = true; Handled = true; \
   SIDE ## SortAscendingAction ## NUM->Checked = COLPROPS(SIDE)->SortAscending; } else

+ 23 - 24
source/packages/my/IEListView.pas

@@ -91,6 +91,7 @@ type
 
     procedure CreateWnd; override;
     procedure ColClick(Column: TListColumn); override;
+    procedure SetSort(Column: Integer; Ascending: Boolean);
     procedure WMNotify(var Msg: TWMNotify); message WM_NOTIFY;
     procedure CMRecreateWnd(var Message: TMessage); message CM_RECREATEWND;
   public
@@ -98,6 +99,8 @@ type
     destructor Destroy; override;
     procedure SetColumnImages; virtual;
 
+    procedure SortBy(Column: Integer);
+
     property DragImageList: TDragImageList read FDragImageList;
     property ParentForm: TCustomForm read FParentForm;
     property DateTimeFormatStr: string
@@ -378,16 +381,28 @@ begin
   SetDateTimeFormatString;
 end; {Create}
 
-procedure TCustomIEListView.SetSortColumn(Value: Integer);
+procedure TCustomIEListView.SetSort(Column: Integer; Ascending: Boolean);
 begin
-  if Value <> SortColumn then
+  if (SortColumn <> Column) or (SortAscending <> Ascending) then
   begin
-    FSortColumn := Value;
-    FSortAscending := True;
-    if Items.Count > 0 then
-      SortItems;
+    FSortColumn := Column;
+    FSortAscending := Ascending;
+
+    if Items.Count > 0 then SortItems;
+
     SetColumnImages;
   end;
+end;
+
+procedure TCustomIEListView.SortBy(Column: Integer);
+begin
+  if Column = SortColumn then SetSort(SortColumn, not SortAscending)
+    else SetSort(Column, SortAscendingByDefault(Column));
+end;
+
+procedure TCustomIEListView.SetSortColumn(Value: Integer);
+begin
+  SetSort(Value, True);
 end; {SetSortColumn}
 
 procedure TCustomIEListView.SetViewStyle(Value: TViewStyle);
@@ -402,13 +417,7 @@ end; {SetViewStyle}
 
 procedure TCustomIEListView.SetSortAscending(Value: Boolean);
 begin
-  if SortAscending <> Value then
-  begin
-    FSortAscending := Value;
-    if Items.Count > 0 then
-      SortItems;
-    SetColumnImages;
-  end;
+  SetSort(SortColumn, Value);
 end; {SetSortAscending}
 
 procedure TCustomIEListView.SetColumnImages;
@@ -498,17 +507,7 @@ end;
 
 procedure TCustomIEListView.ColClick(Column: TListColumn);
 begin
-  if Column.Index = SortColumn then FSortAscending := not FSortAscending
-    else
-  begin
-    FSortColumn := Column.Index;
-    FSortAscending := SortAscendingByDefault(Column.Index);
-  end;
-
-  if Items.Count > 0 then SortItems;
-
-  SetColumnImages;
-
+  SortBy(Column.Index);
   inherited;
 end; {ColClick}