@@ -97,7 +97,7 @@ CoinControlDialog::CoinControlDialog(QWidget *parent) :
97
97
connect (ui->radioListMode , SIGNAL (toggled (bool )), this , SLOT (radioListMode (bool )));
98
98
99
99
// click on checkbox
100
- connect (ui->treeWidget , SIGNAL (itemChanged ( QTreeWidgetItem*, int )), this , SLOT (viewItemChanged ( QTreeWidgetItem*, int )));
100
+ connect (ui->treeWidget , SIGNAL (itemChanged (QTreeWidgetItem*, int )), this , SLOT (viewItemChanged (QTreeWidgetItem*, int )));
101
101
102
102
// click on header
103
103
#if QT_VERSION < 0x050000
@@ -434,7 +434,8 @@ void CoinControlDialog::updateLabelLocked()
434
434
435
435
void CoinControlDialog::updateLabels (WalletModel *model, QDialog* dialog)
436
436
{
437
- if (!model) return ;
437
+ if (!model)
438
+ return ;
438
439
439
440
// nPayAmount
440
441
qint64 nPayAmount = 0 ;
@@ -640,29 +641,29 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
640
641
641
642
void CoinControlDialog::updateView ()
642
643
{
644
+ if (!model || !model->getOptionsModel () || !model->getAddressTableModel ())
645
+ return ;
646
+
643
647
bool treeMode = ui->radioTreeMode ->isChecked ();
644
648
645
649
ui->treeWidget ->clear ();
646
650
ui->treeWidget ->setEnabled (false ); // performance, otherwise updateLabels would be called for every checked checkbox
647
651
ui->treeWidget ->setAlternatingRowColors (!treeMode);
648
- QFlags<Qt::ItemFlag> flgCheckbox= Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
649
- QFlags<Qt::ItemFlag> flgTristate= Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
652
+ QFlags<Qt::ItemFlag> flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
653
+ QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
650
654
651
- int nDisplayUnit = BitcoinUnits::BTC;
652
- if (model && model->getOptionsModel ())
653
- nDisplayUnit = model->getOptionsModel ()->getDisplayUnit ();
655
+ int nDisplayUnit = model->getOptionsModel ()->getDisplayUnit ();
654
656
655
657
map<QString, vector<COutput> > mapCoins;
656
658
model->listCoins (mapCoins);
657
659
658
660
BOOST_FOREACH (PAIRTYPE (QString, vector<COutput>) coins, mapCoins)
659
661
{
660
662
QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem ();
663
+ itemWalletAddress->setCheckState (COLUMN_CHECKBOX, Qt::Unchecked);
661
664
QString sWalletAddress = coins.first ;
662
- QString sWalletLabel = " " ;
663
- if (model->getAddressTableModel ())
664
- sWalletLabel = model->getAddressTableModel ()->labelForAddress (sWalletAddress );
665
- if (sWalletLabel .length () == 0 )
665
+ QString sWalletLabel = model->getAddressTableModel ()->labelForAddress (sWalletAddress );
666
+ if (sWalletLabel .isEmpty ())
666
667
sWalletLabel = tr (" (no label)" );
667
668
668
669
if (treeMode)
@@ -671,7 +672,7 @@ void CoinControlDialog::updateView()
671
672
ui->treeWidget ->addTopLevelItem (itemWalletAddress);
672
673
673
674
itemWalletAddress->setFlags (flgTristate);
674
- itemWalletAddress->setCheckState (COLUMN_CHECKBOX,Qt::Unchecked);
675
+ itemWalletAddress->setCheckState (COLUMN_CHECKBOX, Qt::Unchecked);
675
676
676
677
// label
677
678
itemWalletAddress->setText (COLUMN_LABEL, sWalletLabel );
@@ -722,10 +723,8 @@ void CoinControlDialog::updateView()
722
723
}
723
724
else if (!treeMode)
724
725
{
725
- QString sLabel = " " ;
726
- if (model->getAddressTableModel ())
727
- sLabel = model->getAddressTableModel ()->labelForAddress (sAddress );
728
- if (sLabel .length () == 0 )
726
+ QString sLabel = model->getAddressTableModel ()->labelForAddress (sAddress );
727
+ if (sLabel .isEmpty ())
729
728
sLabel = tr (" (no label)" );
730
729
itemOutput->setText (COLUMN_LABEL, sLabel );
731
730
}
@@ -766,7 +765,7 @@ void CoinControlDialog::updateView()
766
765
767
766
// set checkbox
768
767
if (coinControl->IsSelected (txhash, out.i ))
769
- itemOutput->setCheckState (COLUMN_CHECKBOX,Qt::Checked);
768
+ itemOutput->setCheckState (COLUMN_CHECKBOX, Qt::Checked);
770
769
}
771
770
772
771
// amount
0 commit comments