1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
|
(*
History++ plugin for Miranda IM: the free IM client for Microsoft* Windows*
Copyright (C) 2006-2009 theMIROn, 2003-2006 Art Fedorov.
History+ parts (C) 2001 Christian Kastner
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*)
{ -----------------------------------------------------------------------------
EventDetailForm (historypp project)
Version: 1.4
Created: 31.03.2003
Author: Oxygen
[ Description ]
Form for details about event
[ History ]
1.4
- Added horz scroll bar to memo
1.0 (31.03.2003) - Initial version
[ Modifications ]
* (29.05.2003) Added scroll bar to memo
[ Knows Inssues ]
None
Contributors: theMIROn, Art Fedorov, Christian Kastner
----------------------------------------------------------------------------- }
unit EventDetailForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls,
HistoryForm,
m_api,
hpp_global, hpp_richedit,
ComCtrls,
Menus, RichEdit, Buttons, HistoryControls, ShellAPI;
type
TEventDetailsFrm = class(TForm)
paBottom: TPanel;
Panel3: TPanel;
paInfo: TPanel;
GroupBox: THppGroupBox;
laType: TLabel;
laDateTime: TLabel;
EMsgType: THppEdit;
bnReply: TButton;
CloseBtn: TButton;
laFrom: TLabel;
laTo: TLabel;
EFrom: THppEdit;
ETo: THppEdit;
EText: THPPRichEdit;
pmEText: TPopupMenu;
CopyText: TMenuItem;
CopyAll: TMenuItem;
SelectAll: TMenuItem;
N1: TMenuItem;
ReplyQuoted1: TMenuItem;
SendMessage1: TMenuItem;
paText: TPanel;
N2: TMenuItem;
ToogleItemProcessing: TMenuItem;
EFromMore: TSpeedButton;
EDateTime: THppEdit;
EToMore: TSpeedButton;
PrevBtn: TSpeedButton;
NextBtn: TSpeedButton;
OpenLinkNW: TMenuItem;
OpenLink: TMenuItem;
CopyLink: TMenuItem;
N4: TMenuItem;
imDirection: TImage;
N3: TMenuItem;
BrowseReceivedFiles: TMenuItem;
OpenFileFolder: TMenuItem;
CopyFilename: TMenuItem;
procedure PrevBtnClick(Sender: TObject);
procedure NextBtnClick(Sender: TObject);
procedure EFromMoreClick(Sender: TObject);
procedure EToMoreClick(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure CloseBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure bnReplyClick(Sender: TObject);
procedure pmETextPopup(Sender: TObject);
procedure SelectAllClick(Sender: TObject);
procedure CopyTextClick(Sender: TObject);
procedure CopyAllClick(Sender: TObject);
procedure SendMessage1Click(Sender: TObject);
procedure ReplyQuoted1Click(Sender: TObject);
procedure ToogleItemProcessingClick(Sender: TObject);
procedure ETextResizeRequest(Sender: TObject; Rect: TRect);
procedure OpenLinkNWClick(Sender: TObject);
procedure OpenLinkClick(Sender: TObject);
procedure CopyLinkClick(Sender: TObject);
procedure ETextMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure BrowseReceivedFilesClick(Sender: TObject);
procedure OpenFileFolderClick(Sender: TObject);
procedure ETextURLClick(Sender: TObject; const URLText: String; Button: TMouseButton);
private
FParentForm: THistoryFrm;
FItem: Integer;
FRichHeight: Integer;
FOverURL: Boolean;
SavedLinkUrl: String;
FOverFile: Boolean;
SavedFileDir: String;
hSubContactFrom, hSubContactTo: THandle;
FNameFrom, FNameTo: String;
FProtocol: AnsiString;
procedure OnCNChar(var Message: TWMChar); message WM_CHAR;
procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
procedure WMSysColorChange(var Message: TMessage); message WM_SYSCOLORCHANGE;
procedure LoadPosition;
procedure SavePosition;
procedure SetItem(const Value: Integer);
procedure TranslateForm;
procedure LoadButtonIcons;
procedure LoadMessageIcons;
{ Private declarations }
procedure HMIconsChanged(var M: TMessage); message HM_NOTF_ICONSCHANGED;
procedure HMIcons2Changed(var M: TMessage); message HM_NOTF_ICONS2CHANGED;
procedure HMEventDeleted(var Message: TMessage); message HM_MIEV_EVENTDELETED;
function GetPrevItem: Integer;
function GetNextItem: Integer;
function IsFileEvent: Boolean;
protected
property PrevItem: Integer read GetPrevItem;
property NextItem: Integer read GetNextItem;
public
hContactTo, hContactFrom: THandle;
property ParentForm: THistoryFrm read FParentForm write FParentForm;
property Item: Integer read FItem write SetItem;
procedure ProcessRichEdit(const FItem: Integer);
procedure ResetItem;
end;
var
EventDetailsFrm: TEventDetailsFrm;
implementation
uses
HistoryGrid, hpp_messages, hpp_contacts, hpp_events, hpp_forms,
{hpp_database,} hpp_options, hpp_services;
{$R *.DFM}
{ TForm1 }
procedure TEventDetailsFrm.WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo);
begin
inherited;
with Message.MinMaxInfo^ do
begin
ptMinTrackSize.X := 376;
ptMinTrackSize.Y := 240;
end
end;
procedure TEventDetailsFrm.ProcessRichEdit(const FItem: Integer);
var
ItemRenderDetails: TItemRenderDetails;
begin
ZeroMemory(@ItemRenderDetails, SizeOf(ItemRenderDetails));
ItemRenderDetails.cbSize := SizeOf(ItemRenderDetails);
ItemRenderDetails.hContact := ParentForm.hContact;
ItemRenderDetails.hDBEvent := ParentForm.History[ParentForm.GridIndexToHistory(FItem)];
ItemRenderDetails.pProto := PAnsiChar(ParentForm.hg.Items[FItem].Proto);
ItemRenderDetails.pModule := PAnsiChar(ParentForm.hg.Items[FItem].Module);
ItemRenderDetails.pText := nil;
ItemRenderDetails.pExtended := PAnsiChar(ParentForm.hg.Items[FItem].Extended);
ItemRenderDetails.dwEventTime := ParentForm.hg.Items[FItem].Time;
ItemRenderDetails.wEventType := ParentForm.hg.Items[FItem].EventType;
ItemRenderDetails.IsEventSent := (mtOutgoing in ParentForm.hg.Items[FItem].MessageType);
{ TODO: Add flag for special event details form treatment? }
ItemRenderDetails.dwFlags := ItemRenderDetails.dwFlags or IRDF_EVENT;
if ParentForm.hContact = 0 then
ItemRenderDetails.bHistoryWindow := IRDHW_GLOBALHISTORY
else
ItemRenderDetails.bHistoryWindow := IRDHW_CONTACTHISTORY;
NotifyEventHooks(hHppRichEditItemProcess, EText.Handle, LPARAM(@ItemRenderDetails));
end;
procedure TEventDetailsFrm.EFromMoreClick(Sender: TObject);
begin
CallService(MS_USERINFO_SHOWDIALOG, hContactFrom, 0);
end;
procedure TEventDetailsFrm.EToMoreClick(Sender: TObject);
begin
CallService(MS_USERINFO_SHOWDIALOG, hContactTo, 0);
end;
procedure TEventDetailsFrm.FormDestroy(Sender: TObject);
begin
try
FParentForm.EventDetailForm := nil;
except
end;
end;
procedure TEventDetailsFrm.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
var
Mask: Integer;
begin
if IsFormShortCut([pmEText], Key, Shift) then
Key := 0;
with Sender as TWinControl do
begin
if Perform(CM_CHILDKEY, Key, LPARAM(Sender)) <> 0 then
Exit;
Mask := 0;
case Key of
VK_TAB:
Mask := DLGC_WANTTAB;
VK_RETURN, VK_EXECUTE, VK_ESCAPE, VK_CANCEL:
Mask := DLGC_WANTALLKEYS;
end;
if (Mask <> 0) and (Perform(CM_WANTSPECIALKEY, Key, 0) = 0) and
(Perform(WM_GETDLGCODE, 0, 0) and Mask = 0) and (Self.Perform(CM_DIALOGKEY, Key, 0) <> 0)
then
Exit;
end;
end;
procedure TEventDetailsFrm.OnCNChar(var Message: TWMChar);
// make tabs work!
begin
if not(csDesigning in ComponentState) then
with Message do
begin
Result := 1;
if (Perform(WM_GETDLGCODE, 0, 0) and DLGC_WANTCHARS = 0) and
(GetParentForm(Self).Perform(CM_DIALOGCHAR, CharCode, KeyData) <> 0) then
Exit;
Result := 0;
end;
end;
procedure TEventDetailsFrm.LoadPosition;
begin
Utils_RestoreFormPosition(Self, 0, hppDBName, 'EventDetail.');
end;
procedure TEventDetailsFrm.SavePosition;
begin
Utils_SaveFormPosition(Self, 0, hppDBName, 'EventDetail.');
end;
procedure TEventDetailsFrm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caFree;
SavePosition;
end;
procedure TEventDetailsFrm.CloseBtnClick(Sender: TObject);
begin
SavePosition;
Self.Release;
end;
procedure TEventDetailsFrm.FormCreate(Sender: TObject);
begin
Icon.ReleaseHandle;
DesktopFont := True;
MakeFontsParent(Self);
DoubleBuffered := True;
MakeDoubleBufferedParent(Self);
LoadButtonIcons;
TranslateForm;
LoadPosition;
end;
procedure TEventDetailsFrm.SetItem(const Value: Integer);
var
FromContact, ToContact: Boolean;
begin
Assert(Assigned(FParentForm));
if Value = -1 then
Exit;
FItem := Value;
EMsgType.Text := TranslateUnicodeString(GetEventRecord(FParentForm.hg.Items[FItem])
.Name { TRANSLATE-IGNORE } );
EMsgType.Text := Format('%s [%s/%u]', [EMsgType.Text, FParentForm.hg.Items[FItem].Module,
FParentForm.hg.Items[FItem].EventType]);
EDateTime.Text := TimestampToString(FParentForm.hg.Items[FItem].Time);
if FParentForm.hContact = 0 then
FProtocol := FParentForm.hg.Items[FItem].Proto
else
FProtocol := FParentForm.SubProtocol;
FromContact := false;
ToContact := false;
if mtIncoming in FParentForm.hg.Items[FItem].MessageType then
begin
hContactFrom := FParentForm.hContact;
hSubContactFrom := FParentForm.hSubContact;
hContactTo := 0;
hSubContactTo := 0;
FNameFrom := FParentForm.hg.ContactName;
FNameTo := GetContactDisplayName(0, FProtocol);
FromContact := (hContactFrom = 0);
end
else
begin
hContactFrom := 0;
hSubContactFrom := 0;
hContactTo := FParentForm.hContact;
hSubContactTo := FParentForm.hSubContact;
FNameFrom := GetContactDisplayName(0, FProtocol);
FNameTo := FParentForm.hg.ContactName;
ToContact := (hContactTo = 0);
end;
LoadMessageIcons;
EFromMore.Enabled := not FromContact;
EFrom.Text := FNameFrom;
if not FromContact then
EFrom.Text := EFrom.Text + ' (' + AnsiToWideString
(FProtocol + ': ' + GetContactID(hSubContactFrom, FProtocol, FromContact),
ParentForm.UserCodepage) + ')';
EToMore.Enabled := not ToContact;
ETo.Text := FNameTo;
if not ToContact then
ETo.Text := ETo.Text + ' (' + AnsiToWideString
(FProtocol + ': ' + GetContactID(hSubContactTo, FProtocol, ToContact),
ParentForm.UserCodepage) + ')';
EText.Lines.BeginUpdate;
ParentForm.hg.ApplyItemToRich(FItem, EText, True);
EText.Brush.Style := bsClear;
EText.SelStart := 0;
EText.SelLength := 0;
SendMessage(EText.Handle, EM_REQUESTRESIZE, 0, 0);
EText.Lines.EndUpdate;
if FromContact or ToContact then
bnReply.Enabled := false
else
bnReply.Enabled := True;
// check forward and back buttons
NextBtn.Enabled := (NextItem <> -1);
PrevBtn.Enabled := (PrevItem <> -1);
FOverFile := IsFileEvent;
end;
procedure TEventDetailsFrm.PrevBtnClick(Sender: TObject);
begin
SetItem(PrevItem);
Assert(Assigned(FParentForm));
if FParentForm.hg.Selected <> FItem then
FParentForm.hg.Selected := FItem;
end;
procedure TEventDetailsFrm.NextBtnClick(Sender: TObject);
begin
SetItem(NextItem);
Assert(Assigned(FParentForm));
if FParentForm.hg.Selected <> FItem then
FParentForm.hg.Selected := FItem;
end;
procedure TEventDetailsFrm.ResetItem;
begin
SetItem(FItem);
end;
procedure TEventDetailsFrm.bnReplyClick(Sender: TObject);
begin
FParentForm.ReplyQuoted(FItem);
end;
procedure TEventDetailsFrm.TranslateForm;
begin
Caption := TranslateUnicodeString(Caption);
GroupBox.Caption := TranslateUnicodeString(GroupBox.Caption);
laType.Caption := TranslateUnicodeString(laType.Caption);
laDateTime.Caption := TranslateUnicodeString(laDateTime.Caption);
laFrom.Caption := TranslateUnicodeString(laFrom.Caption);
laTo.Caption := TranslateUnicodeString(laTo.Caption);
EFromMore.Hint := TranslateUnicodeString(EFromMore.Hint);
EToMore.Hint := TranslateUnicodeString(EToMore.Hint);
PrevBtn.Caption := TranslateUnicodeString(PrevBtn.Caption);
NextBtn.Caption := TranslateUnicodeString(NextBtn.Caption);
CloseBtn.Caption := TranslateUnicodeString(CloseBtn.Caption);
bnReply.Caption := TranslateUnicodeString(bnReply.Caption);
imDirection.Hint := TranslateUnicodeString(imDirection.Hint);
TranslateMenu(pmEText.Items);
end;
procedure TEventDetailsFrm.pmETextPopup(Sender: TObject);
begin
CopyText.Enabled := (EText.SelLength > 0);
SendMessage1.Enabled := (ParentForm.hContact <> 0);
ReplyQuoted1.Enabled := (ParentForm.hContact <> 0);
ToogleItemProcessing.Checked := GridOptions.TextFormatting;
OpenLinkNW.Visible := FOverURL;
OpenLink.Visible := FOverURL;
CopyLink.Visible := FOverURL;
BrowseReceivedFiles.Visible := FOverFile and not FOverURL;
OpenFileFolder.Visible := FOverFile and not FOverURL and (SavedFileDir <> '');
CopyFilename.Visible := FOverFile and not FOverURL;
end;
procedure TEventDetailsFrm.SelectAllClick(Sender: TObject);
begin
EText.SelectAll;
end;
procedure TEventDetailsFrm.CopyTextClick(Sender: TObject);
begin
EText.CopyToClipboard;
end;
procedure TEventDetailsFrm.CopyAllClick(Sender: TObject);
var
ss, sl: Integer;
begin
// CopyToClip(EText.Lines.Text,Handle,ParentForm.UserCodepage);
EText.Lines.BeginUpdate;
ss := EText.SelStart;
sl := EText.SelLength;
EText.SelectAll;
EText.CopyToClipboard;
EText.SelStart := ss;
EText.SelLength := sl;
EText.Lines.EndUpdate;
end;
procedure TEventDetailsFrm.SendMessage1Click(Sender: TObject);
begin
if ParentForm.hContact = 0 then
Exit;
SendMessageTo(ParentForm.hContact);
end;
procedure TEventDetailsFrm.ReplyQuoted1Click(Sender: TObject);
begin
if ParentForm.hContact = 0 then
Exit;
FParentForm.ReplyQuoted(FItem);
end;
procedure TEventDetailsFrm.WMSetCursor(var Message: TWMSetCursor);
var
p: TPoint;
begin
if (FRichHeight > 0) and (Message.CursorWnd = EText.Handle) and (Message.HitTest = HTCLIENT)
then
begin
p := EText.ScreenToClient(Mouse.CursorPos);
if p.Y > FRichHeight then
begin
if Windows.GetCursor <> Screen.Cursors[crIBeam] then
Windows.SetCursor(Screen.Cursors[crIBeam]);
Message.Result := 1;
Exit;
end;
end;
inherited;
end;
procedure TEventDetailsFrm.ToogleItemProcessingClick(Sender: TObject);
begin
GridOptions.TextFormatting := not GridOptions.TextFormatting;
end;
procedure TEventDetailsFrm.LoadButtonIcons;
begin
with EFromMore.Glyph do
begin
Width := 16;
Height := 16;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Canvas.ClipRect);
DrawIconEx(Canvas.Handle, 0, 0, hppIcons[HPP_ICON_CONTACDETAILS].Handle, 16, 16, 0,
Canvas.Brush.Handle, DI_NORMAL);
end;
with EToMore.Glyph do
begin
Width := 16;
Height := 16;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Canvas.ClipRect);
DrawIconEx(Canvas.Handle, 0, 0, hppIcons[HPP_ICON_CONTACDETAILS].Handle, 16, 16, 0,
Canvas.Brush.Handle, DI_NORMAL);
end;
with PrevBtn.Glyph do
begin
PrevBtn.NumGlyphs := 2;
Width := 16 * 2;
Height := 16;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Canvas.ClipRect);
DrawIconEx(Canvas.Handle, 0, 0, hppIcons[HPP_ICON_SEARCHUP].Handle, 16, 16, 0,
Canvas.Brush.Handle, DI_NORMAL);
DrawState(Canvas.Handle, 0, nil, hppIcons[HPP_ICON_SEARCHUP].Handle, 0, 16, 0, 16, 16,
DST_ICON or DSS_DISABLED);
end;
with NextBtn.Glyph do
begin
NextBtn.NumGlyphs := 2;
Width := 16 * 2;
Height := 16;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Canvas.ClipRect);
DrawIconEx(Canvas.Handle, 0, 0, hppIcons[HPP_ICON_SEARCHDOWN].Handle, 16, 16, 0,
Canvas.Brush.Handle, DI_NORMAL);
DrawState(Canvas.Handle, 0, nil, hppIcons[HPP_ICON_SEARCHDOWN].Handle, 0, 16, 0, 16, 16,
DST_ICON or DSS_DISABLED);
end;
end;
procedure TEventDetailsFrm.LoadMessageIcons;
var
ic: hIcon;
er: PEventRecord;
begin
er := GetEventRecord(FParentForm.hg.Items[FItem]);
if er.i = -1 then
ic := 0
else if er.iSkin = -1 then
ic := hppIcons[er.i].Handle
else
ic := skinIcons[er.i].Handle;
if ic = 0 then
ic := hppIcons[HPP_ICON_CONTACTHISTORY].Handle;
Icon.Handle := CopyIcon(ic);
with imDirection.Picture.Bitmap do
begin
Width := 16;
Height := 16;
Canvas.Brush.Color := clBtnFace;
Canvas.FillRect(Canvas.ClipRect);
if mtIncoming in FParentForm.hg.Items[FItem].MessageType then
ic := hppIcons[EventRecords[mtIncoming].i].Handle
else if mtOutgoing in FParentForm.hg.Items[FItem].MessageType then
ic := hppIcons[EventRecords[mtOutgoing].i].Handle
else
Exit;
DrawIconEx(Canvas.Handle, 0, 0, ic, 16, 16, 0, Canvas.Brush.Handle, DI_NORMAL);
end;
end;
procedure TEventDetailsFrm.HMIconsChanged(var M: TMessage);
begin
LoadMessageIcons;
end;
procedure TEventDetailsFrm.HMIcons2Changed(var M: TMessage);
begin
LoadMessageIcons;
LoadButtonIcons;
end;
procedure TEventDetailsFrm.ETextResizeRequest(Sender: TObject; Rect: TRect);
begin
FRichHeight := Rect.Bottom - Rect.Top;
end;
procedure TEventDetailsFrm.HMEventDeleted(var Message: TMessage);
begin
if uint_ptr(Message.WParam) = ParentForm.History[ParentForm.GridIndexToHistory(FItem)] then
Close;
end;
procedure TEventDetailsFrm.WMSysColorChange(var Message: TMessage);
begin
inherited;
LoadMessageIcons;
LoadButtonIcons;
Repaint;
end;
procedure TEventDetailsFrm.OpenLinkNWClick(Sender: TObject);
begin
if SavedLinkUrl = '' then
Exit;
OpenUrl(SavedLinkUrl, True);
SavedLinkUrl := '';
end;
procedure TEventDetailsFrm.OpenLinkClick(Sender: TObject);
begin
if SavedLinkUrl = '' then
Exit;
OpenUrl(SavedLinkUrl, false);
SavedLinkUrl := '';
end;
procedure TEventDetailsFrm.CopyLinkClick(Sender: TObject);
begin
if SavedLinkUrl = '' then
Exit;
CopyToClip(SavedLinkUrl, CP_ACP);
SavedLinkUrl := '';
end;
procedure TEventDetailsFrm.ETextMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
FOverURL := false;
end;
function TEventDetailsFrm.GetPrevItem: Integer;
begin
if Assigned(FParentForm) then
Result := FParentForm.hg.GetPrev(FItem)
else
Result := -1;
end;
function TEventDetailsFrm.GetNextItem: Integer;
begin
if Assigned(FParentForm) then
Result := FParentForm.hg.GetNext(FItem)
else
Result := -1;
end;
function TEventDetailsFrm.IsFileEvent: Boolean;
begin
Result := Assigned(FParentForm) and (mtFile in FParentForm.hg.Items[FItem].MessageType);
if Result then
begin
// Auto CP_ACP usage
SavedLinkUrl := ExtractFileName(String(FParentForm.hg.Items[FItem].Extended));
SavedFileDir := ExtractFileDir(String(FParentForm.hg.Items[FItem].Extended));
end;
end;
procedure TEventDetailsFrm.OpenFileFolderClick(Sender: TObject);
begin
if SavedFileDir = '' then
Exit;
ShellExecuteW(0, 'open', PChar(SavedFileDir), nil, nil, SW_SHOW);
SavedFileDir := '';
end;
procedure TEventDetailsFrm.BrowseReceivedFilesClick(Sender: TObject);
var
Path: Array [0 .. MAX_PATH] of AnsiChar;
begin
CallService(MS_FILE_GETRECEIVEDFILESFOLDER, FParentForm.hContact, LPARAM(@Path));
ShellExecuteA(0, 'open', Path, nil, nil, SW_SHOW);
end;
procedure TEventDetailsFrm.ETextURLClick(Sender: TObject; const URLText: String; Button: TMouseButton);
begin
SavedLinkUrl := URLText;
case Button of
mbLeft : OpenLinkNW.Click;
mbRight: FOverURL := True;
end;
end;
end.
|