Changeset 14
- Timestamp:
- Mar 19, 2013, 8:38:28 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FioInfo.lpr
r12 r14 13 13 {$R *.res} 14 14 15 {$IFDEF DEBUG} 16 const 17 HeapTraceLog = 'heaptrclog.trc'; 18 {$ENDIF} 19 15 20 begin 21 {$IFDEF DEBUG} 22 // Heap trace 23 DeleteFile(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 24 SetHeapTraceOutput(ExtractFilePath(ParamStr(0)) + HeapTraceLog); 25 {$ENDIF} 26 16 27 RequireDerivedFormResource := True; 17 28 Application.Initialize; -
trunk/Forms/UFormAccounts.pas
r12 r14 31 31 Selected: Boolean); 32 32 private 33 { private declarations }33 DisableEditUpdate: Boolean; 34 34 public 35 35 Accounts: TListObject; … … 66 66 Selected: Boolean); 67 67 begin 68 if Assigned(ListView1.Selected) then begin 69 DisableEditUpdate := True; 70 LabeledEditToken.Text := TAccount(ListView1.Selected.Data).Token; 71 LabeledEditName.Text := TAccount(ListView1.Selected.Data).Name; 72 DisableEditUpdate := False; 73 end; 68 74 UpdateInterface; 69 75 end; … … 77 83 procedure TFormAccounts.LabeledEditTokenChange(Sender: TObject); 78 84 begin 79 if Assigned(ListView1.Selected) then begin 80 TAccount(ListView1.Selected.Data).Token := LabeledEditToken.Text; 81 TAccount(ListView1.Selected.Data).Name := LabeledEditName.Text; 85 if not DisableEditUpdate then begin 86 if Assigned(ListView1.Selected) then begin 87 TAccount(ListView1.Selected.Data).Token := LabeledEditToken.Text; 88 TAccount(ListView1.Selected.Data).Name := LabeledEditName.Text; 89 end; 90 Reload; 82 91 end; 83 Reload;84 92 end; 85 93 … … 111 119 ListView1.Items.Count := Accounts.Count; 112 120 ListView1.Refresh; 121 UpdateInterface; 113 122 end; 114 123 … … 116 125 begin 117 126 ButtonRemove.Enabled := Assigned(ListView1.Selected); 118 if Assigned(ListView1.Selected) then begin 119 LabeledEditToken.Text := TAccount(ListView1.Selected.Data).Token; 120 LabeledEditName.Text := TAccount(ListView1.Selected.Data).Name; 121 end; 127 LabeledEditToken.Enabled := Assigned(ListView1.Selected); 128 LabeledEditName.Enabled := Assigned(ListView1.Selected); 122 129 end; 123 130 -
trunk/Forms/UFormMain.lfm
r12 r14 66 66 Width = 80 67 67 CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames] 68 OnAcceptDate = DateEditStartAcceptDate 68 69 OKCaption = 'OK' 69 70 CancelCaption = 'Cancel' … … 81 82 Width = 80 82 83 CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames] 84 OnAcceptDate = DateEditToAcceptDate 83 85 OKCaption = 'OK' 84 86 CancelCaption = 'Cancel' -
trunk/Forms/UFormMain.pas
r13 r14 43 43 procedure ButtonNewClick(Sender: TObject); 44 44 procedure ComboBoxAccountsChange(Sender: TObject); 45 procedure DateEditStartAcceptDate(Sender: TObject; var ADate: TDateTime; 46 var AcceptDate: Boolean); 47 procedure DateEditToAcceptDate(Sender: TObject; var ADate: TDateTime; 48 var AcceptDate: Boolean); 45 49 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 46 50 procedure FormCreate(Sender: TObject); … … 82 86 else Core.CurrentAccount := nil; 83 87 LoadInterface; 88 Core.SelectedAccountIndex := ComboBoxAccounts.ItemIndex; 89 end; 90 91 procedure TFormMain.DateEditStartAcceptDate(Sender: TObject; 92 var ADate: TDateTime; var AcceptDate: Boolean); 93 begin 94 AcceptDate := (ADate <= Now) and (ADate <= DateEditTo.Date); 95 end; 96 97 procedure TFormMain.DateEditToAcceptDate(Sender: TObject; var ADate: TDateTime; 98 var AcceptDate: Boolean); 99 begin 100 AcceptDate := (ADate <= Now) and (ADate >= DateEditStart.Date); 84 101 end; 85 102 … … 115 132 begin 116 133 Core.Accounts.LoadToStrings(ComboBoxAccounts.Items); 134 if (Core.SelectedAccountIndex >= 0) and 135 (Core.SelectedAccountIndex < ComboBoxAccounts.Items.Count) then 136 ComboBoxAccounts.ItemIndex := Core.SelectedAccountIndex; 117 137 DateEditStart.Date := Core.ReportTimeFrom; 118 138 DateEditTo.Date := Core.ReportTimeTo; 119 139 SpinEditYear.Value := Core.ReportYear; 140 SpinEditYear.MaxValue := YearOf(Now); 120 141 SpinEditId.Value := Core.ReportId; 121 142 ButtonInterval.Enabled := Assigned(Core.CurrentAccount); 122 143 ButtonMonthly.Enabled := Assigned(Core.CurrentAccount); 123 144 ButtonNew.Enabled := Assigned(Core.CurrentAccount); 145 Core.ADownloadInterval.Enabled := Assigned(Core.CurrentAccount); 146 Core.ADownloadMonthly.Enabled := Assigned(Core.CurrentAccount); 147 Core.ADownloadNew.Enabled := Assigned(Core.CurrentAccount); 124 148 if ComboBoxAccounts.ItemIndex <> -1 then begin 125 149 LabelBalance.Caption := FloatToStr(TAccount(ComboBoxAccounts.Items.Objects[ -
trunk/Forms/UFormSettings.lfm
r12 r14 1 1 object FormSettings: TFormSettings 2 2 Left = 420 3 Height = 2 733 Height = 281 4 4 Top = 127 5 Width = 55 05 Width = 558 6 6 Caption = 'Settings' 7 ClientHeight = 2 738 ClientWidth = 55 07 ClientHeight = 281 8 ClientWidth = 558 9 9 OnCreate = FormCreate 10 10 Position = poScreenCenter 11 11 LCLVersion = '1.1' 12 12 object ButtonCancel: TButton 13 Left = 3 7613 Left = 384 14 14 Height = 25 15 Top = 2 4215 Top = 250 16 16 Width = 75 17 17 Anchors = [akRight, akBottom] … … 21 21 end 22 22 object ButtonOk: TButton 23 Left = 4 6423 Left = 472 24 24 Height = 25 25 Top = 24 225 Top = 249 26 26 Width = 75 27 27 Anchors = [akRight] … … 52 52 Height = 27 53 53 Top = 88 54 Width = 44 054 Width = 448 55 55 Anchors = [akTop, akLeft, akRight] 56 56 EditLabel.AnchorSideLeft.Control = LabeledEditFolder … … 61 61 EditLabel.Height = 17 62 62 EditLabel.Top = 68 63 EditLabel.Width = 44 063 EditLabel.Width = 448 64 64 EditLabel.Caption = 'Destination folder:' 65 65 EditLabel.ParentColor = False … … 67 67 end 68 68 object Button1: TButton 69 Left = 4 6469 Left = 472 70 70 Height = 25 71 71 Top = 88 … … 76 76 TabOrder = 4 77 77 end 78 object LabeledEditFileNameFormat: TLabeledEdit 79 Left = 11 80 Height = 27 81 Top = 144 82 Width = 448 83 Anchors = [akTop, akLeft, akRight] 84 EditLabel.AnchorSideLeft.Control = LabeledEditFileNameFormat 85 EditLabel.AnchorSideRight.Control = LabeledEditFileNameFormat 86 EditLabel.AnchorSideRight.Side = asrBottom 87 EditLabel.AnchorSideBottom.Control = LabeledEditFileNameFormat 88 EditLabel.Left = 11 89 EditLabel.Height = 17 90 EditLabel.Top = 124 91 EditLabel.Width = 448 92 EditLabel.Caption = 'Output file name format:' 93 EditLabel.ParentColor = False 94 TabOrder = 5 95 end 96 object Label2: TLabel 97 Left = 11 98 Height = 38 99 Top = 176 100 Width = 532 101 Anchors = [akTop, akLeft, akRight] 102 Caption = '%f - data format, %d - date, %t - time, %a - account number, %n - account name, %% - percent symbol' 103 ParentColor = False 104 WordWrap = True 105 end 78 106 end -
trunk/Forms/UFormSettings.lrt
r12 r14 5 5 TFORMSETTINGS.LABELEDEDITFOLDER.EDITLABEL.CAPTION=Destination folder: 6 6 TFORMSETTINGS.BUTTON1.CAPTION=Select 7 TFORMSETTINGS.LABELEDEDITFILENAMEFORMAT.EDITLABEL.CAPTION=Output file name format: 8 TFORMSETTINGS.LABEL2.CAPTION=%f - data format, %d - date, %t - time, %a - account number, %n - account name, %% - percent symbol -
trunk/Forms/UFormSettings.pas
r12 r14 19 19 ComboBox1: TComboBox; 20 20 Label1: TLabel; 21 Label2: TLabel; 21 22 LabeledEditFolder: TLabeledEdit; 23 LabeledEditFileNameFormat: TLabeledEdit; 22 24 procedure Button1Click(Sender: TObject); 23 25 procedure FormCreate(Sender: TObject); … … 66 68 procedure TFormSettings.Load; 67 69 begin 70 LabeledEditFileNameFormat.Text := Core.OutputFormat; 68 71 ComboBox1.ItemIndex := Integer(Core.DataFormat); 69 72 LabeledEditFolder.Text := Core.TargetDirectory; … … 72 75 procedure TFormSettings.Save; 73 76 begin 77 Core.OutputFormat := LabeledEditFileNameFormat.Text; 74 78 Core.DataFormat := TFioDataFormat(ComboBox1.ItemIndex); 75 79 Core.TargetDirectory := LabeledEditFolder.Text; -
trunk/Languages/FioInfo.cs.po
r12 r14 231 231 msgstr "Formát dat:" 232 232 233 #: tformsettings.label2.caption 234 msgid "%f - data format, %d - date, %t - time, %a - account number, %n - account name, %% - percent symbol" 235 msgstr "%f - formát dat, %d - datum, %t - Äas, %a - ÄÃslo úÄtu, %n - jméno úÄtu, %% - znak procent" 236 237 #: tformsettings.labelededitfilenameformat.editlabel.caption 238 msgid "Output file name format:" 239 msgstr "Formát jména vÃœstupnÃho souboru:" 240 233 241 #: tformsettings.labelededitfolder.editlabel.caption 234 242 msgid "Destination folder:" … … 240 248 msgstr "StaÅŸenà selhalo" 241 249 250 #: ucore.sdumpformat 251 msgid "Dump %d %t.%f" 252 msgstr "VÃœpis %d %t.%f" 253 242 254 #: ucore.sreport 243 255 msgid "Dump %s" -
trunk/Languages/FioInfo.po
r12 r14 221 221 msgstr "" 222 222 223 #: tformsettings.label2.caption 224 msgid "%f - data format, %d - date, %t - time, %a - account number, %n - account name, %% - percent symbol" 225 msgstr "" 226 227 #: tformsettings.labelededitfilenameformat.editlabel.caption 228 msgid "Output file name format:" 229 msgstr "" 230 223 231 #: tformsettings.labelededitfolder.editlabel.caption 224 232 msgid "Destination folder:" … … 230 238 msgstr "" 231 239 240 #: ucore.sdumpformat 241 msgid "Dump %d %t.%f" 242 msgstr "" 243 232 244 #: ucore.sreport 233 245 msgid "Dump %s" -
trunk/UCore.lfm
r12 r14 380 380 Default = True 381 381 end 382 object MenuItem9: TMenuItem 383 Action = AAccounts 384 end 382 385 object MenuItem7: TMenuItem 383 386 Action = ASettings … … 402 405 EmailContact = 'robie@centrum.cz' 403 406 AppName = 'FioInfo' 404 ReleaseDate = 413 48407 ReleaseDate = 41352 405 408 RegistryKey = '\Software\Chronosoft\FioInfo' 406 409 RegistryRoot = rrKeyCurrentUser -
trunk/UCore.pas
r13 r14 57 57 MenuItem7: TMenuItem; 58 58 MenuItem8: TMenuItem; 59 MenuItem9: TMenuItem; 59 60 PopupMenuTray: TPopupMenu; 60 61 TrayIcon1: TTrayIcon; … … 70 71 procedure DataModuleDestroy(Sender: TObject); 71 72 private 72 { private declarations }73 function GetFileName: string; 73 74 public 74 75 RegistryContext: TRegistryContext; … … 81 82 ReportTimeFrom: TDateTime; 82 83 ReportTimeTo: TDateTime; 84 OutputFormat: string; 85 SelectedAccountIndex: Integer; 83 86 procedure LoadAccount(Account: TAccount); 84 87 procedure LoadAccounts; … … 101 104 SReport = 'Dump %s'; 102 105 SSavedToFile = 'Dump saved to file %s'; 106 SDumpFormat = 'Dump %d %t.%f'; 103 107 104 108 { TAccount } … … 121 125 Name := UTF8Encode(ReadStringWithDefault('Name', UTF8Decode('UÄet'))); 122 126 Time := ReadDateTimeWithDefault('Time', 0); 123 Token := UTF8Encode(ReadStringWithDefault('Token', ''));127 Token := UTF8Encode(ReadStringWithDefault('Token', '')); 124 128 Balance := ReadFloatWithDefault('Balance', 0); 125 129 Number := UTF8Encode(ReadStringWithDefault('Number', '')); … … 227 231 SaveToRegistry(RegistryContext); 228 232 FreeAndNil(Accounts); 233 end; 234 235 function TCore.GetFileName: string; 236 begin 237 Result := OutputFormat; 238 Result := StringReplace(Result, '%f', DataFormatURL[DataFormat], [rfReplaceAll]); 239 Result := StringReplace(Result, '%d', DateToStr(Now), [rfReplaceAll]); 240 Result := StringReplace(Result, '%t', TimeToStr(Now), [rfReplaceAll]); 241 Result := StringReplace(Result, '%a', CurrentAccount.Number, [rfReplaceAll]); 242 Result := StringReplace(Result, '%n', CurrentAccount.Name, [rfReplaceAll]); 243 Result := StringReplace(Result, '%%', '%', [rfReplaceAll]); 229 244 end; 230 245 … … 302 317 WriteInteger('ReportId', ReportId); 303 318 WriteString('Language', CoolTranslator1.Language.Code); 319 WriteString('FileNameFormat', OutputFormat); 320 WriteInteger('SelectedAccountIndex', SelectedAccountIndex); 304 321 finally 305 322 Free; … … 321 338 ReportId := ReadIntegerWithDefault('ReportId', MonthOf(Now)); 322 339 CoolTranslator1.Language := CoolTranslator1.Languages.SearchByCode(ReadStringWithDefault('Language', 'cs')); 340 OutputFormat := UTF8Encode(ReadStringWithDefault('FileNameFormat', UTF8Decode(SDumpFormat))); 341 SelectedAccountIndex := ReadIntegerWithDefault('SelectedAccountIndex', 0); 323 342 finally 324 343 Free; … … 353 372 FioAPI.Token := CurrentAccount.Token; 354 373 if FioAPI.DownloadLast(List) then begin 355 FileName := TargetDirectory + DirectorySeparator + Format(SReport, [FormatDateTime('yyyy-mm-dd hh-nn-ss', Now) + 356 ExtensionSeparator + DataFormatURL[FioAPI.Format]]); 374 FileName := TargetDirectory + DirectorySeparator + GetFileName; 357 375 List.SaveToFile(UTF8Decode(FileName)); 358 376 ShowMessage(Format(SSavedToFile, [FileName])); … … 376 394 FioAPI.Token := CurrentAccount.Token; 377 395 if FioAPI.DownloadMonthly(ReportYear, ReportId, List) then begin 378 FileName := TargetDirectory + DirectorySeparator + Format(SReport, [IntToStr(ReportYear) + 379 '-' + IntToStr(ReportId) + 380 ExtensionSeparator + DataFormatURL[FioAPI.Format]]); 396 FileName := TargetDirectory + DirectorySeparator + GetFileName; 381 397 List.SaveToFile(UTF8Decode(FileName)); 382 398 ShowMessage(Format(SSavedToFile, [FileName])); … … 400 416 FioAPI.Token := CurrentAccount.Token; 401 417 if FioAPI.DownloadInterval(ReportTimeFrom, ReportTimeTo, List) then begin 402 FileName := TargetDirectory + DirectorySeparator + Format(SReport, [FormatDateTime('yyyy-mm-dd', ReportTimeFrom) + 403 ' ' + FormatDateTime('yyyy-mm-dd', ReportTimeTo) + 404 ExtensionSeparator + DataFormatURL[FioAPI.Format]]); 418 FileName := TargetDirectory + DirectorySeparator + GetFileName; 405 419 List.SaveToFile(UTF8Decode(FileName)); 406 420 ShowMessage(Format(SSavedToFile, [FileName]));
Note:
See TracChangeset
for help on using the changeset viewer.