root/trunk/Forms/frm_bases.pas
| 351 | 463 | ||
|---|---|---|---|
1 | (* ***************************************************************************** | ||
2 | * | ||
3 | * MyHomeLib | ||
4 | * | ||
5 | * Copyright (C) 2008-2010 Aleksey Penkov | ||
6 | * | ||
7 | * Created 22.02.2010 | ||
8 | * Description Форма редактирования свойств коллекции | ||
9 | * Author(s) Aleksey Penkov alex.penkov@gmail.com | ||
10 | * Nick Rymanov nrymanov@gmail.com | ||
11 | * | ||
12 | ****************************************************************************** *) | ||
1 | 13 | ||
2 | {******************************************************************************} | 14 | { |
3 | { } | 15 | TODO -oNickR : возможно, стоит здесь задавать свойства обновления. сервер, названия файлов обновлений и периодичность обновлений |
4 | { MyHomeLib } | 16 | } |
5 | { } | ||
6 | { Version 0.9 } | ||
7 | { 20.08.2008 } | ||
8 | { Copyright (c) Aleksey Penkov alex.penkov@gmail.com } | ||
9 | { } | ||
10 | {******************************************************************************} | ||
11 | 17 | ||
12 | unit frm_bases; | 18 | unit frm_bases; |
13 | 19 | ||
... | ... | ||
27 | Mask, | 33 | Mask, |
28 | ExtCtrls, | 34 | ExtCtrls, |
29 | unit_StaticTip, | 35 | unit_StaticTip, |
30 | RzEdit, | 36 | unit_AutoCompleteEdit, |
31 | RzBtnEdt, | 37 | ComCtrls; |
32 | RzPanel, | ||
33 | RzRadGrp, unit_AutoCompleteEdit, RzLabel, RzTabs; | ||
34 | 38 | ||
35 | type | 39 | type |
36 | TfrmBases = class(TForm) | 40 | TfrmBases = class(TForm) |
37 | RzPageControl1: TRzPageControl; | 41 | pcCollectionInfo: TPageControl; |
38 | TabSheet1: TRzTabSheet; | 42 | tsGeneralInfo: TTabSheet; |
39 | TabSheet2: TRzTabSheet; | 43 | tsConnectionInfo: TTabSheet; |
40 | RzPanel1: TRzPanel; | ||
41 | btnCancel: TButton; | ||
42 | btnSave: TButton; | ||
43 | cbRelativePath: TCheckBox; | 44 | cbRelativePath: TCheckBox; |
44 | MHLStaticTip1: TMHLStaticTip; | 45 | MHLStaticTip1: TMHLStaticTip; |
45 | edDescription: TRzEdit; | 46 | edDescription: TEdit; |
46 | Label1: TLabel; | 47 | lblCollectionDescription: TLabel; |
47 | Label5: TLabel; | 48 | lblCollectionRoot: TLabel; |
48 | edCollectionRoot: TMHLAutoCompleteEdit; | 49 | edCollectionRoot: TMHLAutoCompleteEdit; |
49 | edCollectionFile: TMHLAutoCompleteEdit; | 50 | edCollectionFile: TMHLAutoCompleteEdit; |
50 | edCollectionName: TEdit; | 51 | edCollectionName: TEdit; |
51 | Label9: TLabel; | 52 | lblCollectionFile: TLabel; |
52 | Label8: TLabel; | 53 | lblCollectionName: TLabel; |
53 | btnNewFile: TButton; | 54 | btnNewFile: TButton; |
54 | btnSelectRoot: TButton; | 55 | btnSelectRoot: TButton; |
55 | RzLabel5: TRzLabel; | 56 | lblUser: TLabel; |
56 | edUser: TRzEdit; | 57 | edUser: TEdit; |
57 | edPass: TRzMaskEdit; | 58 | edPass: TEdit; |
58 | RzLabel6: TRzLabel; | 59 | lblPassword: TLabel; |
59 | edURL: TRzEdit; | 60 | edURL: TEdit; |
60 | RzLabel1: TRzLabel; | 61 | lblURL: TLabel; |
61 | RzLabel2: TRzLabel; | 62 | lblScript: TLabel; |
62 | mmScript: TMemo; | 63 | mmScript: TMemo; |
64 | pnButtons: TPanel; | ||
65 | btnOk: TButton; | ||
66 | btnCancel: TButton; | ||
67 | |||
63 | procedure FormShow(Sender: TObject); | 68 | procedure FormShow(Sender: TObject); |
64 | procedure edDBFileButtonClick(Sender: TObject); | 69 | procedure edDBFileButtonClick(Sender: TObject); |
65 | procedure edDBFolderButtonClick(Sender: TObject); | 70 | procedure edDBFolderButtonClick(Sender: TObject); |
... | ... | ||
112 | unit_Settings, | 117 | unit_Settings, |
113 | unit_Helpers, | 118 | unit_Helpers, |
114 | unit_Consts, | 119 | unit_Consts, |
115 | unit_Errors; | 120 | unit_Errors, |
121 | IOUtils; | ||
116 | 122 | ||
117 | {$R *.dfm} | 123 | {$R *.dfm} |
118 | 124 | ||
... | ... | ||
128 | Pass := DMUser.ActiveCollection.Password; | 134 | Pass := DMUser.ActiveCollection.Password; |
129 | User := DMUser.ActiveCollection.User; | 135 | User := DMUser.ActiveCollection.User; |
130 | Script := DMUser.ActiveCollection.Script; | 136 | Script := DMUser.ActiveCollection.Script; |
131 | |||
132 | end; | 137 | end; |
133 | 138 | ||
134 | function TfrmBases.GetDisplayName: string; | 139 | function TfrmBases.GetDisplayName: string; |
... | ... | ||
136 | Result := Trim(edCollectionName.Text); | 141 | Result := Trim(edCollectionName.Text); |
137 | end; | 142 | end; |
138 | 143 | ||
139 | function TfrmBases.GetPass: string; | 144 | procedure TfrmBases.SetDisplayName(const Value: string); |
140 | begin | 145 | begin |
141 | Result := edPass.Text; | 146 | edCollectionName.Text := Value; |
142 | end; | 147 | end; |
143 | 148 | ||
144 | procedure TfrmBases.SetDisplayName(const Value: string); | 149 | function TfrmBases.GetPass: string; |
145 | begin | 150 | begin |
146 | edCollectionName.Text := Value; | 151 | Result := edPass.Text; |
147 | end; | 152 | end; |
148 | 153 | ||
149 | procedure TfrmBases.SetPass(const Value: string); | 154 | procedure TfrmBases.SetPass(const Value: string); |
... | ... | ||
161 | Result := Trim(edDescription.Text); | 166 | Result := Trim(edDescription.Text); |
162 | end; | 167 | end; |
163 | 168 | ||
164 | procedure TfrmBases.SetDBFileName(const Value: string); | 169 | procedure TfrmBases.SetDescription(const Value: string); |
165 | begin | 170 | begin |
166 | edCollectionFile.Text := Value; | 171 | edDescription.Text := Value; |
167 | end; | 172 | end; |
168 | 173 | ||
169 | procedure TfrmBases.SetDescription(const Value: string); | 174 | procedure TfrmBases.SetDBFileName(const Value: string); |
170 | begin | 175 | begin |
171 | edDescription.Text := Value; | 176 | edCollectionFile.Text := Value; |
172 | end; | 177 | end; |
173 | 178 | ||
174 | function TfrmBases.GetRootFolder: string; | 179 | function TfrmBases.GetRootFolder: string; |
... | ... | ||
176 | Result := Trim(edCollectionRoot.Text); | 181 | Result := Trim(edCollectionRoot.Text); |
177 | end; | 182 | end; |
178 | 183 | ||
179 | function TfrmBases.GetScript: string; | 184 | procedure TfrmBases.SetRootFolder(const Value: string); |
180 | begin | 185 | begin |
181 | Result := mmScript.Lines.Text; | 186 | edCollectionRoot.Text := Value; |
182 | end; | 187 | end; |
183 | 188 | ||
184 | function TfrmBases.GetURL: string; | 189 | function TfrmBases.GetScript: string; |
185 | begin | 190 | begin |
186 | Result := edURL.Text; | 191 | Result := mmScript.Lines.Text; |
187 | end; | 192 | end; |
188 | 193 | ||
189 | function TfrmBases.GetUser: string; | 194 | procedure TfrmBases.SetScript(const Value: string); |
190 | begin | 195 | begin |
191 | Result := edUser.Text; | 196 | mmScript.Lines.Clear; |
197 | mmscript.Lines.Text := Value; | ||
192 | end; | 198 | end; |
193 | 199 | ||
194 | procedure TfrmBases.SetRootFolder(const Value: string); | 200 | function TfrmBases.GetURL: string; |
195 | begin | 201 | begin |
196 | edCollectionRoot.Text := Value; | 202 | Result := edURL.Text; |
197 | end; | 203 | end; |
198 | 204 | ||
199 | procedure TfrmBases.SetScript(const Value: string); | 205 | procedure TfrmBases.SetURL(const Value: string); |
200 | begin | 206 | begin |
201 | mmScript.Lines.Clear; | 207 | edURL.Text := Value; |
202 | mmscript.Lines.Text := Value; | ||
203 | end; | 208 | end; |
204 | 209 | ||
205 | procedure TfrmBases.SetURL(const Value: string); | 210 | function TfrmBases.GetUser: string; |
206 | begin | 211 | begin |
207 | edURL.Text := Value; | 212 | Result := edUser.Text; |
208 | end; | 213 | end; |
209 | 214 | ||
210 | procedure TfrmBases.SetUser(const Value: string); | 215 | procedure TfrmBases.SetUser(const Value: string); |
... | ... | ||
216 | var | 221 | var |
217 | AFileName: string; | 222 | AFileName: string; |
218 | begin | 223 | begin |
224 | { TODO -oNickR -cBug : совершенно непонятно почему, после вызова этого метода форма теряет фокус }
| ||
219 | if GetFileName(fnOpenCollection, AFileName) then | 225 | if GetFileName(fnOpenCollection, AFileName) then |
220 | edCollectionFile.Text := AFileName; | 226 | edCollectionFile.Text := AFileName; |
221 | end; | 227 | end; |
... | ... | ||
233 | ADBFileName: string; | 239 | ADBFileName: string; |
234 | ARootFolder: string; | 240 | ARootFolder: string; |
235 | begin | 241 | begin |
236 | |||
237 | if (DisplayName = '') or (DBFileName = '') or (RootFolder = '') then | 242 | if (DisplayName = '') or (DBFileName = '') or (RootFolder = '') then |
238 | begin | 243 | begin |
239 | MessageDlg(rstrAllFieldsShouldBeFilled, mtError, [mbOk], 0); | 244 | MessageDlg(rstrAllFieldsShouldBeFilled, mtError, [mbOk], 0); |
... | ... | ||
265 | ADBFileName := DBFileName; | 270 | ADBFileName := DBFileName; |
266 | if '' = ExtractFileExt(ADBFileName) then | 271 | if '' = ExtractFileExt(ADBFileName) then |
267 | ADBFileName := ChangeFileExt(ADBFileName, COLLECTION_EXTENSION); | 272 | ADBFileName := ChangeFileExt(ADBFileName, COLLECTION_EXTENSION); |
273 | |||
268 | ARootFolder := ExcludeTrailingPathDelimiter(RootFolder); | 274 | ARootFolder := ExcludeTrailingPathDelimiter(RootFolder); |
269 | end; | 275 | end; |
270 | 276 |
Download diff