Browse Source

Merge pull request 'Beta-8 fixes (3)' (#372) from tobtoht/feather:beta-8-fixes-3 into master

Reviewed-on: feather/feather#372
build_fixes
tobtoht 5 months ago
parent
commit
a88425eb60
  1. 13
      src/ContactsWidget.cpp
  2. 24
      src/MainWindow.cpp
  3. 1
      src/MainWindow.h
  4. 1
      src/assets/nodes.json
  5. 30
      src/dialog/TxInfoDialog.cpp
  6. 4
      src/model/AddressBookModel.h
  7. 5
      src/qrcode_scanner/QrCodeScanDialog.cpp

13
src/ContactsWidget.cpp

@ -24,8 +24,8 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
ui->contacts->setModel(m_proxyModel);
ui->contacts->setSortingEnabled(true);
ui->contacts->header()->setSectionResizeMode(AddressBookModel::Address, QHeaderView::Stretch);
ui->contacts->header()->setSectionResizeMode(AddressBookModel::Description, QHeaderView::ResizeToContents);
ui->contacts->header()->setSectionResizeMode(AddressBookModel::Address, QHeaderView::ResizeToContents);
ui->contacts->header()->setSectionResizeMode(AddressBookModel::Description, QHeaderView::Stretch);
ui->contacts->header()->setMinimumSectionSize(200);
// header context menu
@ -36,6 +36,12 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
connect(ui->contacts->header(), &QHeaderView::customContextMenuRequested, this, &ContactsWidget::showHeaderMenu);
connect(ui->contacts, &QTreeView::doubleClicked, [this](QModelIndex index){
if (!(m_model->flags(index) & Qt::ItemIsEditable)) {
this->payTo();
}
});
// context menu
ui->contacts->setContextMenuPolicy(Qt::CustomContextMenu);
m_contextMenu = new QMenu(ui->contacts);
@ -45,8 +51,7 @@ ContactsWidget::ContactsWidget(QSharedPointer<AppContext> ctx, QWidget *parent)
// row context menu
m_rowMenu = new QMenu(ui->contacts);
m_rowMenu->addAction(icons()->icon("copy.png"), "Copy address", this, &ContactsWidget::copyAddress);
m_rowMenu->addAction(icons()->icon("copy.png"), "Copy name", this, &ContactsWidget::copyName);
m_rowMenu->addAction("Copy address", this, &ContactsWidget::copyAddress);
m_rowMenu->addAction("Pay to", this, &ContactsWidget::payTo);
m_rowMenu->addAction("Delete", this, &ContactsWidget::deleteContact);

24
src/MainWindow.cpp

@ -701,6 +701,10 @@ void MainWindow::showSeedDialog() {
return;
}
if (!this->verifyPassword()) {
return;
}
SeedDialog dialog{m_ctx, this};
dialog.exec();
}
@ -772,6 +776,10 @@ void MainWindow::showRestoreHeightDialog() {
}
void MainWindow::showKeysDialog() {
if (!this->verifyPassword()) {
return;
}
KeysDialog dialog{m_ctx, this};
dialog.exec();
}
@ -1557,6 +1565,22 @@ void MainWindow::updateRecentlyOpenedMenu() {
ui->menuRecently_open->addAction(m_clearRecentlyOpenAction);
}
bool MainWindow::verifyPassword() {
bool ok;
while (true) {
QString password = QInputDialog::getText(this, "Enter password", "Please enter your password:", QLineEdit::EchoMode::Password, "", &ok);
if (!ok) { // Dialog cancelled
return false;
}
if (password != m_ctx->wallet->getPassword()) {
QMessageBox::warning(this, "Error", "Incorrect password");
continue;
}
break;
}
return true;
}
void MainWindow::toggleSearchbar(bool visible) {
config()->set(Config::showSearchbar, visible);

1
src/MainWindow.h

@ -212,6 +212,7 @@ private:
void addToRecentlyOpened(const QString &filename);
void updateRecentlyOpenedMenu();
void updateWidgetIcons();
bool verifyPassword();
QIcon hardwareDevicePairedIcon();
QIcon hardwareDeviceUnpairedIcon();

1
src/assets/nodes.json

@ -14,6 +14,7 @@
"node-1.sethsimmons.me:18089",
"selsta1.featherwallet.net:18081",
"selsta2.featherwallet.net:18081",
"node.monerooutreach.org:18081",
"xmr-node-eu.cakewallet.com:18081",
"xmr-node-usa-east.cakewallet.com:18081",
"canada.node.xmr.pm:18089",

30
src/dialog/TxInfoDialog.cpp

@ -43,21 +43,21 @@ TxInfoDialog::TxInfoDialog(QSharedPointer<AppContext> ctx, TransactionInfo *txIn
} else {
ui->btn_rebroadcastTx->hide();
}
if (txInfo->direction() == TransactionInfo::Direction_Out) {
// TODO: this will not properly represent coinjoin-like transactions.
QVector<CoinsInfo*> coins = m_ctx->wallet->coins()->coins_from_txid(m_txid);
QTextCursor c_i = ui->inputs->textCursor();
QString inputs_str;
for (const auto &coin : coins) {
inputs_str += QString("%1 %2\n").arg(coin->pubKey(), coin->displayAmount());
}
ui->inputs->setText(inputs_str);
ui->label_inputs->setText(QString("Inputs (%1)").arg(QString::number(coins.size())));
this->adjustHeight(ui->inputs, coins.size());
} else {
ui->frameInputs->hide();
}
//
// if (txInfo->direction() == TransactionInfo::Direction_Out) {
// // TODO: this will not properly represent coinjoin-like transactions.
// QVector<CoinsInfo*> coins = m_ctx->wallet->coins()->coins_from_txid(m_txid);
// QTextCursor c_i = ui->inputs->textCursor();
// QString inputs_str;
// for (const auto &coin : coins) {
// inputs_str += QString("%1 %2\n").arg(coin->pubKey(), coin->displayAmount());
// }
// ui->inputs->setText(inputs_str);
// ui->label_inputs->setText(QString("Inputs (%1)").arg(QString::number(coins.size())));
// this->adjustHeight(ui->inputs, coins.size());
// } else {
ui->frameInputs->hide();
// }
QTextCursor cursor = ui->outputs->textCursor();

4
src/model/AddressBookModel.h

@ -16,8 +16,8 @@ class AddressBookModel : public QAbstractTableModel
public:
enum ModelColumn
{
Address = 0,
Description,
Description = 0,
Address,
COUNT
};

5
src/qrcode_scanner/QrCodeScanDialog.cpp

@ -22,10 +22,15 @@ QrCodeScanDialog::QrCodeScanDialog(QWidget *parent)
if (m_cameras.count() < 1) {
QMessageBox::warning(parent, "QR code scanner", "No available cameras found.");
this->close();
return;
}
for (const auto &camera : m_cameras) {
#ifdef Q_OS_WIN
ui->combo_camera->addItem(camera.description());
#else
ui->combo_camera->addItem(camera.deviceName());
#endif
}
connect(ui->combo_camera, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &QrCodeScanDialog::onCameraSwitched);

Loading…
Cancel
Save