Skip to content

Commit

Permalink
fix goto Z-Send tab when wallet is locked and using a URI
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptoForge committed Jun 3, 2024
1 parent 4f836fb commit bb9746c
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
12 changes: 4 additions & 8 deletions src/qt/pirateoceangui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1335,17 +1335,13 @@ bool PirateOceanGUI::eventFilter(QObject *object, QEvent *event)

bool PirateOceanGUI::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
// Automatically open the Z-send tab when receiving a Pirate URI
showNormalIfMinimized();
sleep(1);
showNormalIfMinimized();
gotoZSendCoinsPage();

// URI has to be valid
if (walletFrame && walletFrame->handlePaymentRequest(recipient))
{
//showNormalIfMinimized();
//gotoSendCoinsPage();
// Automatically open the Z-send tab when receiving a Pirate URI
showNormalIfMinimized();
sleep(1);
showNormalIfMinimized();
printf("handlePaymentRequest() - true");
return true;
}
Expand Down
10 changes: 9 additions & 1 deletion src/qt/walletframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,15 @@ bool WalletFrame::handlePaymentRequest(const SendCoinsRecipient &recipient)
if (!walletView)
return false;

return walletView->handlePaymentRequest(recipient);
if (walletView->isLocked()) {
walletView->unlockWallet();
}

if (!walletView->isLocked()) {
return walletView->handlePaymentRequest(recipient);
}

return false;
}

void WalletFrame::showOutOfSyncWarning(bool fShow)
Expand Down
19 changes: 18 additions & 1 deletion src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,12 @@ void WalletView::gotoVerifyMessageTab(QString addr)

bool WalletView::handlePaymentRequest(const SendCoinsRecipient& recipient)
{
return zsendCoinsPage->handlePaymentRequest(recipient);
if (zsendCoinsPage->handlePaymentRequest(recipient)) {
setCurrentWidget(zsendCoinsPage);
zsendCoinsPage->updatePayFromList();
return true;
}
return false;
}

void WalletView::showOutOfSyncWarning(bool fShow)
Expand Down Expand Up @@ -510,6 +515,18 @@ void WalletView::rescan()
walletModel->rescan();
}

bool WalletView::isLocked() {

if(!walletModel)
return true;

if (walletModel->getEncryptionStatus() == WalletModel::Locked) {
return true;
}

return false;
}

void WalletView::encryptWallet(bool status)
{
if(!walletModel)
Expand Down
2 changes: 2 additions & 0 deletions src/qt/walletview.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class WalletView : public QStackedWidget
*/
void setWalletModel(WalletModel *walletModel);

bool isLocked();

bool handlePaymentRequest(const SendCoinsRecipient& recipient);

void showOutOfSyncWarning(bool fShow);
Expand Down

0 comments on commit bb9746c

Please sign in to comment.