瀏覽代碼

Using the same timestamp format in local and remote file panels

Source commit: 4690f559201ff1c23b38abe043ddae381959c071
Martin Prikryl 2 年之前
父節點
當前提交
5b57c3b878
共有 3 個文件被更改,包括 3 次插入62 次删除
  1. 1 0
      source/core/RemoteFiles.cpp
  2. 2 8
      source/packages/filemng/DirView.pas
  3. 0 54
      source/packages/my/IEListView.pas

+ 1 - 0
source/core/RemoteFiles.cpp

@@ -449,6 +449,7 @@ UnicodeString __fastcall UserModificationStr(TDateTime DateTime,
       return FormatDateTime(L"ddddd t", DateTime);
     case mfFull:
     default:
+      // Keep consistent with TDirView.GetDisplayInfo
       return FormatDateTime(L"ddddd tt", DateTime);
   }
 }

+ 2 - 8
source/packages/filemng/DirView.pas

@@ -294,7 +294,6 @@ type
     procedure Reload(CacheIcons : Boolean); override;
     procedure Reload2;
 
-    function FormatFileTime(FileTime: TFileTime): string; virtual;
     function GetAttrString(Attr: Integer): string; virtual;
 
     constructor Create(AOwner: TComponent); override;
@@ -1705,12 +1704,6 @@ begin
     else inherited;
 end; {ReLoad}
 
-function TDirView.FormatFileTime(FileTime: TFileTime): string;
-begin
-  Result := FormatDateTime(DateTimeFormatStr,
-    FileTimeToDateTime(FileTime));
-end; {FormatFileTime}
-
 function TDirView.GetAttrString(Attr: Integer): string;
 const
   Attrs: array[1..5] of Integer =
@@ -2454,7 +2447,8 @@ begin
           dvType: {FileType: }
             Value := TypeName;
           dvChanged: {Date}
-            Value := FormatFileTime(FileTime);
+            // Keep consistent with UserModificationStr
+            Value := FormatDateTime('ddddd tt', FileTimeToDateTime(FileTime));
           dvAttr: {Attrs:}
             Value := GetAttrString(Attr);
           dvExt:

+ 0 - 54
source/packages/my/IEListView.pas

@@ -48,9 +48,6 @@ type
     property SortStr: string read GetSortStr write SetSortStr stored False;
   end;
 
-type
-  TDateTimeDisplay = (dtdDateTimeSec, dtdDateTime, dtdDate);
-
 type
   TCustomIEListView = class;
 
@@ -69,8 +66,6 @@ type
     FOnRecreate: TNotifyEvent;
     FOnSecondaryColumnHeader: TListViewSecondaryColumnHeaderEvent;
 
-    FDateTimeFormatStr: string;
-    FDateTimeDisplay: TDateTimeDisplay;
     FDragImageList: TDragImageList;
 
   protected
@@ -81,8 +76,6 @@ type
     procedure SetSortAscending(Value: Boolean); virtual;
     procedure SortItems; virtual;
     procedure SetViewStyle(Value: TViewStyle); override; // CLEAN virtual
-    procedure SetDateTimeDisplay(Value: TDateTimeDisplay); virtual;
-    procedure SetDateTimeFormatString; virtual;
     procedure HeaderEndDrag(Sender: TObject); virtual;
     function SecondaryColumnHeader(Index: Integer): Integer;
     function NewColProperties: TCustomListViewColProperties; override;
@@ -102,8 +95,6 @@ type
 
     property DragImageList: TDragImageList read FDragImageList;
     property ParentForm: TCustomForm read FParentForm;
-    property DateTimeFormatStr: string
-      read FDateTimeFormatStr write FDateTimeFormatStr stored False;
     {Set the sort column of the listview}
     property SortColumn: Integer read FSortColumn write SetSortColumn;
     {Show the sorting symbol in the listview's header:}
@@ -116,9 +107,6 @@ type
       read FOnSecondaryColumnHeader write FOnSecondaryColumnHeader;
 
   published
-    {Display format of the date/time of the files:}
-    property DateTimeDisplay: TDateTimeDisplay
-      read FDateTimeDisplay write SetDateTimeDisplay default dtdDateTimeSec;
     property OnHeaderEndDrag: TNotifyEvent
       read  FOnHeaderEndDrag write FOnHeaderEndDrag;
     property OnHeaderEndTrack: TNotifyEvent
@@ -376,7 +364,6 @@ begin
   FShowColumnIcon := True;
   FSortColumn := 0;
   FSortAscending := True;
-  SetDateTimeFormatString;
 end; {Create}
 
 procedure TCustomIEListView.SetSort(Column: Integer; Ascending: Boolean);
@@ -591,47 +578,6 @@ begin
   inherited;
 end; {Destroy}
 
-procedure TCustomIEListView.SetDateTimeDisplay(Value: TDateTimeDisplay);
-begin
-  if Value <> FDateTimeDisplay then
-  begin
-    FDateTimeDisplay := Value;
-    SetDateTimeFormatString;
-    Invalidate;
-  end;
-end; {SetDateTimeDisplay}
-
-procedure TCustomIEListView.SetDateTimeFormatString;
-var
-  ShortDate: string;
-begin
-  ShortDate := UpperCase(FormatSettings.ShortDateFormat);
-  {Create DateTime format string:}
-  if (Pos('YYYY', UpperCase(ShortDate)) = 0) and
-     (Pos('YY', UpperCase(ShortDate)) <> 0) then
-  begin
-    if Copy(UpperCase(ShortDate), Length(ShortDate) - 1, 2) = 'YY' then
-    begin
-      FDateTimeFormatStr := FormatSettings.ShortDateFormat + 'yy'
-    end
-      else
-    if Copy(UpperCase(ShortDate), 1, 2) = 'YY' then
-    begin
-      FDateTimeFormatStr := 'yy' + FormatSettings.ShortDateFormat;
-    end
-  end
-    else
-  begin
-    FDateTimeFormatStr := FormatSettings.ShortDateFormat;
-  end;
-
-  if FDateTimeDisplay = dtdDateTimeSec then
-      FDateTimeFormatStr := FDateTimeFormatStr + '  ' + FormatSettings.LongTimeFormat
-    else
-  if fDateTimeDisplay = dtdDateTime then
-    FDateTimeFormatStr := FDateTimeFormatStr + '  ' + FormatSettings.ShortTimeFormat;
-end; {SetDateTimeFormatString}
-
 procedure TCustomIEListView.SortItems;
 begin
   AlphaSort;