-
Notifications
You must be signed in to change notification settings - Fork 0
/
InviteProperty.pas
70 lines (61 loc) · 2.15 KB
/
InviteProperty.pas
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
unit InviteProperty;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, CloudMailRu, CMLTypes, MRC_Helper;
type
TInvitePropertyForm = class(TForm)
InviteNameLB: TLabel;
InviteOwnerEmailLB: TLabel;
InviteOwnerNameLB: TLabel;
InviteAccessLB: TLabel;
NameLB: TLabel;
OwnerEmailLB: TLabel;
OwnerNameLB: TLabel;
AccessLB: TLabel;
SizeLB: TLabel;
InviteSizeLB: TLabel;
MountBTN: TButton;
CancelBTN: TButton;
RejectBTN: TButton;
TokenLB: TLabel;
InviteTokenLB: TLabel;
UnmountCopyBTN: TButton;
UnmountDeleteBTN: TButton;
private
{Private declarations}
public
{Public declarations}
class function ShowProperties(parentWindow: HWND; Item: TCloudMailRuIncomingInviteInfo; AccountName: WideString = ''): integer;
end;
implementation
{$R *.dfm}
{TInvitePropertyForm}
class function TInvitePropertyForm.ShowProperties(parentWindow: HWND; Item: TCloudMailRuIncomingInviteInfo; AccountName: WideString): integer;
var
InvitePropertyForm: TInvitePropertyForm;
begin
try
InvitePropertyForm := TInvitePropertyForm.Create(nil);
InvitePropertyForm.parentWindow := parentWindow;
InvitePropertyForm.InviteNameLB.Caption := Item.name;
InvitePropertyForm.InviteOwnerEmailLB.Caption := Item.owner.email;
InvitePropertyForm.InviteOwnerNameLB.Caption := Item.owner.name;
InvitePropertyForm.InviteAccessLB.Caption := TCloudMailRu.CloudAccessToString(Item.access);
InvitePropertyForm.InviteSizeLB.Caption := FormatSize(Item.size, TYPE_BYTES);
InvitePropertyForm.InviteTokenLB.Caption := Item.invite_token;
InvitePropertyForm.Caption := AccountName + ' invite: ' + Item.name;
if Item.home <> EmptyWideStr then //already mounted item
begin
InvitePropertyForm.TokenLB.Caption := 'Mounted as:';
InvitePropertyForm.InviteTokenLB.Caption := Item.home;
InvitePropertyForm.RejectBTN.Enabled := false;
end else begin
InvitePropertyForm.UnmountCopyBTN.Enabled := false;
InvitePropertyForm.UnmountDeleteBTN.Enabled := false;
end;
result := InvitePropertyForm.ShowModal;
finally
FreeAndNil(InvitePropertyForm);
end;
end;
end.