Bläddra i källkod

Removing used functions and methods

Source commit: e103c319a567e63717f2cf6e8e6f76e26005e4ff
Martin Prikryl 8 år sedan
förälder
incheckning
eed83e585b
2 ändrade filer med 0 tillägg och 121 borttagningar
  1. 0 30
      source/packages/filemng/BaseUtils.pas
  2. 0 91
      source/packages/filemng/DirView.pas

+ 0 - 30
source/packages/filemng/BaseUtils.pas

@@ -35,14 +35,12 @@ type
   // and true maps to new default fbKilobytes, although functionaly it is fbShort
   TFormatBytesStyle = (fbNone, fbKilobytes, fbShort);
 
-function CheckFileExists(FileName: string): Boolean;
 function ExtractFileNameOnly(Name: string): string;
 function FileOrDirExists(FileName: string): Boolean;
 function FormatBytes(Bytes: Int64; Style: TFormatBytesStyle = fbShort; UseUnitsForBytes: Boolean = True): string;
 function FormatPanelBytes(Bytes: Int64; Style: TFormatBytesStyle): string;
 procedure FreePIDL(var PIDL: PItemIDList);
 function StrContains(Str1, Str2: string): Boolean;
-procedure StrTranslate(var Str: string; Code: string);
 function IsUncPath(Path: string): Boolean;
 function AnyValidPath: string;
 
@@ -95,16 +93,6 @@ begin
   Result := (Copy(Path, 1, 2) = '\\') or (Copy(Path, 1, 2) = '//');
 end;
 
-procedure StrTranslate(var Str: string; Code: string);
-var
-  Index: Integer;
-begin
-  if (Length(Code) > 0) and (Length(Code) mod 2 = 0) then
-    for Index := 1 to Length(Code) div 2 do
-      while Pos(Code[Index*2-1], Str) <> 0 do
-        Str[Pos(Code[Index*2-1], Str)] := Code[Index*2];
-end; {StrTranslate}
-
 function StrContains(Str1, Str2: string): Boolean;
 var
   Index: Integer;
@@ -123,24 +111,6 @@ begin
   Result := FileExists(FileName) or DirectoryExists(FileName);
 end; {FileOrDirExists}
 
-function CheckFileExists(FileName: string): Boolean;
-var
-  SaveFileMode : Integer;
-  F: file;
-begin
-  SaveFileMode := System.FileMode;
-  System.FileMode := 0;
-  try
-    AssignFile(F, ApiPath(FileName));
-    Reset(F, 1);
-    Result := IOResult = 0;
-    if Result then
-      CloseFile(F);
-  finally
-    System.FileMode := SaveFileMode;
-  end;
-end; {CheckFileExists}
-
 function ExtractFileNameOnly(Name: string): string;
 var
   Ext: string;

+ 0 - 91
source/packages/filemng/DirView.pas

@@ -288,7 +288,6 @@ type
     {Create a new subdirectory:}
     procedure CreateDirectory(DirName: string); override;
     {Delete all selected files:}
-    function DeleteSelectedFiles(AllowUndo: Boolean): Boolean; dynamic;
 
     {Check, if file or files still exists:}
     procedure ValidateFile(Item: TListItem); overload;
@@ -1824,96 +1823,6 @@ begin
   Result := ExtractFileExt(PFileRec(Item.Data)^.FileName);
 end; {ItemFileExt}
 
-function TDirView.DeleteSelectedFiles(AllowUndo: Boolean): Boolean;
-const
-  MaxSel = 10;
-var
-  ItemIndex: Integer;
-  Item, NextItem: TListItem;
-  FileOperator: TFileOperator;
-  UpdateEnabled: Boolean;
-  WatchDir: Boolean;
-  Updating: Boolean;
-  DirDeleted: Boolean;
-begin
-  AllowUndo := AllowUndo and (not IsRecycleBin);
-  DirDeleted := False;
-  if Assigned(FDriveView) then
-    TDriveView(FDriveView).StopWatchThread;
-  WatchDir := WatchForChanges;
-  WatchForChanges := False;
-  UpdateEnabled := (SelCount < MaxSel);
-  if not UpdateEnabled then Items.BeginUpdate;
-
-  FileOperator := TFileOperator.Create(Self);
-  try
-    ItemIndex := Selected.Index;
-    FileOperator.Operation := foDelete;
-    FileOperator.Flags := [foNoConfirmMkDir];
-    FileOperator.ProgressTitle := coFileOperatorTitle;
-    CreateFileList(False, True, FileOperator.OperandFrom);
-
-    if not ConfirmDelete then
-      FileOperator.Flags := FileOperator.Flags + [foNoConfirmation];
-
-    if AllowUndo then
-      FileOperator.Flags := FileOperator.Flags + [foAllowUndo];
-
-    StopIconUpdateThread;
-    Result := FileOperator.Execute;
-    Result := Result and (not FileOperator.OperationAborted);
-    Sleep(0);
-
-    Updating := False;
-    Item := GetNextItem(nil, sdAll, [isSelected]);
-    while Assigned(Item) do
-    begin
-      NextItem := GetNextItem(Item, sdAll, [isSelected]);
-      case PFileRec(Item.Data)^.IsDirectory of
-        True:
-          if not DirectoryExists(ItemFullFileName(Item)) then
-          begin
-            DirDeleted := True;
-            Item.Delete;
-          end;
-        False:
-          if not CheckFileExists(ItemFullFileName(Item)) then
-          begin
-            if (SelCount > 3) and (not Updating) then
-            begin
-              Items.BeginUpdate;
-              Updating := True;
-            end;
-            Item.Delete;
-          end;
-      end;
-      Item := NextItem;
-    end;
-    if Updating then
-      Items.EndUpdate;
-
-  finally
-    if not UpdateEnabled then
-      Items.EndUpdate;
-    FileOperator.Free;
-  end;
-
-  if Assigned(DriveView) then
-    with DriveView do
-    begin
-      if DirDeleted and Assigned(Selected) then
-        ValidateDirectory(Selected);
-      TDriveView(FDriveView).StartWatchThread;
-    end;
-
-  if UseIconUpdateThread then StartIconUpdateThread;
-
-  WatchForChanges := WatchDir;
-
-  if (not Assigned(Selected)) and (Items.Count > 0) then
-    Selected := Items[Min(ItemIndex, Pred(Items.Count))];
-end; {DeleteSelectedFiles}
-
 function StrCmpLogicalW(const sz1, sz2: UnicodeString): Integer; stdcall; external 'shlwapi.dll';
 
 function CompareLogicalText(const S1, S2: string; NaturalOrderNumericalSorting: Boolean): Integer;