Skip to content

Commit 23fc9c0

Browse files
committed
feat: re-enable dropping files from file manager to "insert files to BLOB" dialog
1 parent 23148e9 commit 23fc9c0

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

heidisql.lpi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<UseXPManifest Value="True"/>
1313
<XPManifest>
1414
<DpiAware Value="True/PM_V2"/>
15+
<LongPathAware Value="True"/>
1516
<AnsiUTF8 Value="True"/>
1617
<TextName Value="HeidiSQL"/>
1718
<TextDesc Value="A lightweight, fast and flexible interface to MySQL"/>

source/insertfiles.lfm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ object frmInsertFiles: TfrmInsertFiles
33
Height = 614
44
Top = 131
55
Width = 639
6+
AllowDropFiles = True
67
BorderIcons = [biSystemMenu, biMinimize]
78
Caption = 'Insert files...'
89
ClientHeight = 614
@@ -14,6 +15,7 @@ object frmInsertFiles: TfrmInsertFiles
1415
Position = poOwnerFormCenter
1516
OnCreate = FormCreate
1617
OnDestroy = FormDestroy
18+
OnDropFiles = FormDropFiles
1719
OnShow = FormShow
1820
object btnInsert: TButton
1921
AnchorSideRight.Control = btnCancel

source/insertfiles.pas

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ TFileInfo = class(TObject)
2727
end;
2828
PFileInfo = ^TFileInfo;
2929

30+
{ TfrmInsertFiles }
31+
3032
TfrmInsertFiles = class(TExtForm)
3133
btnInsert: TButton;
3234
btnCancel: TButton;
@@ -89,13 +91,13 @@ TfrmInsertFiles = class(TExtForm)
8991
procedure ListColumnsPaintText(Sender: TBaseVirtualTree; const TargetCanvas: TCanvas;
9092
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType);
9193
procedure FormDestroy(Sender: TObject);
94+
procedure FormDropFiles(Sender: TObject; const FileNames: array of string);
9295
private
9396
FConnection: TDBConnection;
9497
FMaxFileSize: Int64;
9598
FOpenDialog: TExtFileOpenDialog;
9699
public
97100
{ Public declarations }
98-
//procedure AcceptFiles( var msg : TMessage ); message WM_DROPFILES;
99101
end;
100102

101103

@@ -388,6 +390,7 @@ procedure TfrmInsertFiles.AddFile(Filename: String);
388390
rx.Expression := '\.(te?xt|html?|xml|cmd|bat|sql|ini|pas|php|h|conf|log|csv|reg|latex|wiki|patch)$';
389391
rx.ModifierI := True;
390392
FileInfo.IsBinary := not rx.Exec(Filename);
393+
rx.Free;
391394
NewNode := ListFiles.InsertNode(ListFiles.FocusedNode, amInsertAfter, PFileInfo(FileInfo));
392395
SelectNode(ListFiles, NewNode);
393396
end;
@@ -679,29 +682,25 @@ procedure TfrmInsertFiles.btnInsertClick(Sender: TObject);
679682
end;
680683

681684

682-
{procedure TfrmInsertFiles.AcceptFiles(var msg : TMessage);
683-
const
684-
MaxFileNameLen = 255;
685+
procedure TfrmInsertFiles.FormDropFiles(Sender: TObject;
686+
const FileNames: array of string);
685687
var
686688
i, FileCount: integer;
687-
FileName: array [0..MaxFileNameLen] of char;
688689
begin
689690
// Files dropped onto form
690691
Screen.Cursor := crHourglass;
691-
FileCount := DragQueryFile(msg.WParam, $FFFFFFFF, FileName, MaxFileNameLen);
692-
// Query Windows one at a time for the file name
692+
FileCount := Length(FileNames);
693693
ListFiles.BeginUpdate;
694694
try
695695
for i:=0 to FileCount-1 do begin
696-
DragQueryFile(msg.WParam, i, FileName, MaxFileNameLen);
697-
AddFile(FileName);
696+
AddFile(FileNames[i]);
698697
end;
699698
finally
700699
ListFiles.EndUpdate;
701700
Screen.Cursor := crDefault;
702701
end;
703-
DragFinish(msg.WParam);
704-
end;}
702+
end;
703+
705704

706705

707706
end.

0 commit comments

Comments
 (0)