Changeset 13 for trunk


Ignore:
Timestamp:
Mar 16, 2013, 12:05:33 AM (12 years ago)
Author:
chronos
Message:
  • Přidáno: Načtení stavu účtů při startu aplikace.
  • Opraveno: Při ukládání do registrů nepoužívat UTF-8.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r12 r13  
    8181    Core.CurrentAccount := TAccount(Core.Accounts[ComboBoxAccounts.ItemIndex])
    8282    else Core.CurrentAccount := nil;
     83  LoadInterface;
    8384end;
    8485
     
    121122  ButtonMonthly.Enabled := Assigned(Core.CurrentAccount);
    122123  ButtonNew.Enabled := Assigned(Core.CurrentAccount);
     124  if ComboBoxAccounts.ItemIndex <> -1 then begin
     125    LabelBalance.Caption := FloatToStr(TAccount(ComboBoxAccounts.Items.Objects[
     126      ComboBoxAccounts.ItemIndex]).Balance) + ' Kč';
     127  end else begin
     128    LabelBalance.Caption := '? Kč';
     129  end;
    123130end;
    124131
  • trunk/UCore.pas

    r12 r13  
    119119    RootKey := Context.RootKey;
    120120    OpenKey(Context.Key, True);
    121     Name := ReadStringWithDefault('Name', '');
     121    Name := UTF8Encode(ReadStringWithDefault('Name', UTF8Decode('Učet')));
    122122    Time := ReadDateTimeWithDefault('Time', 0);
    123     Token := ReadStringWithDefault('Token', '');
     123    Token :=UTF8Encode( ReadStringWithDefault('Token', ''));
    124124    Balance := ReadFloatWithDefault('Balance', 0);
    125     Number := ReadStringWithDefault('Number', '');
     125    Number := UTF8Encode(ReadStringWithDefault('Number', ''));
    126126  finally
    127127    Free;
     
    135135    RootKey := Context.RootKey;
    136136    OpenKey(Context.Key, True);
    137     WriteString('Number', Number);
    138     WriteString('Name', Name);
     137    WriteString('Number', UTF8Decode(Number));
     138    WriteString('Name', UTF8Decode(Name));
    139139    WriteDateTime('Time', Time);
    140     WriteString('Token', Token);
     140    WriteString('Token', UTF8Decode(Token));
    141141    WriteFloat('Balance', Balance);
    142142  finally
     
    189189  while Strings.Count > Count do
    190190    Strings.Delete(Strings.Count - 1);
    191   for I := 0 to Count - 1 do
    192     Strings.Strings[I] := TAccount(Items[I]).Name;
     191  for I := 0 to Count - 1 do begin
     192    Strings.Strings[I] := TAccount(Items[I]).Name + ' (' + TAccount(Items[I]).Number + ')';
     193    Strings.Objects[I] := Items[I];
     194  end;
    193195end;
    194196
     
    218220    ApplicationInfo1.RegistryKey);
    219221  LoadFromRegistry(RegistryContext);
    220   //LoadAccounts;
     222  LoadAccounts;
    221223end;
    222224
     
    235237  Mem: TMemoryStream;
    236238  RootNode: TDOMNode;
     239  Node: TDOMNode;
     240  Node2: TDOMNode;
    237241begin
    238242  FioAPI := TFioAPI.Create;
     
    246250    if FioAPI.DownloadInterval(Now, Now, List) then begin
    247251      List.SaveToStream(Mem);
     252      Mem.Position := 0;
    248253      ReadXMLFile(XMLDocument, Mem);
    249254      RootNode := XMLDocument.DocumentElement;
    250       ShowMessage(RootNode.NodeName);
     255      Node := RootNode.FindNode('Info');
     256      Node2 := Node.FindNode('accountId');
     257      if Assigned(Node2) then
     258        Account.Number := UTF8Encode(Node2.TextContent);
     259      Node2 := Node.FindNode('bankId');
     260      if Assigned(Node2) then
     261        Account.Number := Account.Number + '/' + UTF8Encode(Node2.TextContent);
     262      Node2 := Node.FindNode('closingBalance');
     263      if Assigned(Node2) then
     264        Account.Balance := StrToFloat(Node2.TextContent);
    251265    end else begin
    252266      Account.Number := '';
     
    281295    RootKey := Context.RootKey;
    282296    OpenKey(Context.Key, True);
    283     WriteString('TargetDir', TargetDirectory);
     297    WriteString('TargetDir', UTF8Decode(TargetDirectory));
    284298    WriteInteger('DataFormat', Integer(DataFormat));
    285299    WriteDate('ReportTimeFrom', ReportTimeFrom);
     
    300314    RootKey := Context.RootKey;
    301315    OpenKey(Context.Key, True);
    302     TargetDirectory := ReadStringWithDefault('TargetDir', ExtractFileDir(Application.ExeName));
     316    TargetDirectory := UTF8Encode(ReadStringWithDefault('TargetDir', UTF8Decode(ExtractFileDir(Application.ExeName))));
    303317    DataFormat := TFioDataFormat(ReadIntegerWithDefault('DataFormat', Integer(dfXML)));
    304318    ReportTimeFrom := ReadDateTimeWithDefault('ReportTimeFrom', Now);
Note: See TracChangeset for help on using the changeset viewer.