feat: re-enable dropping files from file manager to "insert files to BLOB" dialog

This commit is contained in:
Ansgar Becker
2026-01-22 19:56:30 +01:00
parent 23148e9149
commit 23fc9c0987
3 changed files with 13 additions and 11 deletions

View File

@@ -12,6 +12,7 @@
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True/PM_V2"/>
<LongPathAware Value="True"/>
<AnsiUTF8 Value="True"/>
<TextName Value="HeidiSQL"/>
<TextDesc Value="A lightweight, fast and flexible interface to MySQL"/>

View File

@@ -3,6 +3,7 @@ object frmInsertFiles: TfrmInsertFiles
Height = 614
Top = 131
Width = 639
AllowDropFiles = True
BorderIcons = [biSystemMenu, biMinimize]
Caption = 'Insert files...'
ClientHeight = 614
@@ -14,6 +15,7 @@ object frmInsertFiles: TfrmInsertFiles
Position = poOwnerFormCenter
OnCreate = FormCreate
OnDestroy = FormDestroy
OnDropFiles = FormDropFiles
OnShow = FormShow
object btnInsert: TButton
AnchorSideRight.Control = btnCancel

View File

@@ -27,6 +27,8 @@ type
end;
PFileInfo = ^TFileInfo;
{ TfrmInsertFiles }
TfrmInsertFiles = class(TExtForm)
btnInsert: TButton;
btnCancel: TButton;
@@ -89,13 +91,13 @@ type
procedure ListColumnsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
procedure FormDestroy(Sender: TObject);
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
private
FConnection: TDBConnection;
FMaxFileSize: Int64;
FOpenDialog: TExtFileOpenDialog;
public
{ Public declarations }
//procedure AcceptFiles( var msg : TMessage ); message WM_DROPFILES;
end;
@@ -388,6 +390,7 @@ begin
rx.Expression := '\.(te?xt|html?|xml|cmd|bat|sql|ini|pas|php|h|conf|log|csv|reg|latex|wiki|patch)$';
rx.ModifierI := True;
FileInfo.IsBinary := not rx.Exec(Filename);
rx.Free;
NewNode := ListFiles.InsertNode(ListFiles.FocusedNode, amInsertAfter, PFileInfo(FileInfo));
SelectNode(ListFiles, NewNode);
end;
@@ -679,29 +682,25 @@ begin
end;
{procedure TfrmInsertFiles.AcceptFiles(var msg : TMessage);
const
MaxFileNameLen = 255;
procedure TfrmInsertFiles.FormDropFiles(Sender: TObject;
const FileNames: array of string);
var
i, FileCount: integer;
FileName: array [0..MaxFileNameLen] of char;
begin
// Files dropped onto form
Screen.Cursor := crHourglass;
FileCount := DragQueryFile(msg.WParam, $FFFFFFFF, FileName, MaxFileNameLen);
// Query Windows one at a time for the file name
FileCount := Length(FileNames);
ListFiles.BeginUpdate;
try
for i:=0 to FileCount-1 do begin
DragQueryFile(msg.WParam, i, FileName, MaxFileNameLen);
AddFile(FileName);
AddFile(FileNames[i]);
end;
finally
ListFiles.EndUpdate;
Screen.Cursor := crDefault;
end;
DragFinish(msg.WParam);
end;}
end;
end.