Changeset 40 for trunk


Ignore:
Timestamp:
Mar 9, 2012, 8:11:13 AM (13 years ago)
Author:
chronos
Message:
  • Added: Remember last password in login dialog.
  • Fixed: Some Add, Edit, View, Select dialog display.
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Clients/UChronisClientMySQL.pas

    r38 r40  
    8888      NewObject := TObjectProxy.Create;
    8989      NewObject.Client := AList.Client;
     90      NewObject.ObjectName := AList.ObjectName;
     91      NewObject.SchemaName := AList.SchemaName;
    9092      NewObject.Properties.Assign(TDictionaryStringString(DbRows[I]));
    9193      AList.Objects.Add(NewObject);
  • trunk/Application/UDataTypes.pas

    r37 r40  
    1414
    1515  TDataType = class
     16    Name: string;
    1617    CustomType: Integer;
    1718    Control: TWinControl;
     
    2324    procedure SetDefault; virtual;
    2425    function GetStringValue: string; virtual;
     26    constructor Create; virtual;
    2527  end;
    2628
     
    3739    procedure Load(CellValue: string); override;
    3840    procedure LoadDef(CustomType: Integer); override;
     41    constructor Create; override;
    3942  end;
    4043
     
    4952    function GetControlValue(Control: TWinControl): string; override;
    5053    procedure Load(CellValue: string); override;
     54    constructor Create; override;
    5155  end;
    5256
     
    6064    procedure SetupControl(Control: TWinControl); override;
    6165    procedure Load(CellValue: string); override;
     66    constructor Create; override;
    6267  end;
    6368
     
    7176    procedure SetupControl(Control: TWinControl); override;
    7277    procedure Load(CellValue: string); override;
     78    constructor Create; override;
    7379  end;
    7480
     
    8692    procedure Load(CellValue: string); override;
    8793    procedure LoadDef(ACustomType: Integer); override;
     94    constructor Create; override;
    8895  end;
    8996
     
    99106    procedure Load(CellValue: string); override;
    100107    procedure LoadDef(ACustomType: Integer); override;
     108    constructor Create; override;
    101109  end;
    102110
     
    112120    procedure SetupControl(Control: TWinControl); override;
    113121    procedure Load(CellValue: string); override;
     122    constructor Create; override;
    114123  end;
    115124
     
    123132    procedure SetupControl(Control: TWinControl); override;
    124133    procedure Load(CellValue: string); override;
     134    constructor Create; override;
    125135  end;
    126136
     
    136146    procedure SetupControl(Control: TWinControl); override;
    137147    procedure Load(CellValue: string); override;
     148    constructor Create; override;
    138149  end;
    139150
     
    144155
    145156uses
    146   USqlDatabase, USystem, UCore, UItemSelect;
     157  USqlDatabase, USystem, UCore, UItemSelect, UMainForm;
    147158
    148159function GetDataType(ACustomType: Integer): TDataType;
     
    216227end;
    217228
     229constructor TDataTypeDateTime.Create;
     230begin
     231  inherited Create;
     232  Name := 'DateType';
     233end;
     234
    218235{ TDataTypeRelationMany }
    219236
    220237function TDataTypeRelationMany.CreateControl(Owner: TComponent): TWinControl;
    221238begin
    222   Result:=inherited CreateControl(Owner);
     239  Result := inherited CreateControl(Owner);
    223240end;
    224241
     
    260277end;
    261278
     279constructor TDataTypeRelationMany.Create;
     280begin
     281  inherited Create;
     282  Name := 'RelationMany';
     283end;
     284
    262285{ TDataTypeRelationOne }
    263286
    264287procedure TDataTypeRelationOne.ButtonClickExecute(Sender: TObject);
    265 begin
    266   ItemSelectForm.ObjectId := ObjectId;
    267   ItemSelectForm.ShowModal;
    268   TEditButton(Control).Text := IntToStr(ItemSelectForm.SelectedId)
     288var
     289  NewSelectForm: TItemSelectForm;
     290begin
     291  try
     292    NewSelectForm := TItemSelectForm.Create(MainForm);
     293    NewSelectForm.ObjectId := ObjectId;
     294    NewSelectForm.ShowModal;
     295    TEditButton(Control).Text := IntToStr(NewSelectForm.SelectedId)
     296  finally
     297    ItemSelectForm.Free;
     298  end;
    269299end;
    270300
     
    309339end;
    310340
     341constructor TDataTypeRelationOne.Create;
     342begin
     343  inherited Create;
     344  Name := 'RelationOne';
     345end;
     346
    311347
    312348{ TDataTypePassword }
     
    327363end;
    328364
     365constructor TDataTypePassword.Create;
     366begin
     367  inherited Create;
     368  Name := 'Password';
     369end;
     370
    329371{ TDataTypeFloat }
    330372
     
    349391end;
    350392
     393constructor TDataTypeFloat.Create;
     394begin
     395  inherited Create;
     396  Name := 'Float';
     397end;
     398
    351399{ TDataTypeDateTime }
    352400
     
    371419end;
    372420
     421constructor TDataTypeDate.Create;
     422begin
     423  inherited Create;
     424  Name := 'Date';
     425end;
     426
    373427{ TDataTypeBoolean }
    374428
     
    391445begin
    392446  Value := Boolean(StrToInt(CellValue));
     447end;
     448
     449constructor TDataTypeBoolean.Create;
     450begin
     451  inherited Create;
     452  Name := 'Boolean';
    393453end;
    394454
     
    422482end;
    423483
     484constructor TDataTypeNumber.Create;
     485begin
     486  inherited Create;
     487  Name := 'Number';
     488end;
     489
    424490{ TDataTypeString }
    425491
     
    444510end;
    445511
     512constructor TDataTypeString.Create;
     513begin
     514  inherited Create;
     515  Name := 'String';
     516end;
     517
    446518{ TDataType }
    447519
     
    481553end;
    482554
     555constructor TDataType.Create;
     556begin
     557  inherited;
     558end;
     559
    483560end.
    484561
  • trunk/Forms/UItemAdd.pas

    r37 r40  
    124124    Panel1.Controls[I].Free;
    125125
    126   Report.Load(SelectedObject, SelectedObject.PrimaryKey + ' = ' +
    127     IntToStr(SelectedItemId));
     126  //Report.Load(SelectedObject, SelectedObject.PrimaryKey + ' = ' +
     127  //  IntToStr(SelectedItemId));
    128128
    129129  // Load column names
  • trunk/Forms/UItemList.pas

    r39 r40  
    117117  NewItemEditForm: TItemEditForm;
    118118begin
    119   if Assigned(ListView1.Selected) then begin
     119  if Assigned(ListView1.Selected) then
     120  try
    120121    NewItemEditForm := TItemEditForm.Create(nil);
    121122    NewItemEditForm.SelectedObject.Assign(SelectedObject);
    122123    NewItemEditForm.SelectedItemId := Integer(ListView1.Selected.Data);
    123124    NewItemEditForm.Caption := NewItemEditForm.Caption + ' ' + SelectedObject.Name;
    124     MainForm.SetMainPanelForm(NewItemEditForm);
     125    NewItemEditForm.ShowModal;
     126  finally
     127    NewItemEditForm.Free;
    125128  end;
    126129end;
     
    130133  NewItemAddForm: TItemAddForm;
    131134begin
    132   NewItemAddForm := TItemAddForm.Create(nil);
    133   NewItemAddForm.SelectedObject.Assign(SelectedObject);
    134   NewItemAddForm.SelectedItemId := Integer(ListView1.Selected.Data);
    135   NewItemAddForm.Caption := NewItemAddForm.Caption + ' ' + SelectedObject.Name;
    136   MainForm.SetMainPanelForm(NewItemAddForm);
     135  try
     136    NewItemAddForm := TItemAddForm.Create(nil);
     137    NewItemAddForm.SelectedObject.Assign(SelectedObject);
     138    //NewItemAddForm.SelectedItemId := Integer(ListView1.Selected.Data);
     139    NewItemAddForm.Caption := NewItemAddForm.Caption + ' ' + SelectedObject.Name;
     140    NewItemAddForm.ShowModal;
     141  finally
     142    NewItemAddForm.Free;
     143  end;
    137144end;
    138145
  • trunk/Forms/UItemView.pas

    r36 r40  
    5656{$R *.lfm}
    5757
     58resourcestring
     59  SExpectedOneRow = 'Expected one row';
     60
    5861{ TItemViewForm }
    5962
     
    106109  NewItemEditForm: TItemEditForm;
    107110begin
    108   Close;
    109   NewItemEditForm := TItemEditForm.Create(nil);
    110   NewItemEditForm.SelectedObject.Assign(SelectedObject);
    111   NewItemEditForm.SelectedItemId := SelectedItemId;
    112   NewItemEditForm.Caption := NewItemEditForm.Caption + ' ' + SelectedObject.Name;
    113   MainForm.SetMainPanelForm(NewItemEditForm);
     111  try
     112    NewItemEditForm := TItemEditForm.Create(nil);
     113    NewItemEditForm.SelectedObject.Assign(SelectedObject);
     114    NewItemEditForm.SelectedItemId := SelectedItemId;
     115    NewItemEditForm.Caption := NewItemEditForm.Caption + ' ' + SelectedObject.Name;
     116    NewItemEditForm.ShowModal;
     117  finally
     118    NewItemEditForm.Free;
     119  end;
    114120end;
    115121
     
    156162  // Load column names
    157163
    158   if Report.Count = 1 then
     164  if Report.Count > 1 then raise Exception.Create(SExpectedOneRow);
     165  if Report.Count > 0 then
    159166  for I := 0 to Report.Columns.Count - 1 do begin
    160167    DataType := TReportColumn(Report.Columns[I]).CustomType;
  • trunk/Forms/ULoginForm.lfm

    r30 r40  
    11object LoginForm: TLoginForm
    22  Left = 312
    3   Height = 163
     3  Height = 177
    44  Top = 186
    5   Width = 433
     5  Width = 451
    66  BorderIcons = [biSystemMenu]
    77  BorderStyle = bsDialog
    88  Caption = 'Login'
    9   ClientHeight = 163
    10   ClientWidth = 433
     9  ClientHeight = 177
     10  ClientWidth = 451
    1111  OnClose = FormClose
    1212  OnShow = FormShow
     
    3131    Left = 112
    3232    Height = 25
    33     Top = 128
     33    Top = 144
    3434    Width = 75
    3535    Caption = 'Close'
    3636    ModalResult = 11
    3737    OnClick = ButtonCancelClick
    38     TabOrder = 5
     38    TabOrder = 6
    3939  end
    4040  object ButtonLogin: TButton
    4141    Left = 16
    4242    Height = 25
    43     Top = 128
     43    Top = 144
    4444    Width = 75
    4545    Caption = 'Login'
     
    4747    ModalResult = 1
    4848    OnClick = ButtonLoginClick
    49     TabOrder = 4
     49    TabOrder = 5
    5050  end
    5151  object EditUserName: TEdit
     
    8484  object Image1: TImage
    8585    Left = 272
    86     Height = 140
     86    Height = 156
    8787    Top = 12
    88     Width = 152
     88    Width = 168
    8989  end
    9090  object EditPassword: TEdit
     
    9797    TabOrder = 3
    9898  end
     99  object CheckBoxRememberPassword: TCheckBox
     100    Left = 16
     101    Height = 17
     102    Top = 121
     103    Width = 120
     104    Caption = 'Remember password'
     105    TabOrder = 4
     106  end
    99107end
  • trunk/Forms/ULoginForm.lrt

    r27 r40  
    66TLOGINFORM.LABEL3.CAPTION=Connection:
    77TLOGINFORM.BUTTONCHANGE.CAPTION=Change
     8TLOGINFORM.CHECKBOXREMEMBERPASSWORD.CAPTION=Remember password
  • trunk/Forms/ULoginForm.pas

    r30 r40  
    1717    ButtonCancel: TButton;
    1818    ButtonLogin: TButton;
     19    CheckBoxRememberPassword: TCheckBox;
    1920    ComboBoxConnection: TComboBox;
    2021    EditUserName: TEdit;
     
    5051  Core.LastProfile := ComboBoxConnection.ItemIndex;
    5152  Core.LastPassword := EditPassword.Text;
     53  Core.RememberPassword := CheckBoxRememberPassword.Checked;
    5254end;
    5355
    5456procedure TLoginForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
    5557begin
    56   MainForm.PersistentForm.Save(Self);
     58  //MainForm.PersistentForm.Save(Self);
    5759end;
    5860
    5961procedure TLoginForm.FormShow(Sender: TObject);
    6062begin
    61   MainForm.PersistentForm.Load(Self);
     63  //MainForm.PersistentForm.Load(Self);
    6264  EditUserName.Text := Core.LastUserName;
    63   EditPassword.Text := '';
     65  EditPassword.Text := Core.LastPassword;
    6466  EditPassword.SetFocus;
     67  CheckBoxRememberPassword.Checked := Core.RememberPassword;
    6568  Core.Profiles.FillStrings(ComboBoxConnection.Items);
    6669  ComboBoxConnection.ItemIndex := Core.LastProfile;
  • trunk/Forms/UMainForm.lfm

    r39 r40  
    11object MainForm: TMainForm
    2   Left = 307
     2  Left = 242
    33  Height = 446
    4   Top = 126
     4  Top = 129
    55  Width = 640
    66  ActiveControl = PanelMenu
  • trunk/Forms/UMainForm.pas

    r39 r40  
    288288    Core.System.Types.Clear;
    289289    FreeAndNil(Core.Client);
     290    UpdateInterface;
    290291  end;
    291292end;
  • trunk/Languages/chronis.cs.po

    r36 r40  
    176176msgstr "Přihásit"
    177177
     178#: tloginform.checkboxrememberpassword.caption
     179msgid "Remember password"
     180msgstr ""
     181
    178182#: tloginform.label1.caption
    179183msgid "Username:"
     
    398402msgstr "Verze"
    399403
     404#: uitemview.sexpectedonerow
     405msgid "Expected one row"
     406msgstr ""
     407
    400408#: uloginprofileform.sprofile
    401409msgid "Profile"
  • trunk/Languages/chronis.po

    r36 r40  
    162162msgstr ""
    163163
     164#: tloginform.checkboxrememberpassword.caption
     165msgid "Remember password"
     166msgstr ""
     167
    164168#: tloginform.label1.caption
    165169msgid "Username:"
     
    376380msgstr ""
    377381
     382#: uitemview.sexpectedonerow
     383msgid "Expected one row"
     384msgstr ""
     385
    378386#: uloginprofileform.sprofile
    379387msgid "Profile"
  • trunk/UCore.pas

    r38 r40  
    2727    LastProfile: Integer;
    2828    LastPassword: string;
     29    RememberPassword: Boolean;
    2930    Profiles: TProfileList;
    3031    RegistryKey: string;
     
    8485    LastProfile := ReadIntegerWithDefault('LastConnectProfile', -1);
    8586    LastUserName := ReadStringWithDefault('LastUserName', 'admin');
     87    LastPassword := ReadStringWithDefault('LastPassword', '');
     88    RememberPassword := ReadBoolWithDefault('RememberPassword', False);
    8689  finally
    8790    Free;
     
    97100    WriteInteger('LastConnectProfile', LastProfile);
    98101    WriteString('LastUserName', LastUserName);
     102    if RememberPassword then WriteString('LastPassword', LastPassword)
     103      else WriteString('LastPassword', '');
     104    WriteBool('RememberPassword', RememberPassword);
    99105  finally
    100106    Free;
  • trunk/USystem.pas

    r38 r40  
    233233      Values.ObjectName := Obj.Table;
    234234      Values.SchemaName := Obj.Schema;
     235      Values.Condition := Filter;
    235236      Values.Load;
    236237
Note: See TracChangeset for help on using the changeset viewer.