瀏覽代碼

some more refactoring of wizards.

Ugochukwu Mmaduekwe 7 年之前
父節點
當前提交
e9e832496e

+ 1 - 1
src/gui/wizards/UWIZModels.pas

@@ -128,7 +128,7 @@ type
     public
       HasPayload: boolean;
       Content, Password: string;
-      Mode: TPayloadEncryptionMode;
+      PayloadEncryptionMode: TPayloadEncryptionMode;
       EncodedBytes: TRawBytes;
     end;
 

+ 1 - 1
src/gui/wizards/operations/UWIZChangeKey.pas

@@ -77,7 +77,7 @@ begin
 
   end;
 
-  Result := TOperationsManager.ExecuteChangeKey(Model.Account.SelectedAccounts, Model.Signer.SignerAccount, LPublicKey, Model.Fee.SingleOperationFee, Model.Payload.Mode, IIF(Model.Payload.HasPayload, Model.Payload.Content, ''), Model.Payload.Password, message);
+  Result := TOperationsManager.ExecuteChangeKey(Model.Account.SelectedAccounts, Model.Signer.SignerAccount, LPublicKey, Model.Fee.SingleOperationFee, Model.Payload.PayloadEncryptionMode, IIF(Model.Payload.HasPayload, Model.Payload.Content, ''), Model.Payload.Password, message);
 end;
 
 function TWIZChangeKeyWizard.CancelRequested(out message: ansistring): boolean;

+ 1 - 1
src/gui/wizards/operations/UWIZEnlistAccountForSale.pas

@@ -71,7 +71,7 @@ begin
       valid := True;
       Exit;
     end;
-    case Model.Payload.Mode of
+    case Model.Payload.PayloadEncryptionMode of
 
       akaEncryptWithSender:
       begin

+ 17 - 2
src/gui/wizards/operations/UWIZOperationConfirmation.lfm

@@ -6,7 +6,6 @@ object WIZOperationConfirmation: TWIZOperationConfirmation
   Caption = 'WIZOperationConfirmation'
   ClientHeight = 320
   ClientWidth = 511
-  LCLVersion = '1.8.2.0'
   Visible = False
   object GroupBox1: TGroupBox
     Left = 10
@@ -28,7 +27,7 @@ object WIZOperationConfirmation: TWIZOperationConfirmation
       Caption = 'GRID PANEL'
       TabOrder = 0
     end
-    object Label1: TLabel
+    object lblSignerAccount: TLabel
       Left = 8
       Height = 15
       Top = 2
@@ -65,5 +64,21 @@ object WIZOperationConfirmation: TWIZOperationConfirmation
       ParentColor = False
       ParentFont = False
     end
+    object lblBeneficiaryAccount: TLabel
+      Left = 280
+      Height = 15
+      Top = 2
+      Width = 109
+      Caption = 'Beneficiary Account:'
+      ParentColor = False
+    end
+    object lblBenAcc: TLabel
+      Left = 408
+      Height = 15
+      Top = 2
+      Width = 53
+      Caption = 'lblBenAcc'
+      ParentColor = False
+    end
   end
 end

+ 20 - 2
src/gui/wizards/operations/UWIZOperationConfirmation.pas

@@ -25,9 +25,11 @@ type
 
   TWIZOperationConfirmation = class(TWizardForm<TWIZOperationsModel>)
     GroupBox1: TGroupBox;
-    Label1: TLabel;
+    lblSignerAccount: TLabel;
+    lblBeneficiaryAccount: TLabel;
     lblPayload: TLabel;
     lblSgnAcc: TLabel;
+    lblBenAcc: TLabel;
     mmoPayload: TMemo;
     paGrid: TPanel;
   private
@@ -123,6 +125,17 @@ begin
   FConfirmationGrid.DataSource := Data;
   paGrid.AddControlDockCenter(FConfirmationGrid);
   lblSgnAcc.Caption := TAccountComp.AccountNumberToAccountTxtNumber(Model.Signer.SignerAccount.account);
+  if not (Model.ModelType = omtEnlistAccountForSale) then
+  begin
+    lblBeneficiaryAccount.Visible := False;
+    lblBenAcc.Visible := False;
+  end
+  else
+  begin
+    lblBeneficiaryAccount.Visible := True;
+    lblBenAcc.Visible := True;
+    lblBenAcc.Caption := Model.EnlistAccountForSale.SellerAccount.AccountString;
+  end;
   mmoPayload.Lines.Text := Model.Payload.Content;
 end;
 
@@ -181,6 +194,9 @@ begin
       end;
       omtChangeKey:
         Result := Format('%s', [TOperationsManager.GetOperationShortText(CT_Op_ChangeKeySigned, CT_OpSubtype_ChangeKey)]);
+      omtEnlistAccountForSale:
+        Result := Format('%s', [TOperationsManager.GetOperationShortText(CT_Op_ListAccountForSale, IIF(Model.EnlistAccountForSale.AccountSaleMode = akaPrivateSale, CT_OpSubtype_ListAccountForPrivateSale, CT_OpSubtype_ListAccountForPublicSale))]);
+
     end
   else if ABindingName = 'Recipient' then
     case Model.ModelType of
@@ -201,7 +217,9 @@ begin
           end
           else
             raise ENotSupportedException.Create('ChangeKeyMode');
-        end
+        end;
+      omtEnlistAccountForSale:
+        Result := IIF(Model.EnlistAccountForSale.AccountSaleMode = akaPrivateSale, TAccountComp.AccountPublicKeyExport(Model.EnlistAccountForSale.NewOwnerPublicKey), '');
 
     end
   else if ABindingName = 'Fee' then

+ 1 - 0
src/gui/wizards/operations/UWIZOperationPayload_Encryption.lfm

@@ -7,6 +7,7 @@ object WIZOperationPayload_Encryption: TWIZOperationPayload_Encryption
   Caption = 'Form1'
   ClientHeight = 320
   ClientWidth = 511
+  LCLVersion = '1.8.2.0'
   Visible = False
   object grpPayload: TGroupBox
     Left = 8

+ 5 - 5
src/gui/wizards/operations/UWIZOperationPayload_Encryption.pas

@@ -55,24 +55,24 @@ procedure TWIZOperationPayload_Encryption.OnNext;
 begin
   if rbEncryptedWithRecipient.Checked then
   begin
-    Model.Payload.Mode := akaEncryptWithSender;
+    Model.Payload.PayloadEncryptionMode := akaEncryptWithSender;
   end
   else
   if rbEncryptedWithSender.Checked then
   begin
-    Model.Payload.Mode := akaEncryptWithReceiver;
+    Model.Payload.PayloadEncryptionMode := akaEncryptWithReceiver;
   end
   else
   if rbEncryptedWithPassword.Checked then
   begin
-    Model.Payload.Mode := akaEncryptWithPassword;
+    Model.Payload.PayloadEncryptionMode := akaEncryptWithPassword;
   end
   else
   if rbNotEncrypted.Checked then
   begin
-    Model.Payload.Mode := akaNotEncrypt;
+    Model.Payload.PayloadEncryptionMode := akaNotEncrypt;
   end;
-  case Model.Payload.Mode of
+  case Model.Payload.PayloadEncryptionMode of
     akaEncryptWithPassword:
     begin
       UpdatePath(ptInject, [TWIZOperationPayload_Password]);

+ 1 - 1
src/gui/wizards/operations/UWIZSendPASC.pas

@@ -68,7 +68,7 @@ end;
 function TWIZSendPASCWizard.FinishRequested(out message: ansistring): boolean;
 begin
   // Execute the PASC Sending here
-  Result := TOperationsManager.ExecuteSendPASC(Model.Account.SelectedAccounts, Model.SendPASC.DestinationAccount, Model.Signer.SignerAccount, Model.SendPASC.SingleAmountToSend, Model.Fee.SingleOperationFee, Model.SendPASC.SendPASCMode, Model.Payload.Mode, IIF(Model.Payload.HasPayload, Model.Payload.Content, ''), Model.Payload.Password, message);
+  Result := TOperationsManager.ExecuteSendPASC(Model.Account.SelectedAccounts, Model.SendPASC.DestinationAccount, Model.Signer.SignerAccount, Model.SendPASC.SingleAmountToSend, Model.Fee.SingleOperationFee, Model.SendPASC.SendPASCMode, Model.Payload.PayloadEncryptionMode, IIF(Model.Payload.HasPayload, Model.Payload.Content, ''), Model.Payload.Password, message);
 end;
 
 function TWIZSendPASCWizard.CancelRequested(out message: ansistring): boolean;