diff --git a/src/qt/forms/managenamespage.ui b/src/qt/forms/managenamespage.ui
index c006f0e2d7..7a23d9082b 100644
--- a/src/qt/forms/managenamespage.ui
+++ b/src/qt/forms/managenamespage.ui
@@ -161,7 +161,7 @@ to the network and creates a pending name_firstupdate transaction.
true
- QAbstractItemView::SingleSelection
+ QAbstractItemView::ExtendedSelection
QAbstractItemView::SelectRows
diff --git a/src/qt/managenamespage.cpp b/src/qt/managenamespage.cpp
index 41cb825b88..1db3edda10 100644
--- a/src/qt/managenamespage.cpp
+++ b/src/qt/managenamespage.cpp
@@ -24,15 +24,18 @@ ManageNamesPage::ManageNamesPage(const PlatformStyle *platformStyle, QWidget *pa
// Context menu actions
QAction *copyNameAction = new QAction(tr("Copy &Name"), this);
QAction *copyValueAction = new QAction(tr("Copy &Value"), this);
+ QAction *renewNameAction = new QAction(tr("&Renew Names"), this);
// Build context menu
contextMenu = new QMenu();
contextMenu->addAction(copyNameAction);
contextMenu->addAction(copyValueAction);
+ contextMenu->addAction(renewNameAction);
// Connect signals for context menu actions
connect(copyNameAction, &QAction::triggered, this, &ManageNamesPage::onCopyNameAction);
connect(copyValueAction, &QAction::triggered, this, &ManageNamesPage::onCopyValueAction);
+ connect(renewNameAction, &QAction::triggered, this, &ManageNamesPage::onRenewNameAction);
connect(ui->tableView, &QTableView::customContextMenuRequested, this, &ManageNamesPage::contextualMenu);
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
@@ -98,6 +101,54 @@ void ManageNamesPage::onCopyValueAction()
GUIUtil::copyEntryData(ui->tableView, NameTableModel::Value);
}
+void ManageNamesPage::onRenewNameAction()
+{
+ QModelIndexList indexes = GUIUtil::getEntryData(ui->tableView, NameTableModel::Name);
+
+ if (indexes.isEmpty())
+ return;
+
+ QString msg;
+ QString title;
+
+ if (indexes.size() == 1)
+ {
+ const QString &name = indexes.at(0).data(Qt::EditRole).toString();
+
+ msg = tr ("Are you sure you want to renew the name %1?")
+ .arg (GUIUtil::HtmlEscape (name));
+ title = tr ("Confirm name renewal");
+ }
+ else
+ {
+ msg = tr ("Are you sure you want to renew multiple names simultaneously? This will reveal common ownership of the renewed names (bad for anonymity).");
+ title = tr ("Confirm multiple name renewal");
+ }
+
+ QMessageBox::StandardButton res;
+ res = QMessageBox::question (this, title, msg,
+ QMessageBox::Yes | QMessageBox::Cancel,
+ QMessageBox::Cancel);
+ if (res != QMessageBox::Yes)
+ return;
+
+ WalletModel::UnlockContext ctx(walletModel->requestUnlock ());
+ if (!ctx.isValid ())
+ return;
+
+ for (QModelIndexList::iterator i = indexes.begin(); i != indexes.end(); i++)
+ {
+ const QString &name = i->data(Qt::EditRole).toString();
+
+ const QString err_msg = model->renew(name);
+ if (!err_msg.isEmpty() && err_msg != "ABORTED")
+ {
+ QMessageBox::critical(this, tr("Name renew error"), err_msg);
+ return;
+ }
+ }
+}
+
void ManageNamesPage::exportClicked()
{
// CSV is currently the only supported format
diff --git a/src/qt/managenamespage.h b/src/qt/managenamespage.h
index 3079dbdb22..f9127c7260 100644
--- a/src/qt/managenamespage.h
+++ b/src/qt/managenamespage.h
@@ -51,6 +51,7 @@ private Q_SLOTS:
void onCopyNameAction();
void onCopyValueAction();
+ void onRenewNameAction();
};
#endif // MANAGENAMESPAGE_H
diff --git a/src/qt/nametablemodel.cpp b/src/qt/nametablemodel.cpp
index 45df585e9f..37708c1e00 100644
--- a/src/qt/nametablemodel.cpp
+++ b/src/qt/nametablemodel.cpp
@@ -270,3 +270,26 @@ NameTableModel::emitDataChanged(int idx)
//emit
dataChanged(index(idx, 0), index(idx, columns.length()-1));
}
+
+QString NameTableModel::renew(const QString &name) const
+{
+ std::string strName = name.toStdString();
+ LogPrintf ("wallet attempting name_update: name=%s\n", strName);
+
+ UniValue params(UniValue::VOBJ);
+ params.pushKV ("name", strName);
+
+ std::string walletURI = ("/wallet/" + walletModel->getWalletName()).toStdString();
+
+ UniValue res;
+ try {
+ res = walletModel->node().executeRpc("name_update", params, walletURI);
+ }
+ catch (const UniValue& e) {
+ UniValue message = find_value( e, "message");
+ std::string errorStr = message.get_str();
+ LogPrintf ("name_update error: %s\n", errorStr);
+ return QString::fromStdString(errorStr);
+ }
+ return tr ("");
+}
diff --git a/src/qt/nametablemodel.h b/src/qt/nametablemodel.h
index 976d7ee20f..36ed68fa44 100644
--- a/src/qt/nametablemodel.h
+++ b/src/qt/nametablemodel.h
@@ -49,6 +49,8 @@ class NameTableModel : public QAbstractTableModel
Qt::ItemFlags flags(const QModelIndex &index) const;
/*@}*/
+ QString renew(const QString &name) const;
+
private:
WalletModel *walletModel;
std::unique_ptr m_handler_transaction_changed;