Changeset View
Changeset View
Standalone View
Standalone View
src/qt/transactionview.cpp
Show First 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | if (_model) { | ||||
mapperThirdPartyTxUrls, SLOT(map())); | mapperThirdPartyTxUrls, SLOT(map())); | ||||
mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, | mapperThirdPartyTxUrls->setMapping(thirdPartyTxUrlAction, | ||||
listUrls[i].trimmed()); | listUrls[i].trimmed()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// show/hide column Watch-only | // show/hide column Watch-only | ||||
updateWatchOnlyColumn(_model->haveWatchOnly()); | updateWatchOnlyColumn(_model->wallet().haveWatchOnly()); | ||||
// Watch-only signal | // Watch-only signal | ||||
connect(_model, SIGNAL(notifyWatchonlyChanged(bool)), this, | connect(_model, SIGNAL(notifyWatchonlyChanged(bool)), this, | ||||
SLOT(updateWatchOnlyColumn(bool))); | SLOT(updateWatchOnlyColumn(bool))); | ||||
} | } | ||||
} | } | ||||
void TransactionView::chooseDate(int idx) { | void TransactionView::chooseDate(int idx) { | ||||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | if (filename.isNull()) { | ||||
return; | return; | ||||
} | } | ||||
CSVModelWriter writer(filename); | CSVModelWriter writer(filename); | ||||
// name, column, role | // name, column, role | ||||
writer.setModel(transactionProxyModel); | writer.setModel(transactionProxyModel); | ||||
writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole); | writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole); | ||||
if (model->haveWatchOnly()) { | if (model->wallet().haveWatchOnly()) { | ||||
writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly); | writer.addColumn(tr("Watch-only"), TransactionTableModel::Watchonly); | ||||
} | } | ||||
writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole); | writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole); | ||||
writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole); | writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole); | ||||
writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole); | writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole); | ||||
writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole); | writer.addColumn(tr("Address"), 0, TransactionTableModel::AddressRole); | ||||
writer.addColumn(BitcoinUnits::getAmountColumnTitle( | writer.addColumn(BitcoinUnits::getAmountColumnTitle( | ||||
model->getOptionsModel()->getDisplayUnit()), | model->getOptionsModel()->getDisplayUnit()), | ||||
Show All 25 Lines | void TransactionView::contextualMenu(const QPoint &point) { | ||||
// check if transaction can be abandoned, disable context menu action in | // check if transaction can be abandoned, disable context menu action in | ||||
// case it doesn't | // case it doesn't | ||||
TxId txid; | TxId txid; | ||||
txid.SetHex(selection.at(0) | txid.SetHex(selection.at(0) | ||||
.data(TransactionTableModel::TxHashRole) | .data(TransactionTableModel::TxHashRole) | ||||
.toString() | .toString() | ||||
.toStdString()); | .toStdString()); | ||||
abandonAction->setEnabled(model->transactionCanBeAbandoned(txid)); | abandonAction->setEnabled(model->wallet().transactionCanBeAbandoned(txid)); | ||||
if (index.isValid()) { | if (index.isValid()) { | ||||
contextMenu->popup(transactionView->viewport()->mapToGlobal(point)); | contextMenu->popup(transactionView->viewport()->mapToGlobal(point)); | ||||
} | } | ||||
} | } | ||||
void TransactionView::abandonTx() { | void TransactionView::abandonTx() { | ||||
if (!transactionView || !transactionView->selectionModel()) { | if (!transactionView || !transactionView->selectionModel()) { | ||||
return; | return; | ||||
} | } | ||||
QModelIndexList selection = | QModelIndexList selection = | ||||
transactionView->selectionModel()->selectedRows(0); | transactionView->selectionModel()->selectedRows(0); | ||||
// get the hash from the TxHashRole (QVariant / QString) | // get the hash from the TxHashRole (QVariant / QString) | ||||
QString hashQStr = | QString hashQStr = | ||||
selection.at(0).data(TransactionTableModel::TxHashRole).toString(); | selection.at(0).data(TransactionTableModel::TxHashRole).toString(); | ||||
TxId txid; | TxId txid; | ||||
txid.SetHex(hashQStr.toStdString()); | txid.SetHex(hashQStr.toStdString()); | ||||
// Abandon the wallet transaction over the walletModel | // Abandon the wallet transaction over the walletModel | ||||
model->abandonTransaction(txid); | model->wallet().abandonTransaction(txid); | ||||
// Update the table | // Update the table | ||||
model->getTransactionTableModel()->updateTransaction(hashQStr, CT_UPDATED, | model->getTransactionTableModel()->updateTransaction(hashQStr, CT_UPDATED, | ||||
false); | false); | ||||
} | } | ||||
void TransactionView::copyAddress() { | void TransactionView::copyAddress() { | ||||
GUIUtil::copyEntryData(transactionView, 0, | GUIUtil::copyEntryData(transactionView, 0, | ||||
▲ Show 20 Lines • Show All 216 Lines • Show Last 20 Lines |