Coins: fix description edit on multi-account wallets

This commit is contained in:
tobtoht 2021-10-23 22:42:49 +02:00
parent b431638b4d
commit 518fa831ae
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C
5 changed files with 15 additions and 8 deletions

View file

@ -32,7 +32,7 @@ if(DEBUG)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
set(MONERO_HEAD "ed8859318349a5f01e9fd90e898603d4142b0951")
set(MONERO_HEAD "eba8ce661ce289df99f507225dbb1aaf58125e85")
set(BUILD_GUI_DEPS ON)
option(ARCH "Target architecture" "x86-64")
set(BUILD_64 ON)

View file

@ -26,8 +26,7 @@ CoinsWidget::CoinsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
connect(ui->coins->header(), &QHeaderView::customContextMenuRequested, this, &CoinsWidget::showHeaderMenu);
// copy menu
m_copyMenu->setIcon(icons()->icon("copy.png"));
m_copyMenu->addAction("Public key", this, [this]{copy(copyField::PubKey);});
m_copyMenu->addAction("Public Key", this, [this]{copy(copyField::PubKey);});
m_copyMenu->addAction("Key Image", this, [this]{copy(copyField::KeyImage);});
m_copyMenu->addAction("Transaction ID", this, [this]{copy(copyField::TxID);});
m_copyMenu->addAction("Address", this, [this]{copy(copyField::Address);});
@ -47,7 +46,7 @@ CoinsWidget::CoinsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
m_freezeAllSelectedAction = new QAction("Freeze selected", this);
m_thawAllSelectedAction = new QAction("Thaw selected", this);
m_viewOutputAction = new QAction(icons()->icon("info2.svg"), "Details", this);
m_viewOutputAction = new QAction("Details", this);
m_sweepOutputAction = new QAction("Sweep output", this);
m_sweepOutputsAction = new QAction("Sweep selected outputs", this);

View file

@ -96,9 +96,9 @@ QVector<CoinsInfo*> Coins::coins_from_txid(const QString &txid)
return coins;
}
void Coins::setDescription(int index, quint32 accountIndex, const QString &description)
void Coins::setDescription(const QString &publicKey, quint32 accountIndex, const QString &description)
{
m_pimpl->setDescription(index, description.toStdString());
m_pimpl->setDescription(publicKey.toStdString(), description.toStdString());
this->refresh(accountIndex);
emit descriptionChanged();
}

View file

@ -31,7 +31,7 @@ public:
Q_INVOKABLE void freeze(QString &publicKey) const;
Q_INVOKABLE void thaw(QString &publicKey) const;
Q_INVOKABLE QVector<CoinsInfo*> coins_from_txid(const QString &txid);
Q_INVOKABLE void setDescription(int index, quint32 accountIndex, const QString &description);
Q_INVOKABLE void setDescription(const QString &publicKey, quint32 accountIndex, const QString &description);
quint64 count() const;

View file

@ -179,9 +179,17 @@ bool CoinsModel::setData(const QModelIndex &index, const QVariant &value, int ro
if (index.isValid() && role == Qt::EditRole) {
const int row = index.row();
QString pubkey;
bool found = m_coins->coin(index.row(), [this, &pubkey](const CoinsInfo &cInfo) {
pubkey = cInfo.pubKey();
});
if (!found) {
return false;
}
switch (index.column()) {
case Label:
m_coins->setDescription(row, m_currentSubaddressAccount, value.toString());
m_coins->setDescription(pubkey, m_currentSubaddressAccount, value.toString());
emit descriptionChanged();
break;
default: