| 40 |
|
Label3: TLabel; |
| 41 |
|
combo_connection: TComboBox; |
| 42 |
|
Bevel1: TBevel; |
| 43 |
+ |
popup_linkshere: TMenuItem; |
| 44 |
+ |
popup_separator2: TMenuItem; |
| 45 |
|
procedure RecreateExtList; |
| 46 |
|
procedure UpdateConList; |
| 47 |
|
procedure LoadFileNames; |
| 55 |
|
procedure listMouseDown(Sender: TObject; Button: TMouseButton; |
| 56 |
|
Shift: TShiftState; X, Y: Integer); |
| 57 |
|
|
| 56 |
– |
procedure FormResize(Sender: TObject); |
| 58 |
|
procedure FormClose(Sender: TObject; var Action: TCloseAction); |
| 59 |
|
procedure popup_importClick(Sender: TObject); |
| 60 |
|
procedure popup_exportClick(Sender: TObject); |
| 63 |
|
procedure btn_sortClick(Sender: TObject); |
| 64 |
|
procedure FormActivate(Sender: TObject); |
| 65 |
|
procedure combo_connectionChange(Sender: TObject); |
| 66 |
+ |
procedure popup_linkshereClick(Sender: TObject); |
| 67 |
|
private |
| 68 |
|
FSortBy: TSortType; |
| 69 |
|
FOnNewFileSelected: TNewFileSelectedEvent; |
| 96 |
|
|
| 97 |
|
implementation |
| 98 |
|
{$R *.dfm} |
| 99 |
< |
uses Main, ConnectionManager, Exporters, Functions; |
| 99 |
> |
uses Main, ConnectionManager, Exporters, Functions, WhatLinksHere; |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
procedure TForm_ToolTemplate.UpdateConList; |
| 119 |
|
datatype := 'OUP-DB: ' |
| 120 |
|
else |
| 121 |
|
datatype := 'Unknown: '; |
| 122 |
< |
boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')'; |
| 122 |
> |
boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ') [' + IntToStr(ConManager.ConnectionByIndex[i].ConnectionID) + ']'; |
| 123 |
|
combo_connection.Items.Add(boxstring); |
| 124 |
|
if ConManager.ConnectionByIndex[i].ConnectionID = FConnectionID then |
| 125 |
|
combo_connection.ItemIndex := combo_connection.Items.Count - 1; |
| 152 |
|
begin |
| 153 |
|
combo_extension.Items.Add('_All files_ (' + |
| 154 |
|
IntToStr(ConManager.Connection[FConnectionID].GetFileCount) + ')'); |
| 155 |
+ |
exts := nil; |
| 156 |
|
exts := ConManager.Connection[FConnectionID].GetExtensionsList(EF_ExtCount); |
| 157 |
|
for i := 0 to exts.Count - 1 do |
| 158 |
|
if Length(FAllowedExts) > 0 then |
| 177 |
|
no_zero_bytes: Boolean; |
| 178 |
|
pattern: String; |
| 179 |
|
files: TStrings; |
| 177 |
– |
i: Integer; |
| 180 |
|
begin |
| 181 |
|
if FConnectionID > -1 then |
| 182 |
|
begin |
| 191 |
|
else |
| 192 |
|
Extension := ''; |
| 193 |
|
|
| 194 |
+ |
files := nil; |
| 195 |
|
files := ConManager.Connection[FConnectionID].GetFilesList(extension, pattern, no_zero_bytes, FSortBy); |
| 196 |
|
|
| 197 |
|
filelist.Visible := False; |
| 222 |
|
finfo: TFileInfo; |
| 223 |
|
fs: TFileStream; |
| 224 |
|
begin |
| 225 |
< |
id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); |
| 226 |
< |
finfo := ConManager.Connection[FConnectionID].GetFileInfo(id); |
| 225 |
> |
if CR_EditDat in ConManager.Connection[FConnectionID].ChangeRights then |
| 226 |
> |
begin |
| 227 |
> |
id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); |
| 228 |
> |
finfo := ConManager.Connection[FConnectionID].GetFileInfo(id); |
| 229 |
|
|
| 230 |
< |
importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' + |
| 231 |
< |
finfo.Extension + '|All files|*.*'; |
| 232 |
< |
if importd.Execute then |
| 233 |
< |
begin |
| 234 |
< |
fs := TFileStream.Create(importd.FileName, fmOpenRead); |
| 235 |
< |
if fs.Size <> finfo.Size then |
| 236 |
< |
ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + |
| 237 |
< |
', file has to have same size as file in .dat.' + CrLf + |
| 238 |
< |
'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf + |
| 239 |
< |
'Size of chosen file: ' + FormatFileSize(fs.Size)) |
| 240 |
< |
else begin |
| 230 |
> |
importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' + |
| 231 |
> |
finfo.Extension + '|All files|*.*'; |
| 232 |
> |
if importd.Execute then |
| 233 |
> |
begin |
| 234 |
> |
fs := TFileStream.Create(importd.FileName, fmOpenRead); |
| 235 |
> |
if fs.Size <> finfo.Size then |
| 236 |
> |
begin |
| 237 |
> |
if not (CR_ResizeDat in ConManager.Connection[FConnectionID].ChangeRights) then |
| 238 |
> |
begin |
| 239 |
> |
ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + |
| 240 |
> |
', file has to have same size as file in .dat with this backend.' + CrLf + |
| 241 |
> |
'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf + |
| 242 |
> |
'Size of chosen file: ' + FormatFileSize(fs.Size)); |
| 243 |
> |
Exit; |
| 244 |
> |
end else begin |
| 245 |
> |
if MessageBox(Self.Handle, |
| 246 |
> |
PChar('File has different size from the file in the .dat.' + CrLf + |
| 247 |
> |
'Size of file in .dat: ' + FormatFileSize(finfo.Size) + CrLf + |
| 248 |
> |
'Size of chosen file: ' + FormatFileSize(fs.Size) + CrLf + |
| 249 |
> |
'Replace anyway?'), PChar('Different size'), MB_YESNO + MB_ICONWARNING) = ID_NO then |
| 250 |
> |
begin |
| 251 |
> |
Exit; |
| 252 |
> |
end; |
| 253 |
> |
end; |
| 254 |
> |
end; |
| 255 |
|
ConManager.Connection[FConnectionID].UpdateDatFile(id, fs); |
| 256 |
|
Self.listClick(Self); |
| 257 |
+ |
fs.Free; |
| 258 |
|
end; |
| 259 |
< |
fs.Free; |
| 259 |
> |
end else begin |
| 260 |
> |
ShowMessage('Editing .dat-contents not allowed with this backend.'); |
| 261 |
|
end; |
| 262 |
|
end; |
| 263 |
|
|
| 264 |
+ |
procedure TForm_ToolTemplate.popup_linkshereClick(Sender: TObject); |
| 265 |
+ |
begin |
| 266 |
+ |
Form_WhatLinksHere.ConID := FConnectionID; |
| 267 |
+ |
Form_WhatLinksHere.FileID := FSelectedFile.ID; |
| 268 |
+ |
// Form_WhatLinksHere.SenderForm := Self; |
| 269 |
+ |
Form_WhatLinksHere.Show; |
| 270 |
+ |
end; |
| 271 |
+ |
|
| 272 |
|
procedure TForm_ToolTemplate.popup_opentool(Sender: TObject); |
| 273 |
|
var |
| 274 |
|
sender_name, context: String; |
| 283 |
|
procedure TForm_ToolTemplate.combo_connectionChange(Sender: TObject); |
| 284 |
|
var |
| 285 |
|
name: String; |
| 257 |
– |
nstart, nend: Integer; |
| 258 |
– |
i: Integer; |
| 286 |
|
begin |
| 287 |
|
if combo_connection.ItemIndex >= 0 then |
| 288 |
< |
FConnectionID := combo_connection.ItemIndex |
| 288 |
> |
begin |
| 289 |
> |
name := combo_connection.Items.Strings[combo_connection.ItemIndex]; |
| 290 |
> |
FConnectionID := StrToInt(MidStr(name, Pos('[', name) + 1, Pos(']', name) - Pos('[', name) - 1)); |
| 291 |
> |
end |
| 292 |
|
else |
| 293 |
|
FConnectionID := -1; |
| 294 |
|
RecreateExtList; |
| 395 |
|
begin |
| 396 |
|
pt.X := x; |
| 397 |
|
pt.Y := y; |
| 398 |
< |
// filelist.ItemIndex := filelist.ItemAtPos(pt, true); |
| 399 |
< |
// Self.listClick(Self); |
| 398 |
> |
if Shift = [ssRight] then |
| 399 |
> |
begin |
| 400 |
> |
filelist.ItemIndex := filelist.ItemAtPos(pt, true); |
| 401 |
> |
Self.listClick(Self); |
| 402 |
> |
end; |
| 403 |
|
end; |
| 404 |
|
|
| 405 |
|
|
| 481 |
|
end; |
| 482 |
|
|
| 483 |
|
|
| 451 |
– |
procedure TForm_ToolTemplate.FormResize(Sender: TObject); |
| 452 |
– |
begin |
| 453 |
– |
if Self.Width < 300 then |
| 454 |
– |
Self.Width := 300; |
| 455 |
– |
if Self.Height < 200 then |
| 456 |
– |
Self.Height := 200; |
| 457 |
– |
end; |
| 458 |
– |
|
| 459 |
– |
|
| 460 |
– |
|
| 484 |
|
function TForm_ToolTemplate.GetToolCloseable: Boolean; |
| 485 |
|
begin |
| 486 |
|
if Assigned(FOnCheckCloseable) then |