mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-17 01:37:53 +00:00
Tools: add address checker
This commit is contained in:
parent
b3669c5a95
commit
75fe3e6614
3 changed files with 31 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "ui_MainWindow.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QInputDialog>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include "config-feather.h"
|
||||
|
@ -305,6 +306,7 @@ void MainWindow::initMenu() {
|
|||
connect(ui->actionLoadSignedTxFromText, &QAction::triggered, this, &MainWindow::loadSignedTxFromText);
|
||||
connect(ui->actionImport_transaction, &QAction::triggered, this, &MainWindow::importTransaction);
|
||||
connect(ui->actionPay_to_many, &QAction::triggered, this, &MainWindow::payToMany);
|
||||
connect(ui->actionAddress_checker, &QAction::triggered, this, &MainWindow::showAddressChecker);
|
||||
connect(ui->actionCalculator, &QAction::triggered, this, &MainWindow::showCalcWindow);
|
||||
connect(ui->actionCreateDesktopEntry, &QAction::triggered, this, &MainWindow::onCreateDesktopEntry);
|
||||
|
||||
|
@ -967,6 +969,27 @@ void MainWindow::showAccountSwitcherDialog() {
|
|||
dialog.exec();
|
||||
}
|
||||
|
||||
void MainWindow::showAddressChecker() {
|
||||
QString address = QInputDialog::getText(this, "Address Checker", "Address: ");
|
||||
if (address.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!WalletManager::addressValid(address, constants::networkType)) {
|
||||
QMessageBox::warning(this, "Address Checker", "Invalid address.");
|
||||
return;
|
||||
}
|
||||
|
||||
SubaddressIndex index = m_ctx->wallet->subaddressIndex(address);
|
||||
if (!index.isValid()) {
|
||||
// TODO: probably mention lookahead here
|
||||
QMessageBox::warning(this, "Address Checker", "This address does not belong to this wallet.");
|
||||
return;
|
||||
} else {
|
||||
QMessageBox::information(this, "Address Checker", QString("This address belongs to Account #%1").arg(index.major));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::showNodeExhaustedMessage() {
|
||||
// Spawning dialogs inside a lambda can cause system freezes on linux so we have to do it this way ¯\_(ツ)_/¯
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ private slots:
|
|||
void showViewOnlyDialog();
|
||||
void showWalletCacheDebugDialog();
|
||||
void showAccountSwitcherDialog();
|
||||
void showAddressChecker();
|
||||
|
||||
void donateButtonClicked();
|
||||
void showCalcWindow();
|
||||
|
|
|
@ -352,7 +352,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>977</width>
|
||||
<height>28</height>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
@ -455,6 +455,7 @@
|
|||
<addaction name="actionImport_transaction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionPay_to_many"/>
|
||||
<addaction name="actionAddress_checker"/>
|
||||
<addaction name="actionCalculator"/>
|
||||
<addaction name="actionCreateDesktopEntry"/>
|
||||
</widget>
|
||||
|
@ -797,6 +798,11 @@
|
|||
<string>Show Searchbar</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAddress_checker">
|
||||
<property name="text">
|
||||
<string>Address checker</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
|
|
Loading…
Reference in a new issue