UPD: Restored showing free space.

This commit is contained in:
cobines 2009-09-03 10:58:52 +00:00
commit 8a072aed25
4 changed files with 3834 additions and 3790 deletions

View file

@ -497,6 +497,7 @@ type
procedure EnableHotkeys(Enable: Boolean);
procedure ExecuteCommandLine(bRunInTerm: Boolean);
procedure UpdatePrompt;
procedure UpdateFreeSpace(Panel: TFilePanelSelect);
procedure ReLoadTabs(ANoteBook: TFileViewNotebook);
published
// For now we allow to write here.
@ -992,9 +993,9 @@ end;
procedure TfrmMain.lblDriveInfoDblClick(Sender: TObject);
begin
if (Sender as TLabel).Name = 'lblRightDriveInfo' then
if Sender = lblRightDriveInfo then
SetActiveFrame(fpRight)
else if (Sender as TLabel).Name = 'lblLeftDriveInfo' then
else if Sender = lblLeftDriveInfo then
SetActiveFrame(fpLeft);
Actions.cm_DirHotList('');
// actDirHotList.Execute;
@ -2389,6 +2390,7 @@ begin
RightFrameWatcher.WatchPath:= NewDir;
UpdateSelectedDrive(ANoteBook);
UpdateFreeSpace(ANoteBook.Side);
end;
end;
@ -2943,6 +2945,9 @@ begin
ToggleConsole;
ToggleFileSystemWatcher;
ShowTrayIcon(gAlwaysShowTrayIcon);
UpdateFreeSpace(fpLeft);
UpdateFreeSpace(fpRight);
end;
procedure TfrmMain.edtCommandKeyDown(Sender: TObject; var Key: Word;
@ -3399,10 +3404,8 @@ begin
end;
procedure TfrmMain.UpdatePrompt;
const PTLen=40;
var
FreeSize,
TotalSize : Int64;
const
PTLen = 40;
begin
with lblCommandPath do
begin
@ -3422,6 +3425,31 @@ begin
edtCommand.Width := TControl(edtCommand.Parent).Width - edtCommand.Left;
end;
procedure TfrmMain.UpdateFreeSpace(Panel: TFilePanelSelect);
var
FreeSize, TotalSize: Int64;
lblDriveInfo: TLabel;
FileSource: TFileSource;
begin
case Panel of
fpLeft :
begin
lblDriveInfo := lblLeftDriveInfo;
FileSource := FrameLeft.FileSource;
end;
fpRight:
begin
lblDriveInfo := lblRightDriveInfo;
FileSource := FrameRight.FileSource;
end;
end;
if FileSource.GetFreeSpace(FreeSize, TotalSize) then
lblDriveInfo.Caption := Format(rsFreeMsg, [cnvFormatFileSize(FreeSize), cnvFormatFileSize(TotalSize)])
else
lblDriveInfo.Caption := '';
end;
procedure TfrmMain.OperationFinishedEvent(Operation: TFileSourceOperation; Event: TOperationManagerEvent);
procedure UpdateTabs(Notebook: TFileViewNotebook);

File diff suppressed because it is too large Load diff

View file

@ -89,6 +89,8 @@ type
class function GetPathType(sPath : String): TPathType; virtual;
function GetFreeSpace(out FreeSize, TotalSize : Int64) : Boolean; virtual;
property CurrentPath: String read GetCurrentPath write SetCurrentPath;
property CurrentAddress: String read GetCurrentAddress;
property Properties: TFileSourceProperties read GetProperties;
@ -160,6 +162,11 @@ begin
end;
end;
function TFileSource.GetFreeSpace(out FreeSize, TotalSize : Int64) : Boolean;
begin
Result := False; // not supported by default
end;
// Operations.
function TFileSource.GetFiles: TFiles;

View file

@ -43,6 +43,8 @@ type
function IsAtRootPath: Boolean; override;
class function GetPathType(sPath : String): TPathType; override;
function GetFreeSpace(out FreeSize, TotalSize : Int64) : Boolean; override;
function CreateListOperation: TFileSourceOperation; override;
function CreateCopyInOperation(var SourceFileSource: TFileSource;
var SourceFiles: TFiles;
@ -157,6 +159,11 @@ begin
Result := uDCUtils.GetPathType(sPath);
end;
function TFileSystemFileSource.GetFreeSpace(out FreeSize, TotalSize : Int64) : Boolean;
begin
Result := GetDiskFreeSpace(CurrentPath, FreeSize, TotalSize);
end;
class function TFileSystemFileSource.GetSupportedFileProperties: TFilePropertiesTypes;
begin
Result := TFileSystemFile.GetSupportedProperties;