| 539 | } |
| 540 | |
| 541 | void SendCoinsDialog::processSendCoinsReturn(const WalletModel::SendCoinsReturn &sendCoinsReturn, const QString &msgArg) |
| 542 | { |
| 543 | QPair<QString, CClientUIInterface::MessageBoxFlags> msgParams; |
| 544 | // Default to a warning message, override if error message is needed |
| 545 | msgParams.second = CClientUIInterface::MSG_WARNING; |
| 546 | |
| 547 | // This comment is specific to SendCoinsDialog usage of WalletModel::SendCoinsReturn. |
| 548 | // WalletModel::TransactionCommitFailed is used only in WalletModel::sendCoins() |
| 549 | // all others are used only in WalletModel::prepareTransaction() |
| 550 | switch(sendCoinsReturn.status) |
| 551 | { |
| 552 | case WalletModel::InvalidAddress: |
| 553 | msgParams.first = tr("The recipient address is not valid. Please recheck."); |
| 554 | break; |
| 555 | case WalletModel::InvalidAmount: |
| 556 | msgParams.first = tr("The amount to pay must be larger than 0."); |
| 557 | break; |
| 558 | case WalletModel::AmountExceedsBalance: |
| 559 | msgParams.first = tr("The amount exceeds your balance."); |
| 560 | break; |
| 561 | case WalletModel::AmountWithFeeExceedsBalance: |
| 562 | msgParams.first = tr("The total exceeds your balance when the %1 transaction fee is included.").arg(msgArg); |
| 563 | break; |
| 564 | case WalletModel::DuplicateAddress: |
| 565 | msgParams.first = tr("Duplicate address found: addresses should only be used once each."); |
| 566 | break; |
| 567 | case WalletModel::TransactionCreationFailed: |
| 568 | msgParams.first = tr("Transaction creation failed!"); |
| 569 | msgParams.second = CClientUIInterface::MSG_ERROR; |
| 570 | break; |
| 571 | case WalletModel::TransactionCommitFailed: |
| 572 | msgParams.first = tr("The transaction was rejected with the following reason: %1").arg(sendCoinsReturn.reasonCommitFailed); |
| 573 | msgParams.second = CClientUIInterface::MSG_ERROR; |
| 574 | break; |
| 575 | case WalletModel::AbsurdFee: |
| 576 | msgParams.first = tr("A fee higher than %1 is considered an absurdly high fee.").arg(BitcoinUnits::formatWithUnit(model->getOptionsModel()->getDisplayUnit(), model->node().getMaxTxFee())); |
| 577 | break; |
| 578 | case WalletModel::PaymentRequestExpired: |
| 579 | msgParams.first = tr("Payment request expired."); |
| 580 | msgParams.second = CClientUIInterface::MSG_ERROR; |
| 581 | break; |
| 582 | // included to prevent a compiler warning. |
| 583 | case WalletModel::OK: |
| 584 | default: |
| 585 | return; |
| 586 | } |
| 587 | |
| 588 | Q_EMIT message(tr("Send Coins"), msgParams.first, msgParams.second); |
| 589 | } |
| 590 | |
| 591 | void SendCoinsDialog::minimizeFeeSection(bool fMinimize) |
| 592 | { |
nothing calls this directly
no test coverage detected