ADD: in ThumbsFileView, support downloading by clicking the download icon in iCloud Drive

This commit is contained in:
rich2014 2025-12-30 21:37:06 +08:00
commit ef11c19b3a
4 changed files with 61 additions and 4 deletions

View file

@ -385,6 +385,7 @@ procedure TBriefDrawGrid.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y:
ColRowToOffset(True, True, params.col, params.drawingRect.Left, params.drawingRect.Right );
ColRowToOffset(False, True, params.row, params.drawingRect.Top, params.drawingRect.Bottom );
params.decorationRect:= params.drawingRect;
params.displayFile:= FBriefView.FFiles[index];
Result:= handler.click( params );

View file

@ -2067,12 +2067,13 @@ var
if NOT self.IsRowIndexValid(params.row) then
Exit;
ColRowToOffset(True, True, params.col, params.drawingRect.Left, params.drawingRect.Right );
ColRowToOffset(False, True, params.row, params.drawingRect.Top, params.drawingRect.Bottom );
if params.row <= FixedRows then
Exit;
ColRowToOffset(True, True, params.col, params.drawingRect.Left, params.drawingRect.Right );
ColRowToOffset(False, True, params.row, params.drawingRect.Top, params.drawingRect.Bottom );
params.decorationRect:= params.drawingRect;
params.displayFile:= ColumnsView.FFiles[params.row - FixedRows];
handler.click( params );
end;

View file

@ -63,6 +63,7 @@ type
FOnDrawCell: TFileViewOnDrawCell;
protected
procedure KeyDown(var Key : Word; Shift : TShiftState); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure DragOver(Source: TObject; X,Y: Integer; State: TDragState; var Accept: Boolean); override;
@ -261,6 +262,56 @@ begin
end;
end;
procedure TThumbDrawGrid.MouseUp(Button: TMouseButton; Shift: TShiftState; X,
Y: Integer);
function handleMBLeft: Boolean;
var
handler: TFileSourceUIHandler;
params: TFileSourceUIParams;
index: Integer;
iTextTop: Integer;
begin
Result:= False;
params:= Default( TFileSourceUIParams );
params.sender:= FThumbView;
params.fs:= FThumbView.FileSource;
params.multiColumns:= False;
handler:= params.fs.GetUIHandler;
if handler = nil then
Exit;
params.shift:= Shift;
params.x:= X;
params.y:= Y;
MouseToCell( X, Y, params.col, params.row );
if NOT self.IsRowIndexValid(params.row) then
Exit;
index:= CellToIndex( params.col, params.row );
if index < 0 then
Exit;
ColRowToOffset(True, True, params.col, params.drawingRect.Left, params.drawingRect.Right );
ColRowToOffset(False, True, params.row, params.drawingRect.Top, params.drawingRect.Bottom );
params.decorationRect:= params.drawingRect;
iTextTop:= params.decorationRect.Bottom - Canvas.TextHeight('Wg');
params.decorationRect.Bottom:= iTextTop - 1;
params.decorationRect.Top:= iTextTop - 24;
params.displayFile:= FThumbView.FFiles[index];
Result:= handler.click( params );
end;
begin
if Button = mbLeft then
handleMBLeft;
inherited MouseUp(Button, Shift, X, Y);
end;
procedure TThumbDrawGrid.MouseMove(Shift: TShiftState; X, Y: Integer);
begin
inherited MouseMove(Shift, X, Y);

View file

@ -620,7 +620,11 @@ begin
if NOT TSeedFileUtil.isSeedFile(aFile) then
Exit;
if params.x < params.drawingRect.Right - 28 then
if params.x < params.decorationRect.Right - 28 then
Exit;
if params.y < params.decorationRect.Top then
Exit;
if params.y > params.decorationRect.Bottom then
Exit;
TSeedFileUtil.downloadOrEvict( params.fs, aFile );