-
Notifications
You must be signed in to change notification settings - Fork 13
/
ProjectVersionSCR.pas
156 lines (132 loc) · 4 KB
/
ProjectVersionSCR.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
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
/// File Versioning SCR Editor form
// - this unit is part of SynProject, under GPL 3.0 license; version 1.7
unit ProjectVersionSCR;
(*
This file is part of SynProject.
Synopse SynProject. Copyright (C) 2008-2023 Arnaud Bouchez
Synopse Informatique - https://synopse.info
SynProject 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 3 of the License, or (at
your option) any later version.
SynProject 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 Lesser General Public License for more details.
You should have received a copy of the GNU General Public License
along with SynProject. If not, see <http://www.gnu.org/licenses/>.
*)
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, SynMemoEx,
Dialogs, StdCtrls, ExtCtrls, Buttons, ProjectFrameRisk;
type
TProjectVersionSCRForm = class(TForm)
Description: TLabeledEdit;
ShortName: TLabeledEdit;
Request: TLabeledEdit;
BtnOK: TBitBtn;
BtnCancel: TBitBtn;
Ident: TLabeledEdit;
BtnTrackerImport: TBitBtn;
procedure BtnOKClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BtnTrackerImportClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
FrameRisk: TFrameRisk;
TrackNumber: integer;
Risk,
Body: string;
procedure Init(const Title: string);
end;
var
ProjectVersionSCRForm: TProjectVersionSCRForm;
function NotVoid(Field: TComponent): boolean;
resourcestring
SErrorFieldEmpty = 'This field must not be empty';
implementation
uses ProjectTrackerLogin;
{$R *.dfm}
procedure TProjectVersionSCRForm.Init(const Title: string);
begin
Caption := ' '+Title;
Description.Text := '';
ShortName.Text := '';
Request.Text := '';
Ident.Text := '';
TrackNumber := -1;
Body := '';
FrameRisk.Init('');
end;
function NotVoid(Field: TComponent): boolean;
begin
if Field<>nil then
if Field.InheritsFrom(TLabeledEdit) then begin
result := TLabeledEdit(Field).Text<>'';
if result then exit;
MessageDlg(TLabeledEdit(Field).EditLabel.Caption+#13#13+
SErrorFieldEmpty,mtError,[mbOk],0);
TLabeledEdit(Field).SetFocus;
exit;
end else
if Field.InheritsFrom(TMemoEx) then begin
result := TMemoEx(Field).Lines.HasText;
if result then exit;
MessageDlg(SErrorFieldEmpty,mtError,[mbOk],0);
TMemoEx(Field).SetFocus;
exit;
end;
result := true;
end;
procedure TProjectVersionSCRForm.BtnOKClick(Sender: TObject);
begin
if not TryStrToInt(Ident.Text,TrackNumber) then begin
TrackNumber := -1;
MessageDlg(Ident.EditLabel.Caption+' '+Ident.Hint,mtError,[mbOk],0);
Ident.SetFocus;
end else
if (TrackNumber>=0) and notVoid(Description) and notVoid(Request) then begin
Risk := FrameRisk.Risk;
exit;
end;
ModalResult := mrNone;
end;
procedure TProjectVersionSCRForm.FormShow(Sender: TObject);
begin
if TrackNumber<0 then
Ident.SetFocus;
end;
procedure TProjectVersionSCRForm.FormCreate(Sender: TObject);
begin
FrameRisk := TFrameRisk.Create(self);
FrameRisk.Parent := self;
FrameRisk.Left := Ident.Left;
FrameRisk.Top := 216;
end;
procedure TProjectVersionSCRForm.BtnTrackerImportClick(Sender: TObject);
var F: TProjectTrackerLoginForm;
aDescription, aRequest: string;
begin
F := TrackerLogin(false);
if F<>nil then
try
F.ShowSCRList;
if (F.ShowModal=mrOk) and (F.SelectedID>0) then
try
Screen.Cursor := crHourGlass;
SCRImportOne(F.Tracker,F.SelectedID,aDescription,aRequest,@Body);
Ident.Text := IntToStr(F.SelectedID);
Description.Text := aDescription;
Request.Text := aRequest;
finally
Screen.Cursor := crDefault;
end;
finally
DeleteTempForm(F);
end;
end;
end.