qml: Handle payment URIs passed on the command line

bitcoin-core/gui-qml: PR #934

3 minor findings · 2 suggestions

Findings

Link

[minor] · An interrupted Apply can fill a draft without completing the queued request

With animations enabled, a wallet switch after Apply but before onClosed can fill the old draft while retaining the request for another review; this timing-dependent behavior was established statically.

Location: qml/pages/wallet/SendCreate.qml:788 (head).

Details and suggested fix

Apply sets accepted = true and starts closing the popup, but SendCreate applies the request only in onClosed. With full motion, the exit transition lasts 250 ms. If another wallet becomes selected during that interval while the old wallet remains loaded, the old WalletView becomes inactive and calls interruptPaymentRequest(). This clears m_incomingPaymentRequest and reports interruption, so MainWindow retains the queue entry. It does not clear the pending parsed result or acceptance. Because the retained view's wallet has not changed, onWalletChanged does not clear them either. The old popup's onClosed therefore still fills its recipient, while the queued request is offered again to the active wallet. Applying that second review can populate a second draft; nothing is signed or broadcast. Clear the pending incoming acceptance when interrupting, so the eventual close callback cannot apply it. Add a regression case that presses Apply before interrupting with motion enabled; the existing interruption tests do not press Apply, and their default motion setting is off.


Link

[minor] · Retrying an interrupted request reverses navigation away from Send

An interrupted review can reopen and force the window back to Send after navigation; the macOS native-menu trigger is inferred from source, not observed.

Location: qml/pages/wallet/DesktopWallets.qml:168 (head).

Details and suggested fix

When navigation hides SendCreate, it reports the request as interrupted and WalletView.pageHidden() closes the review. Its eventual onClosed emits paymentRequestAcceptable, which schedules another delivery. DesktopWallets.canAcceptPaymentUri() checks the Send stack and its popups, but not whether Send is visible, and applyIncomingPaymentUri() always selects WalletView.Send. A native-menu route such as Receive can therefore be immediately reversed once the review closes. The modal QML popup does not disable these menu commands: menuNavigationEnabled checks shell routing readiness, not payment-review state. A wallet selection change likewise makes the retry target the newly active wallet's Send page, without naming that wallet in the review. Switch tabs only for the first delivery, then defer an interrupted request until that wallet's Send page becomes visible again. The request would remain available without requiring Apply or Discard merely to leave Send.


Link

[minor] · Cancelling wallet opening or creation leaves the pending request unannounced

Choosing Open wallet or Create wallet closes the no-wallet notice, but cancelling that flow without loading a wallet leaves the request queued with no notice or Discard action.

Location: qml/pages/MainWindow.qml:405 (head).

Details and suggested fix

announcePendingPaymentUri() sets paymentUriAnnounced, and only a queue change resets it. AlertPopup.trigger() closes the notice before invoking Open wallet or Create wallet. Wallet selection permits cancellation but has no close handler that restores the notice. Wallet creation retries delivery on closure, but with no loaded wallet the retry reaches the still-set announcement guard and returns. The request remains queued and can appear much later when a wallet loads, but nothing meanwhile indicates that it is waiting. On a cancelled wallet-selection or creation handoff, reset the announcement flag and retry delivery so the user can review their options or discard the request.


Optional improvements

Link

[suggestion] · The plain-text default lands after the URI paths that need it

The final tree has the plain-text fix, but introducing it before command-line URI delivery would keep intermediate commits protected and make the existing import-rendering fix independently reviewable and backportable.

Location: qml/controls/CoreText.qml:16 at 7695e5bb8464 (commit) (commit).

Details and suggested fix

f37948a866a055e0b47c4207153ab6ce7dfe3c8a introduces command-line delivery and directly applies non-conflicting requests to the existing recipient rows. 324011f47c523a671c6efbeb0720ef6cfc47d91f then adds a review that displays labels and messages through ValueRow and CoreText before Apply. Through 00ec3cdf2bdd941e412c3d4b756c5562d6ea44f5, CoreText still inherits Text.AutoText. Move the production portion of 7695e5bb8464e7daccef00cbaba20b05ad41d322, which defaults CoreText and PageHeading to plain text, ahead of these delivery commits. This is a series-order concern, not a head defect. Clipboard and file imports already use the affected recipient rows at base, and AddressList already explicitly requests Text.StyledText, so the rendering change can stand alone. The current fix's tests depend on the new review API: adapt a preparatory regression to import markup through the existing clipboard or file path and inspect sendPaymentRequestMessageTextValue, then place the review-specific assertions with the review commit. That preserves coverage without introducing an intermediate test dependency on a popup that does not yet exist.


Link

[suggestion] · New payment-request strings lack translator context

The new alerts, command line source fragment, and rejection message lack the //: context required by doc/translator-comments.md, including explanations of the fragment's reuse and what Discard removes.

Location: qml/pages/MainWindow.qml:151 (head).

Details and suggested fix

Add translator comments to the new strings in MainWindow and the rejection message in SendCreate. In particular, explain that qsTr("command line") appears both in the review's From row and as %1 in the import and rejection messages. Explain that Discard removes the queued payment request, while Open wallet and Create wallet retain it for later review. The nearby ordinary code comments are not translator comments. The policy permits an explicitly requested follow-up, but otherwise these new strings should include their context here; the older uncommented clipboard and file fragments do not supply it.


Coverage details