Changeset 25 for trunk/Forms/UMainForm.pas
- Timestamp:
- Nov 9, 2011, 1:58:00 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.