]> Nutra Git (v1) - gamesguru/feather.git/commitdiff
Coins: fix description edit on multi-account wallets
authortobtoht <thotbot@protonmail.com>
Sat, 23 Oct 2021 20:42:49 +0000 (22:42 +0200)
committertobtoht <thotbot@protonmail.com>
Sat, 23 Oct 2021 20:42:49 +0000 (22:42 +0200)
CMakeLists.txt
src/CoinsWidget.cpp
src/libwalletqt/Coins.cpp
src/libwalletqt/Coins.h
src/model/CoinsModel.cpp

index 45010e0a423ce8f84c8995c6635edb27e4ec91a7..08f8ed3893526f13ae88a9ac627bf6e55cdabc8a 100644 (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)
index 767c4bc5ab2122a1bf044e2f5c50b5e3d2b46574..1808c70ecfe19fd6c9b1525d86cf50fca11885f1 100644 (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);
 
index b95d4f7c95333afaa0cb5364536105cd8614d1b0..5ba518b40dfe2d0c8736315341da47497cb02de7 100644 (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();
 }
index 7c73af358cf837b786b13ca05f4fe7405048e404..cda1363d57421e1bf65a8600b81f105925ee2209 100644 (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;
 
index a5a409dc117bfd3c5c3f527d4de88e826dabd67e..7110c394c9caf68e723f7125cd865ac852ba2c89 100644 (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: