mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-07-26 06:53:02 +02:00
Merge bitcoin/bitcoin#32459: qt: drop unused watch-only functionality
e8661aac75
wallet: drop watch-only things from interface (Sjors Provoost)e99188e7da
qt: drop unused watch-only functionality (Sjors Provoost) Pull request description: The watch-only functionality in the GUI was only used for legacy wallets. Watch-only descriptor wallets do not use this. The only visible changes of this PR should be: - dropped "Spendable:" label from the overview tab - column width cache is reset This PR also removes some unused variables from the interface. ACKs for top commit: davidgumberg: Review ACKe8661aac75
. hebasto: ACKe8661aac75
, I have reviewed the code and it looks OK. The `src/qt/forms/overviewpage.ui` form was reviewed in Qt Designer. Tree-SHA512: d7edb0f167e0b934075398a76eddca69890bb36848a918c932b1c2cea85ee87285e876cbfdf1f6dec7adf26b9f405fb558c70bec0c84585c0a9df33c2af78393
This commit is contained in:
3
doc/release-notes-32459.md
Normal file
3
doc/release-notes-32459.md
Normal file
@@ -0,0 +1,3 @@
|
||||
GUI changes
|
||||
|
||||
- Custom column widths in the Transactions tab are reset as a side-effect of legacy wallet removal. (#32459)
|
@@ -372,17 +372,11 @@ struct WalletBalances
|
||||
CAmount balance = 0;
|
||||
CAmount unconfirmed_balance = 0;
|
||||
CAmount immature_balance = 0;
|
||||
bool have_watch_only = false;
|
||||
CAmount watch_only_balance = 0;
|
||||
CAmount unconfirmed_watch_only_balance = 0;
|
||||
CAmount immature_watch_only_balance = 0;
|
||||
|
||||
bool balanceChanged(const WalletBalances& prev) const
|
||||
{
|
||||
return balance != prev.balance || unconfirmed_balance != prev.unconfirmed_balance ||
|
||||
immature_balance != prev.immature_balance || watch_only_balance != prev.watch_only_balance ||
|
||||
unconfirmed_watch_only_balance != prev.unconfirmed_watch_only_balance ||
|
||||
immature_watch_only_balance != prev.immature_watch_only_balance;
|
||||
immature_balance != prev.immature_balance;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -111,26 +111,7 @@
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="2" column="2">
|
||||
<widget class="QLabel" name="labelWatchPending">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Unconfirmed transactions to watch-only addresses</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00000000 BTC</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelUnconfirmed">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
@@ -149,59 +130,21 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="labelWatchImmature">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Mined balance in watch-only addresses that has not yet matured</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00000000 BTC</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="Line" name="lineWatchBalance">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>140</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="labelTotalText">
|
||||
<property name="text">
|
||||
<string>Total:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="labelImmature">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
@@ -220,7 +163,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="1" column="2">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -233,14 +176,14 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelImmatureText">
|
||||
<property name="text">
|
||||
<string>Immature:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="labelTotal">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
@@ -259,43 +202,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<widget class="QLabel" name="labelWatchTotal">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Current total balance in watch-only addresses</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">21 000 000.00000000 BTC</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="labelWatchonly">
|
||||
<property name="text">
|
||||
<string>Watch-only:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelBalanceText">
|
||||
<property name="text">
|
||||
<string>Available:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelBalance">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
@@ -314,42 +228,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="labelWatchAvailable">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Your current balance in watch-only addresses</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">21 000 000.00000000 BTC</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelPendingText">
|
||||
<property name="text">
|
||||
<string>Pending:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelSpendable">
|
||||
<property name="text">
|
||||
<string>Spendable:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@@ -68,14 +68,6 @@ public:
|
||||
foreground = brush.color();
|
||||
}
|
||||
|
||||
if (index.data(TransactionTableModel::WatchonlyRole).toBool()) {
|
||||
QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
|
||||
QRect watchonlyRect(addressRect.left(), addressRect.top(), 16, addressRect.height());
|
||||
iconWatchonly = platformStyle->TextColorIcon(iconWatchonly);
|
||||
iconWatchonly.paint(painter, watchonlyRect);
|
||||
addressRect.setLeft(addressRect.left() + watchonlyRect.width() + 5);
|
||||
}
|
||||
|
||||
painter->setPen(foreground);
|
||||
QRect boundingRect;
|
||||
painter->drawText(addressRect, Qt::AlignLeft | Qt::AlignVCenter, address, &boundingRect);
|
||||
@@ -202,26 +194,9 @@ void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
|
||||
// only show immature (newly mined) balance if it's non-zero, so as not to complicate things
|
||||
// for the non-mining users
|
||||
bool showImmature = balances.immature_balance != 0;
|
||||
bool showWatchOnlyImmature = balances.immature_watch_only_balance != 0;
|
||||
|
||||
// for symmetry reasons also show immature label when the watch-only one is shown
|
||||
ui->labelImmature->setVisible(showImmature || showWatchOnlyImmature);
|
||||
ui->labelImmatureText->setVisible(showImmature || showWatchOnlyImmature);
|
||||
ui->labelWatchImmature->setVisible(!walletModel->wallet().privateKeysDisabled() && showWatchOnlyImmature); // show watch-only immature balance
|
||||
}
|
||||
|
||||
// show/hide watch-only labels
|
||||
void OverviewPage::updateWatchOnlyLabels(bool showWatchOnly)
|
||||
{
|
||||
ui->labelSpendable->setVisible(showWatchOnly); // show spendable label (only when watch-only is active)
|
||||
ui->labelWatchonly->setVisible(showWatchOnly); // show watch-only label
|
||||
ui->lineWatchBalance->setVisible(showWatchOnly); // show watch-only balance separator line
|
||||
ui->labelWatchAvailable->setVisible(showWatchOnly); // show watch-only available balance
|
||||
ui->labelWatchPending->setVisible(showWatchOnly); // show watch-only pending balance
|
||||
ui->labelWatchTotal->setVisible(showWatchOnly); // show watch-only total balance
|
||||
|
||||
if (!showWatchOnly)
|
||||
ui->labelWatchImmature->hide();
|
||||
ui->labelImmature->setVisible(showImmature);
|
||||
ui->labelImmatureText->setVisible(showImmature);
|
||||
}
|
||||
|
||||
void OverviewPage::setClientModel(ClientModel *model)
|
||||
@@ -262,8 +237,6 @@ void OverviewPage::setWalletModel(WalletModel *model)
|
||||
connect(model, &WalletModel::balanceChanged, this, &OverviewPage::setBalance);
|
||||
|
||||
connect(model->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &OverviewPage::updateDisplayUnit);
|
||||
|
||||
updateWatchOnlyLabels(false);
|
||||
}
|
||||
|
||||
// update the display unit, to not use the default ("BTC")
|
||||
@@ -324,8 +297,4 @@ void OverviewPage::setMonospacedFont(const QFont& f)
|
||||
ui->labelUnconfirmed->setFont(f);
|
||||
ui->labelImmature->setFont(f);
|
||||
ui->labelTotal->setFont(f);
|
||||
ui->labelWatchAvailable->setFont(f);
|
||||
ui->labelWatchPending->setFont(f);
|
||||
ui->labelWatchImmature->setFont(f);
|
||||
ui->labelWatchTotal->setFont(f);
|
||||
}
|
||||
|
@@ -64,7 +64,6 @@ private Q_SLOTS:
|
||||
void updateDisplayUnit();
|
||||
void handleTransactionClicked(const QModelIndex &index);
|
||||
void updateAlerts(const QString &warnings);
|
||||
void updateWatchOnlyLabels(bool showWatchOnly);
|
||||
void setMonospacedFont(const QFont&);
|
||||
};
|
||||
|
||||
|
@@ -787,9 +787,6 @@ void SendCoinsDialog::on_buttonMinimizeFee_clicked()
|
||||
|
||||
void SendCoinsDialog::useAvailableBalance(SendCoinsEntry* entry)
|
||||
{
|
||||
// Include watch-only for wallets without private key
|
||||
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
|
||||
|
||||
// Same behavior as send: if we have selected coins, only obtain their available balance.
|
||||
// Copy to avoid modifying the member's data.
|
||||
CCoinControl coin_control = *m_coin_control;
|
||||
@@ -847,8 +844,6 @@ void SendCoinsDialog::updateCoinControlState()
|
||||
// Either custom fee will be used or if not selected, the confirmation target from dropdown box
|
||||
m_coin_control->m_confirm_target = getConfTargetForIndex(ui->confTargetSelector->currentIndex());
|
||||
m_coin_control->m_signal_bip125_rbf = ui->optInRBF->isChecked();
|
||||
// Include watch-only for wallets without private key
|
||||
m_coin_control->fAllowWatchOnly = model->wallet().privateKeysDisabled() && !model->wallet().hasExternalSigner();
|
||||
}
|
||||
|
||||
void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, SyncType synctype, SynchronizationState sync_state) {
|
||||
|
@@ -26,7 +26,6 @@
|
||||
|
||||
using wallet::ISMINE_ALL;
|
||||
using wallet::ISMINE_SPENDABLE;
|
||||
using wallet::ISMINE_WATCH_ONLY;
|
||||
using wallet::isminetype;
|
||||
|
||||
QString TransactionDesc::FormatTxStatus(const interfaces::WalletTxStatus& status, bool inMempool)
|
||||
@@ -150,7 +149,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||
strHTML += GUIUtil::HtmlEscape(rec->address);
|
||||
QString addressOwned = ismine == ISMINE_SPENDABLE ? tr("own address") : tr("watch-only");
|
||||
QString addressOwned = tr("own address");
|
||||
if (!name.empty())
|
||||
strHTML += " (" + addressOwned + ", " + tr("label") + ": " + GUIUtil::HtmlEscape(name) + ")";
|
||||
else
|
||||
@@ -218,10 +217,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
||||
|
||||
if (fAllFromMe)
|
||||
{
|
||||
if(fAllFromMe & ISMINE_WATCH_ONLY)
|
||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("watch-only") + "<br>";
|
||||
|
||||
//
|
||||
// Debit
|
||||
//
|
||||
auto mine = wtx.txout_is_mine.begin();
|
||||
@@ -246,8 +241,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
||||
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
|
||||
if(toSelf == ISMINE_SPENDABLE)
|
||||
strHTML += " (" + tr("own address") + ")";
|
||||
else if(toSelf & ISMINE_WATCH_ONLY)
|
||||
strHTML += " (" + tr("watch-only") + ")";
|
||||
strHTML += "<br>";
|
||||
}
|
||||
}
|
||||
@@ -370,7 +363,6 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
||||
}
|
||||
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
|
||||
strHTML = strHTML + " IsMine=" + (wallet.txoutIsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
|
||||
strHTML = strHTML + " IsWatchOnly=" + (wallet.txoutIsMine(vout) & ISMINE_WATCH_ONLY ? tr("true") : tr("false")) + "</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,12 +30,6 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
|
||||
if (!(TYPE(type) & typeFilter))
|
||||
return false;
|
||||
|
||||
bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
|
||||
if (involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_No)
|
||||
return false;
|
||||
if (!involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_Yes)
|
||||
return false;
|
||||
|
||||
QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
|
||||
if (dateFrom && datetime < *dateFrom) return false;
|
||||
if (dateTo && datetime > *dateTo) return false;
|
||||
@@ -82,12 +76,6 @@ void TransactionFilterProxy::setMinAmount(const CAmount& minimum)
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void TransactionFilterProxy::setWatchOnlyFilter(WatchOnlyFilter filter)
|
||||
{
|
||||
this->watchOnlyFilter = filter;
|
||||
invalidateFilter();
|
||||
}
|
||||
|
||||
void TransactionFilterProxy::setShowInactive(bool _showInactive)
|
||||
{
|
||||
this->showInactive = _showInactive;
|
||||
|
@@ -25,13 +25,6 @@ public:
|
||||
|
||||
static quint32 TYPE(int type) { return 1<<type; }
|
||||
|
||||
enum WatchOnlyFilter
|
||||
{
|
||||
WatchOnlyFilter_All,
|
||||
WatchOnlyFilter_Yes,
|
||||
WatchOnlyFilter_No
|
||||
};
|
||||
|
||||
/** Filter transactions between date range. Use std::nullopt for open range. */
|
||||
void setDateRange(const std::optional<QDateTime>& from, const std::optional<QDateTime>& to);
|
||||
void setSearchString(const QString &);
|
||||
@@ -40,7 +33,6 @@ public:
|
||||
*/
|
||||
void setTypeFilter(quint32 modes);
|
||||
void setMinAmount(const CAmount& minimum);
|
||||
void setWatchOnlyFilter(WatchOnlyFilter filter);
|
||||
|
||||
/** Set whether to show conflicted transactions. */
|
||||
void setShowInactive(bool showInactive);
|
||||
@@ -53,7 +45,6 @@ private:
|
||||
std::optional<QDateTime> dateTo;
|
||||
QString m_search_string;
|
||||
quint32 typeFilter;
|
||||
WatchOnlyFilter watchOnlyFilter{WatchOnlyFilter_All};
|
||||
CAmount minAmount{0};
|
||||
bool showInactive{true};
|
||||
};
|
||||
|
@@ -15,7 +15,6 @@
|
||||
|
||||
using wallet::ISMINE_NO;
|
||||
using wallet::ISMINE_SPENDABLE;
|
||||
using wallet::ISMINE_WATCH_ONLY;
|
||||
using wallet::isminetype;
|
||||
|
||||
/* Return positive answer if transaction should be shown in list.
|
||||
@@ -40,7 +39,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||
Txid hash = wtx.tx->GetHash();
|
||||
std::map<std::string, std::string> mapValue = wtx.value_map;
|
||||
|
||||
bool involvesWatchAddress = false;
|
||||
isminetype fAllFromMe = ISMINE_SPENDABLE;
|
||||
bool any_from_me = false;
|
||||
if (wtx.is_coinbase) {
|
||||
@@ -48,18 +46,12 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||
} else {
|
||||
for (const isminetype mine : wtx.txin_is_mine)
|
||||
{
|
||||
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
|
||||
if(fAllFromMe > mine) fAllFromMe = mine;
|
||||
if (mine) any_from_me = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (fAllFromMe || !any_from_me) {
|
||||
for (const isminetype mine : wtx.txout_is_mine)
|
||||
{
|
||||
if(mine & ISMINE_WATCH_ONLY) involvesWatchAddress = true;
|
||||
}
|
||||
|
||||
CAmount nTxFee = nDebit - wtx.tx->GetValueOut();
|
||||
|
||||
for(unsigned int i = 0; i < wtx.tx->vout.size(); i++)
|
||||
@@ -79,7 +71,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||
|
||||
TransactionRecord sub(hash, nTime);
|
||||
sub.idx = i;
|
||||
sub.involvesWatchAddress = involvesWatchAddress;
|
||||
|
||||
if (!std::get_if<CNoDestination>(&wtx.txout_address[i]))
|
||||
{
|
||||
@@ -116,7 +107,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||
TransactionRecord sub(hash, nTime);
|
||||
sub.idx = i; // vout index
|
||||
sub.credit = txout.nValue;
|
||||
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
|
||||
if (wtx.txout_address_is_mine[i])
|
||||
{
|
||||
// Received by Bitcoin Address
|
||||
@@ -143,7 +133,6 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const interface
|
||||
// Mixed debit transaction, can't break down payees
|
||||
//
|
||||
parts.append(TransactionRecord(hash, nTime, TransactionRecord::Other, "", nNet, 0));
|
||||
parts.last().involvesWatchAddress = involvesWatchAddress;
|
||||
}
|
||||
|
||||
return parts;
|
||||
|
@@ -115,9 +115,6 @@ public:
|
||||
/** Status: can change with block chain update */
|
||||
TransactionStatus status;
|
||||
|
||||
/** Whether the transaction was sent/received with a watch-only address */
|
||||
bool involvesWatchAddress;
|
||||
|
||||
/** Return the unique identifier for this transaction (part) */
|
||||
QString getTxHash() const;
|
||||
|
||||
|
@@ -35,7 +35,6 @@
|
||||
// Amount column is right-aligned it contains numbers
|
||||
static int column_alignments[] = {
|
||||
Qt::AlignLeft|Qt::AlignVCenter, /*status=*/
|
||||
Qt::AlignLeft|Qt::AlignVCenter, /*watchonly=*/
|
||||
Qt::AlignLeft|Qt::AlignVCenter, /*date=*/
|
||||
Qt::AlignLeft|Qt::AlignVCenter, /*type=*/
|
||||
Qt::AlignLeft|Qt::AlignVCenter, /*address=*/
|
||||
@@ -255,7 +254,7 @@ TransactionTableModel::TransactionTableModel(const PlatformStyle *_platformStyle
|
||||
{
|
||||
subscribeToCoreSignals();
|
||||
|
||||
columns << QString() << QString() << tr("Date") << tr("Type") << tr("Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
|
||||
columns << QString() << tr("Date") << tr("Type") << tr("Label") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
|
||||
priv->refreshWallet(walletModel->wallet());
|
||||
|
||||
connect(walletModel->getOptionsModel(), &OptionsModel::displayUnitChanged, this, &TransactionTableModel::updateDisplayUnit);
|
||||
@@ -403,24 +402,18 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
|
||||
|
||||
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
|
||||
{
|
||||
QString watchAddress;
|
||||
if (tooltip && wtx->involvesWatchAddress) {
|
||||
// Mark transactions involving watch-only addresses by adding " (watch-only)"
|
||||
watchAddress = QLatin1String(" (") + tr("watch-only") + QLatin1Char(')');
|
||||
}
|
||||
|
||||
switch(wtx->type)
|
||||
{
|
||||
case TransactionRecord::RecvFromOther:
|
||||
return QString::fromStdString(wtx->address) + watchAddress;
|
||||
return QString::fromStdString(wtx->address);
|
||||
case TransactionRecord::RecvWithAddress:
|
||||
case TransactionRecord::SendToAddress:
|
||||
case TransactionRecord::Generated:
|
||||
return lookupAddress(wtx->address, tooltip) + watchAddress;
|
||||
return lookupAddress(wtx->address, tooltip);
|
||||
case TransactionRecord::SendToOther:
|
||||
return QString::fromStdString(wtx->address) + watchAddress;
|
||||
return QString::fromStdString(wtx->address);
|
||||
default:
|
||||
return tr("(n/a)") + watchAddress;
|
||||
return tr("(n/a)");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -489,14 +482,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
|
||||
}
|
||||
}
|
||||
|
||||
QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const
|
||||
{
|
||||
if (wtx->involvesWatchAddress)
|
||||
return QIcon(":/icons/eye");
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QString TransactionTableModel::formatTooltip(const TransactionRecord *rec) const
|
||||
{
|
||||
QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec);
|
||||
@@ -520,8 +505,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||
switch (column) {
|
||||
case Status:
|
||||
return txStatusDecoration(rec);
|
||||
case Watchonly:
|
||||
return txWatchonlyDecoration(rec);
|
||||
case Date: return {};
|
||||
case Type: return {};
|
||||
case ToAddress:
|
||||
@@ -537,7 +520,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||
case Qt::DisplayRole:
|
||||
switch (column) {
|
||||
case Status: return {};
|
||||
case Watchonly: return {};
|
||||
case Date:
|
||||
return formatTxDate(rec);
|
||||
case Type:
|
||||
@@ -557,8 +539,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||
return QString::fromStdString(strprintf("%020s-%s", rec->time, rec->status.sortKey));
|
||||
case Type:
|
||||
return formatTxType(rec);
|
||||
case Watchonly:
|
||||
return (rec->involvesWatchAddress ? 1 : 0);
|
||||
case ToAddress:
|
||||
return formatTxToAddress(rec, true);
|
||||
case Amount:
|
||||
@@ -593,10 +573,6 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
|
||||
return rec->type;
|
||||
case DateRole:
|
||||
return QDateTime::fromSecsSinceEpoch(rec->time);
|
||||
case WatchonlyRole:
|
||||
return rec->involvesWatchAddress;
|
||||
case WatchonlyDecorationRole:
|
||||
return txWatchonlyDecoration(rec);
|
||||
case LongDescriptionRole:
|
||||
return priv->describe(walletModel->node(), walletModel->wallet(), rec, walletModel->getOptionsModel()->getDisplayUnit());
|
||||
case AddressRole:
|
||||
@@ -669,8 +645,6 @@ QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientat
|
||||
return tr("Date and time that the transaction was received.");
|
||||
case Type:
|
||||
return tr("Type of transaction.");
|
||||
case Watchonly:
|
||||
return tr("Whether or not a watch-only address is involved in this transaction.");
|
||||
case ToAddress:
|
||||
return tr("User-defined intent/purpose of the transaction.");
|
||||
case Amount:
|
||||
|
@@ -33,11 +33,10 @@ public:
|
||||
|
||||
enum ColumnIndex {
|
||||
Status = 0,
|
||||
Watchonly = 1,
|
||||
Date = 2,
|
||||
Type = 3,
|
||||
ToAddress = 4,
|
||||
Amount = 5
|
||||
Date = 1,
|
||||
Type = 2,
|
||||
ToAddress = 3,
|
||||
Amount = 4
|
||||
};
|
||||
|
||||
/** Roles to get specific information from a transaction row.
|
||||
@@ -48,10 +47,6 @@ public:
|
||||
TypeRole = Qt::UserRole,
|
||||
/** Date and time this transaction was created */
|
||||
DateRole,
|
||||
/** Watch-only boolean */
|
||||
WatchonlyRole,
|
||||
/** Watch-only icon */
|
||||
WatchonlyDecorationRole,
|
||||
/** Long description (HTML format) */
|
||||
LongDescriptionRole,
|
||||
/** Address of transaction */
|
||||
@@ -104,7 +99,6 @@ private:
|
||||
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::SeparatorStyle::STANDARD) const;
|
||||
QString formatTooltip(const TransactionRecord *rec) const;
|
||||
QVariant txStatusDecoration(const TransactionRecord *wtx) const;
|
||||
QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const;
|
||||
QVariant txAddressDecoration(const TransactionRecord *wtx) const;
|
||||
|
||||
public Q_SLOTS:
|
||||
|
@@ -57,13 +57,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
||||
hlayout->addSpacing(23);
|
||||
}
|
||||
|
||||
watchOnlyWidget = new QComboBox(this);
|
||||
watchOnlyWidget->setFixedWidth(24);
|
||||
watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
|
||||
watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
|
||||
watchOnlyWidget->addItem(platformStyle->SingleColorIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
|
||||
hlayout->addWidget(watchOnlyWidget);
|
||||
|
||||
dateWidget = new QComboBox(this);
|
||||
if (platformStyle->getUseExtraSpacing()) {
|
||||
dateWidget->setFixedWidth(121);
|
||||
@@ -153,9 +146,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
||||
transactionView->verticalHeader()->hide();
|
||||
|
||||
QSettings settings;
|
||||
if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState").toByteArray())) {
|
||||
if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState-2025").toByteArray())) {
|
||||
transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
|
||||
transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
|
||||
transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
|
||||
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
|
||||
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
|
||||
@@ -181,7 +173,6 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
||||
|
||||
connect(dateWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseDate);
|
||||
connect(typeWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseType);
|
||||
connect(watchOnlyWidget, qOverload<int>(&QComboBox::activated), this, &TransactionView::chooseWatchonly);
|
||||
connect(amountWidget, &QLineEdit::textChanged, amount_typing_delay, qOverload<>(&QTimer::start));
|
||||
connect(amount_typing_delay, &QTimer::timeout, this, &TransactionView::changedAmount);
|
||||
connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, qOverload<>(&QTimer::start));
|
||||
@@ -201,7 +192,8 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
||||
TransactionView::~TransactionView()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("TransactionViewHeaderState", transactionView->horizontalHeader()->saveState());
|
||||
// Rename this cache when adding or removing columns.
|
||||
settings.setValue("TransactionViewHeaderState-2025", transactionView->horizontalHeader()->saveState());
|
||||
}
|
||||
|
||||
void TransactionView::setModel(WalletModel *_model)
|
||||
@@ -240,23 +232,11 @@ void TransactionView::setModel(WalletModel *_model)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// hide column Watch-only
|
||||
updateWatchOnlyColumn(false);
|
||||
}
|
||||
}
|
||||
|
||||
void TransactionView::changeEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::PaletteChange) {
|
||||
watchOnlyWidget->setItemIcon(
|
||||
TransactionFilterProxy::WatchOnlyFilter_Yes,
|
||||
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_plus")));
|
||||
watchOnlyWidget->setItemIcon(
|
||||
TransactionFilterProxy::WatchOnlyFilter_No,
|
||||
m_platform_style->SingleColorIcon(QStringLiteral(":/icons/eye_minus")));
|
||||
}
|
||||
|
||||
QWidget::changeEvent(e);
|
||||
}
|
||||
|
||||
@@ -315,14 +295,6 @@ void TransactionView::chooseType(int idx)
|
||||
typeWidget->itemData(idx).toInt());
|
||||
}
|
||||
|
||||
void TransactionView::chooseWatchonly(int idx)
|
||||
{
|
||||
if(!transactionProxyModel)
|
||||
return;
|
||||
transactionProxyModel->setWatchOnlyFilter(
|
||||
static_cast<TransactionFilterProxy::WatchOnlyFilter>(watchOnlyWidget->itemData(idx).toInt()));
|
||||
}
|
||||
|
||||
void TransactionView::changedSearch()
|
||||
{
|
||||
if(!transactionProxyModel)
|
||||
@@ -645,13 +617,6 @@ bool TransactionView::eventFilter(QObject *obj, QEvent *event)
|
||||
return QWidget::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
// show/hide column Watch-only
|
||||
void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
|
||||
{
|
||||
watchOnlyWidget->setVisible(fHaveWatchOnly);
|
||||
transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
|
||||
}
|
||||
|
||||
void TransactionView::closeOpenedDialogs()
|
||||
{
|
||||
// close all dialogs opened from this view
|
||||
|
@@ -55,7 +55,6 @@ public:
|
||||
|
||||
enum ColumnWidths {
|
||||
STATUS_COLUMN_WIDTH = 30,
|
||||
WATCHONLY_COLUMN_WIDTH = 23,
|
||||
DATE_COLUMN_WIDTH = 120,
|
||||
TYPE_COLUMN_WIDTH = 113,
|
||||
AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
|
||||
@@ -72,7 +71,6 @@ private:
|
||||
|
||||
QComboBox *dateWidget;
|
||||
QComboBox *typeWidget;
|
||||
QComboBox *watchOnlyWidget;
|
||||
QLineEdit *search_widget;
|
||||
QLineEdit *amountWidget;
|
||||
|
||||
@@ -106,7 +104,6 @@ private Q_SLOTS:
|
||||
void copyTxHex();
|
||||
void copyTxPlainText();
|
||||
void openThirdPartyTxUrl(QString url);
|
||||
void updateWatchOnlyColumn(bool fHaveWatchOnly);
|
||||
void abandonTx();
|
||||
void bumpFee(bool checked);
|
||||
|
||||
@@ -121,7 +118,6 @@ Q_SIGNALS:
|
||||
public Q_SLOTS:
|
||||
void chooseDate(int idx);
|
||||
void chooseType(int idx);
|
||||
void chooseWatchonly(int idx);
|
||||
void changedAmount();
|
||||
void changedSearch();
|
||||
void exportClicked();
|
||||
|
@@ -603,13 +603,7 @@ CAmount WalletModel::getAvailableBalance(const CCoinControl* control)
|
||||
// No selected coins, return the cached balance
|
||||
if (!control || !control->HasSelected()) {
|
||||
const interfaces::WalletBalances& balances = getCachedBalance();
|
||||
CAmount available_balance = balances.balance;
|
||||
// if wallet private keys are disabled, this is a watch-only wallet
|
||||
// so, let's include the watch-only balance.
|
||||
if (balances.have_watch_only && m_wallet->privateKeysDisabled()) {
|
||||
available_balance += balances.watch_only_balance;
|
||||
}
|
||||
return available_balance;
|
||||
return balances.balance;
|
||||
}
|
||||
// Fetch balance from the wallet, taking into account the selected coins
|
||||
return wallet().getAvailableBalance(*control);
|
||||
|
@@ -399,7 +399,6 @@ public:
|
||||
result.balance = bal.m_mine_trusted;
|
||||
result.unconfirmed_balance = bal.m_mine_untrusted_pending;
|
||||
result.immature_balance = bal.m_mine_immature;
|
||||
result.have_watch_only = false;
|
||||
return result;
|
||||
}
|
||||
bool tryGetBalances(WalletBalances& balances, uint256& block_hash) override
|
||||
|
Reference in New Issue
Block a user