1212#include " addresstablemodel.h"
1313#include " coincontrol.h"
1414#include " script/standard.h"
15+ #include < primitives/deterministicmint.h>
1516#include " openuridialog.h"
17+ #include " zpivcontroldialog.h"
1618
1719
1820#include < iostream>
@@ -358,6 +360,23 @@ bool SendWidget::sendZpiv(QList<SendCoinsRecipient> recipients){
358360 outputs.push_back (std::pair<CBitcoinAddress*, CAmount>(new CBitcoinAddress (rec.address .toStdString ()),rec.amount ));
359361 }
360362
363+ // TODO: Complete me..
364+ // use mints from zPIV selector if applicable
365+ vector<CMintMeta> vMintsToFetch;
366+ vector<CZerocoinMint> vMintsSelected;
367+ if (!ZPivControlDialog::setSelectedMints.empty ()) {
368+ vMintsToFetch = ZPivControlDialog::GetSelectedMints ();
369+
370+ for (auto & meta : vMintsToFetch) {
371+ CZerocoinMint mint;
372+ if (!walletModel->getMint (meta.hashSerial , mint)){
373+ inform (tr (" Coin control mint not found" ));
374+ return false ;
375+ }
376+ vMintsSelected.emplace_back (mint);
377+ }
378+ }
379+
361380 // TODO: add confirm dialog..
362381 QString sendBody = outputs.size () == 1 ?
363382 tr (" Sending %1 to address %2\n " )
@@ -377,7 +396,6 @@ bool SendWidget::sendZpiv(QList<SendCoinsRecipient> recipients){
377396
378397 if (!ret) return false ;
379398
380- vector <CZerocoinMint> vMintsSelected;
381399 CZerocoinSpendReceipt receipt;
382400
383401 std::string changeAddress = " " ;
@@ -397,6 +415,7 @@ bool SendWidget::sendZpiv(QList<SendCoinsRecipient> recipients){
397415 )
398416 ) {
399417 inform (tr (" zPIV transaction sent!" ));
418+ ZPivControlDialog::setSelectedMints.clear ();
400419 clearAll ();
401420 return true ;
402421 } else {
@@ -563,9 +582,10 @@ void SendWidget::onCoinControlClicked()
563582 coinControlDialog->exec ();
564583 ui->btnCoinControl ->setActive (CoinControlDialog::coinControl->HasSelected ());
565584 }else {
566- showHideOp (true );
567- CoinControlZpivDialog* dialog = new CoinControlZpivDialog (window);
568- openDialogWithOpaqueBackgroundFullScreen (dialog, window);
585+ ZPivControlDialog* zPivControl = new ZPivControlDialog (this );
586+ zPivControl->setModel (walletModel);
587+ zPivControl->exec ();
588+ ui->btnCoinControl ->setActive (!ZPivControlDialog::setSelectedMints.empty ());
569589 }
570590}
571591
0 commit comments