Browse Source

UCoreUtils: added TAccount.Display extension property

Herman Schoenfeld 7 years ago
parent
commit
e9f2febc1b

+ 10 - 0
src/core.utils/UCoreUtils.pas

@@ -84,7 +84,10 @@ end;
 
 TAccountHelper = record helper for TAccount
   function GetAccountString : AnsiString;
+  function GetDisplayString : AnsiString;
   function GetInfoText(const ABank : TPCBank) : utf8string;
+  property AccountString : AnsiString read GetAccountString;
+  property DisplayString : AnsiString read GetDisplayString;
 end;
 
 { TOperationResumeHelper }
@@ -328,6 +331,13 @@ begin
   Result := TAccountComp.AccountNumberToAccountTxtNumber(Self.account);
 end;
 
+function TAccountHelper.GetDisplayString : AnsiString;
+begin
+  Result := GetAccountString;
+  if Self.name <> '' then
+    Result := Result + ': ' + Self.name;
+end;
+
 function TAccountHelper.GetInfoText(const ABank : TPCBank) : utf8string;
 var
   builder : TStrings;

+ 3 - 1
src/core.utils/UDataSources.pas

@@ -111,9 +111,11 @@ begin
   if ABindingName = 'AccountNumber' then
     Result := AItem.account
   else if ABindingName = 'Account' then
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AItem.account)
+    Result := AItem.AccountString
   else if ABindingName = 'Name' then
     Result := AItem.name
+  else if ABindingName = 'Display' then
+    Result := AItem.DisplayString
   else if ABindingName = 'Balance' then
     Result := AItem.Balance
   else if ABindingName = 'BalanceDecimal' then

+ 2 - 2
src/gui/wizards/operations/UWIZSendPASC_Confirmation.pas

@@ -44,7 +44,7 @@ implementation
 
 {$R *.lfm}
 
-uses UAccounts, UWallet, UUserInterface, UDataSources, UCommon, UCommon.UI, Generics.Collections;
+uses UAccounts, UWallet, UUserInterface, UDataSources, UCommon, UCommon.UI, Generics.Collections, UCoreUtils;
 
 type
 
@@ -137,7 +137,7 @@ var
   index: integer;
 begin
   if ABindingName = 'SenderAccount' then
-    Result := TAccountComp.AccountNumberToAccountTxtNumber(AItem.account)
+    Result := AItem.DisplayString
   else if ABindingName = 'Balance' then
     Result := TAccountComp.FormatMoney(AItem.Balance)
   else if ABindingName = 'AmountToSend' then

+ 5 - 2
src/pascalcoin_wallet.lpi

@@ -28,10 +28,13 @@
         <FormatVersion Value="1"/>
       </local>
     </RunParams>
-    <RequiredPackages Count="1">
+    <RequiredPackages Count="2">
       <Item1>
-        <PackageName Value="LCL"/>
+        <PackageName Value="multithreadprocslaz"/>
       </Item1>
+      <Item2>
+        <PackageName Value="LCL"/>
+      </Item2>
     </RequiredPackages>
     <Units Count="99">
       <Unit0>