Changeset 25 for trunk/Forms
- Timestamp:
- Nov 9, 2011, 1:58:00 PM (13 years ago)
- Location:
- trunk/Forms
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/ULoginForm.lfm
r22 r25 1 1 object LoginForm: TLoginForm 2 Left = 4823 Height = 1 714 Top = 2585 Width = 3992 Left = 312 3 Height = 163 4 Top = 186 5 Width = 433 6 6 BorderIcons = [biSystemMenu] 7 7 BorderStyle = bsDialog 8 8 Caption = 'Login' 9 ClientHeight = 171 10 ClientWidth = 399 9 ClientHeight = 163 10 ClientWidth = 433 11 OnClose = FormClose 12 OnShow = FormShow 11 13 LCLVersion = '0.9.31' 12 14 object Label1: TLabel 13 15 Left = 16 14 16 Height = 14 15 Top = 4817 Top = 64 16 18 Width = 53 17 19 Caption = 'Username:' … … 21 23 Left = 16 22 24 Height = 14 23 Top = 8025 Top = 96 24 26 Width = 51 25 27 Caption = 'Password:' … … 32 34 Width = 75 33 35 Caption = 'Close' 36 ModalResult = 11 37 OnClick = ButtonCancelClick 34 38 TabOrder = 0 35 39 end … … 40 44 Width = 75 41 45 Caption = 'Login' 46 ModalResult = 1 47 OnClick = ButtonLoginClick 42 48 TabOrder = 1 43 49 end 44 object Edit 1: TEdit50 object EditUserName: TEdit 45 51 Left = 88 46 52 Height = 21 47 Top = 4053 Top = 64 48 54 Width = 104 49 55 TabOrder = 2 50 56 end 51 object MaskEdit 1: TMaskEdit57 object MaskEditPassword: TMaskEdit 52 58 Left = 88 53 59 Height = 21 54 Top = 7160 Top = 96 55 61 Width = 104 56 62 CharCase = ecNormal … … 61 67 SpaceChar = '_' 62 68 end 69 object Label3: TLabel 70 Left = 16 71 Height = 14 72 Top = 12 73 Width = 59 74 Caption = 'Connection:' 75 ParentColor = False 76 end 77 object ComboBoxConnection: TComboBox 78 Left = 88 79 Height = 21 80 Top = 12 81 Width = 105 82 ItemHeight = 13 83 Style = csDropDownList 84 TabOrder = 4 85 end 86 object ButtonChange: TButton 87 Left = 198 88 Height = 25 89 Top = 9 90 Width = 67 91 Caption = 'Change' 92 OnClick = ButtonChangeClick 93 TabOrder = 5 94 end 63 95 object Image1: TImage 64 Left = 2 1665 Height = 1 5266 Top = 1 667 Width = 1 6896 Left = 272 97 Height = 140 98 Top = 12 99 Width = 152 68 100 end 69 101 end -
trunk/Forms/ULoginForm.lrt
r10 r25 4 4 TLOGINFORM.BUTTONCANCEL.CAPTION=Close 5 5 TLOGINFORM.BUTTONLOGIN.CAPTION=Login 6 TLOGINFORM.MASKEDIT1.TEXT=* 6 TLOGINFORM.MASKEDITPASSWORD.TEXT=* 7 TLOGINFORM.LABEL3.CAPTION=Connection: 8 TLOGINFORM.BUTTONCHANGE.CAPTION=Change -
trunk/Forms/ULoginForm.pas
r3 r25 7 7 uses 8 8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 MaskEdit, ExtCtrls ;9 MaskEdit, ExtCtrls, URegistry, Registry; 10 10 11 11 type … … 14 14 15 15 TLoginForm = class(TForm) 16 ButtonChange: TButton; 16 17 ButtonCancel: TButton; 17 18 ButtonLogin: TButton; 18 Edit1: TEdit; 19 ComboBoxConnection: TComboBox; 20 EditUserName: TEdit; 19 21 Image1: TImage; 20 22 Label1: TLabel; 21 23 Label2: TLabel; 22 MaskEdit1: TMaskEdit; 24 Label3: TLabel; 25 MaskEditPassword: TMaskEdit; 26 procedure ButtonCancelClick(Sender: TObject); 27 procedure ButtonChangeClick(Sender: TObject); 28 procedure ButtonLoginClick(Sender: TObject); 29 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 30 procedure FormShow(Sender: TObject); 23 31 private 24 { private declarations }25 32 public 26 { public declarations } 27 end; 33 end; 28 34 29 35 var … … 34 40 {$R *.lfm} 35 41 42 uses 43 UCore, ULoginProfileForm, UMainForm; 44 45 { TLoginForm } 46 47 procedure TLoginForm.ButtonLoginClick(Sender: TObject); 48 begin 49 Core.LastUserName := EditUserName.Text; 50 Core.LastProfile := ComboBoxConnection.ItemIndex; 51 Core.LastPassword := MaskEditPassword.Text; 52 end; 53 54 procedure TLoginForm.FormClose(Sender: TObject; var CloseAction: TCloseAction); 55 begin 56 MainForm.PersistentForm.Save(Self); 57 end; 58 59 procedure TLoginForm.FormShow(Sender: TObject); 60 begin 61 MainForm.PersistentForm.Load(Self); 62 ComboBoxConnection.ItemIndex := Core.LastProfile; 63 EditUserName.Text := Core.LastUserName; 64 MaskEditPassword.Text := ''; 65 Core.Profiles.FillStrings(ComboBoxConnection.Items); 66 end; 67 68 procedure TLoginForm.ButtonCancelClick(Sender: TObject); 69 begin 70 Close; 71 end; 72 73 procedure TLoginForm.ButtonChangeClick(Sender: TObject); 74 begin 75 if LoginProfileForm.ShowModal = mrOk then begin 76 Core.Profiles.FillStrings(ComboBoxConnection.Items); 77 end; 78 end; 79 36 80 end. 37 81 -
trunk/Forms/UMainForm.lfm
r24 r25 6 6 ActiveControl = Panel1 7 7 Caption = 'ChronIS' 8 ClientHeight = 42 28 ClientHeight = 427 9 9 ClientWidth = 640 10 10 Menu = MainMenu1 … … 16 16 object Panel1: TPanel 17 17 Left = 0 18 Height = 42 218 Height = 427 19 19 Top = 0 20 20 Width = 184 21 21 Align = alLeft 22 22 BevelOuter = bvNone 23 ClientHeight = 42 223 ClientHeight = 427 24 24 ClientWidth = 184 25 25 TabOrder = 0 26 26 object Label1: TLabel 27 27 Left = 7 28 Height = 1 828 Height = 14 29 29 Top = 4 30 Width = 5130 Width = 39 31 31 Caption = 'Groups:' 32 32 ParentColor = False … … 34 34 object TreeView1: TTreeView 35 35 Left = 4 36 Height = 39836 Height = 403 37 37 Top = 19 38 38 Width = 180 39 39 Anchors = [akTop, akLeft, akRight, akBottom] 40 DefaultItemHeight = 16 40 41 Images = ImageListActions 41 42 ReadOnly = True … … 47 48 object Panel2: TPanel 48 49 Left = 189 49 Height = 42 250 Height = 427 50 51 Top = 0 51 52 Width = 451 52 53 Align = alClient 53 54 BevelOuter = bvNone 54 ClientHeight = 42 255 ClientHeight = 427 55 56 ClientWidth = 451 56 57 TabOrder = 1 57 58 object Label2: TLabel 58 59 Left = 2 59 Height = 1 860 Height = 14 60 61 Top = 4 61 Width = 5462 Width = 43 62 63 Caption = 'Reports:' 63 64 ParentColor = False … … 65 66 object ListView1: TListView 66 67 Left = 2 67 Height = 3 6668 Height = 371 68 69 Top = 19 69 70 Width = 447 … … 85 86 Left = 3 86 87 Height = 25 87 Top = 39 388 Top = 398 88 89 Width = 75 89 90 Action = AItemAdd … … 94 95 Left = 83 95 96 Height = 25 96 Top = 39 397 Top = 398 97 98 Width = 75 98 99 Action = AItemDelete … … 103 104 object Splitter1: TSplitter 104 105 Left = 184 105 Height = 42 2106 Height = 427 106 107 Top = 0 107 108 Width = 5 … … 184 185 Caption = 'Import structure...' 185 186 OnExecute = AImportStructureExecute 187 end 188 object AAbout: TAction 189 Caption = 'About' 190 OnExecute = AAboutExecute 186 191 end 187 192 end … … 316 321 object MenuItem17: TMenuItem 317 322 Action = AConnect 323 OnClick = MenuItem17Click 318 324 end 319 325 object MenuItem14: TMenuItem … … 341 347 object MenuItem12: TMenuItem 342 348 Caption = 'Help' 349 object MenuItem21: TMenuItem 350 Action = AAbout 351 end 343 352 end 344 353 end -
trunk/Forms/UMainForm.lrt
r24 r25 20 20 TMAINFORM.AINITSYSTEMVALUES.CAPTION=Init system values 21 21 TMAINFORM.AIMPORTSTRUCTURE.CAPTION=Import structure... 22 TMAINFORM.AABOUT.CAPTION=About 22 23 TMAINFORM.MENUITEM13.CAPTION=Server 23 24 TMAINFORM.MENUITEM11.CAPTION=View -
trunk/Forms/UMainForm.pas
r24 r25 17 17 published 18 18 AConnect: TAction; 19 AAbout: TAction; 19 20 AImportStructure: TAction; 20 21 AInitSystemValues: TAction; … … 53 54 MenuItem2: TMenuItem; 54 55 MenuItem20: TMenuItem; 56 MenuItem21: TMenuItem; 55 57 MenuItem3: TMenuItem; 56 58 MenuItem4: TMenuItem; … … 67 69 Splitter1: TSplitter; 68 70 TreeView1: TTreeView; 71 procedure AAboutExecute(Sender: TObject); 69 72 procedure AConnectExecute(Sender: TObject); 70 73 procedure AExitExecute(Sender: TObject); … … 91 94 procedure ListView1SelectItem(Sender: TObject; Item: TListItem; 92 95 Selected: Boolean); 96 procedure MenuItem17Click(Sender: TObject); 93 97 procedure TreeView1Change(Sender: TObject; Node: TTreeNode); 94 98 private … … 96 100 OriginalWindowState: TWindowState; 97 101 ScreenBounds: TRect; 98 RegistryKey: string;99 RegistryRootKey: HKEY;100 102 procedure LoadFromRegistry; 101 103 procedure SaveToRegistry; … … 128 130 uses 129 131 UItemView, UItemEdit, UItemAdd, ULoginForm, USettingForm, UApplicationInfo, 130 UCore, UImportStructureForm ;132 UCore, UImportStructureForm, UAboutForm, ULoginProfileForm; 131 133 132 134 {$R *.lfm} … … 138 140 with TRegistryEx.Create do 139 141 try 140 RootKey := RegistryRootKey;141 OpenKey( RegistryKey, True);142 RootKey := Core.RegistryRootKey; 143 OpenKey(Core.RegistryKey, True); 142 144 Panel1.Width := ReadIntegerWithDefault('GroupTreeWidth', 200); 143 Core.System.Database.Database := ReadStringWithDefault('DatabaseSchema', 'chronis');144 Core.System.Database.Hostname := ReadStringWithDefault('DatabaseHostName', 'localhost');145 Core.System.Database.UserName := ReadStringWithDefault('DatabaseUserName', 'chronis');146 Core.System.Database.Password := ReadStringWithDefault('DatabasePassword', '');147 145 with Core.CoolTranslator1 do 148 146 Language := Languages.SearchByCode(ReadStringWithDefault('LanguageCode', '')); … … 156 154 with TRegistryEx.Create do 157 155 try 158 RootKey := RegistryRootKey;159 OpenKey( RegistryKey, True);156 RootKey := Core.RegistryRootKey; 157 OpenKey(Core.RegistryKey, True); 160 158 WriteInteger('GroupTreeWidth', Panel1.Width); 161 WriteString('DatabaseSchema', Core.System.Database.Database);162 WriteString('DatabaseHostName', Core.System.Database.Hostname);163 WriteString('DatabaseUserName', Core.System.Database.UserName);164 WriteString('DatabasePassword', Core.System.Database.Password);165 159 with Core.CoolTranslator1 do 166 160 WriteString('LanguageCode', Language.Code); … … 520 514 SelectedObject := TChronisObject.Create; 521 515 SelectedObject.Base := Core.System; 522 RegistryRootKey := HKEY_CURRENT_USER;523 RegistryKey := '\Software\' + ApplicationInfo.CompanyName + '\' +524 ApplicationInfo.Name;525 516 PersistentForm := TPersistentForm.Create; 526 PersistentForm.RegistryKey := RegistryKey;517 PersistentForm.RegistryKey := Core.RegistryKey; 527 518 end; 528 519 … … 641 632 procedure TMainForm.AConnectExecute(Sender: TObject); 642 633 begin 643 LoginForm.ShowModal; 634 Core.Profiles.LoadFromRegistry(Core.RegistryRootKey, Core.RegistryKey); 635 if LoginForm.ShowModal = mrOK then begin 636 with TConnectProfile(Core.Profiles[Core.LastProfile]) do begin 637 Core.System.Database.HostName := HostName; 638 Core.System.Database.Database := Database; 639 Core.System.Database.UserName := Core.LastUserName; 640 Core.System.Database.Password := Core.LastPassword; 641 Core.System.Database.Connect; 642 end; 643 InitStructure; 644 Core.System.LoadTypes; 645 LoadTree; 646 end; 647 end; 648 649 procedure TMainForm.AAboutExecute(Sender: TObject); 650 begin 651 AboutForm.ShowModal; 644 652 end; 645 653 … … 648 656 PersistentForm.Load(Self); 649 657 LoadFromRegistry; 650 Core.System.Database.Connect; 651 InitStructure; 652 Core.System.LoadTypes; 653 LoadTree; 658 AConnect.Execute; 654 659 end; 655 660 … … 696 701 AItemView.Enabled := Assigned(ListView1.Selected); 697 702 AItemEdit.Enabled := Assigned(ListView1.Selected); 703 end; 704 705 procedure TMainForm.MenuItem17Click(Sender: TObject); 706 begin 707 LoginForm.ShowModal; 698 708 end; 699 709
Note:
See TracChangeset
for help on using the changeset viewer.