X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Fcoincontroldialog.cpp;h=3f67ee658a0d3be229435dd7e4d1cb7bf8373fa8;hb=fbd44e84d5841867d36d295d4f347fd5e55d293f;hp=93f6cea69323a317ec25dc9dfd06bf27e0d04f17;hpb=29bc90511d15286003293cd7a7e6d2fa83500415;p=novacoin.git diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp index 93f6cea..3f67ee6 100644 --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -2,6 +2,7 @@ #include "ui_coincontroldialog.h" #include "init.h" +#include "base58.h" #include "bitcoinunits.h" #include "walletmodel.h" #include "addresstablemodel.h" @@ -104,11 +105,10 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) : #endif connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int))); - // ok button - connect(ui->buttonBox, SIGNAL(clicked()), this, SLOT(on_buttonBox_accepted())); - // (un)select all connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked())); + + ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString()); ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84); ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100); @@ -631,6 +631,7 @@ void CoinControlDialog::updateView() itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked); // address +/* CTxDestination outputAddress; QString sAddress = ""; if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress)) @@ -646,6 +647,52 @@ void CoinControlDialog::updateView() if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed()) nInputSize = 180; } +*/ + QString sAddress = ""; + txnouttype whichType; + std::vector vSolutions; + if (Solver(out.tx->vout[out.i].scriptPubKey, whichType, vSolutions)) + { + CTxDestination address; + if (whichType == TX_PUBKEY) + { + // Pay-to-Pubkey + CPubKey pubKey = CPubKey(vSolutions[0]); + address = pubKey.GetID(); + sAddress = CBitcoinAddress(address).ToString().c_str(); + + if (!pubKey.IsCompressed()) + nInputSize = 180; + } + else if (whichType == TX_PUBKEYHASH) + { + // Pay-to-PubkeyHash + address = CKeyID(uint160(vSolutions[0])); + sAddress = CBitcoinAddress(address).ToString().c_str(); + + CPubKey pubkey; + CKeyID *keyid = boost::get< CKeyID >(&address); + if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed()) + nInputSize = 180; + } + else if (whichType == TX_SCRIPTHASH) + { + // Pay-to-ScriptHash + address = CScriptID(uint160(vSolutions[0])); + sAddress = CBitcoinAddress(address).ToString().c_str(); + } + else if (whichType == TX_PUBKEY_DROP) + { + // Pay-to-Pubkey-R + CMalleableKeyView view; + pwalletMain->CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view); + sAddress = CBitcoinAddress(view.GetMalleablePubKey()).ToString().c_str(); + } + + // if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs + if (!treeMode || (!(sAddress == sWalletAddress))) + itemOutput->setText(COLUMN_ADDRESS, sAddress); + } // label if (!(sAddress == sWalletAddress)) // change @@ -757,4 +804,4 @@ void CoinControlDialog::closeEvent(QCloseEvent* e) { QWidget::closeEvent(e); emit beforeClose(); -} \ No newline at end of file +}