Skip to content

fix(qt): add non-native file dialog option#7309

Draft
thepastaclaw wants to merge 1 commit intodashpay:developfrom
thepastaclaw:fix/file-dialog-nonnative-option
Draft

fix(qt): add non-native file dialog option#7309
thepastaclaw wants to merge 1 commit intodashpay:developfrom
thepastaclaw:fix/file-dialog-nonnative-option

Conversation

@thepastaclaw
Copy link
Copy Markdown

PR Body

Summary

  • Add a -nativefiledialogs GUI option.
  • Default remains the existing native-dialog behavior.
  • With -nativefiledialogs=0, central save/open dialogs use Qt dialogs.
  • Route the data-directory chooser through the same GUIUtil wrapper.

Fixes #6935.

Motivation

Some Linux desktop environments can hang or freeze in native Qt file dialogs
before Dash reaches the export or wallet-backup code paths.

This keeps the default UX unchanged while adding a narrow escape hatch for
affected users.

Validation

  • git diff --check upstream/develop...HEAD
  • code-review dashpay/dash upstream/develop fix/file-dialog-nonnative-option
    returned ship
  • Reviewed all changed files.
  • Confirmed current static QFileDialog save/open/directory call sites under
    src/qt route through GUIUtil on this branch.

No GUI runtime test was run in this macOS worktree. The reported freeze requires
an affected Linux/KDE/native-dialog environment to reproduce.

@thepastaclaw
Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@thepastaclaw
Copy link
Copy Markdown
Author

thepastaclaw commented May 7, 2026

🕓 Ready for review — 2 ahead in queue (commit e1c4012)
Queue position: 3/84

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 7, 2026

Review Change Stack

Walkthrough

This PR introduces a new -nativefiledialogs CLI option (defaulting to true) that controls whether Qt file dialogs use the native system dialogs or the non-native fallback. A centralized GetFileDialogOptions() helper function reads this option and returns the appropriate Qt file dialog flags. This helper is applied to three file dialog functions: the existing getSaveFileName() and getOpenFileName() wrappers, and a new getExistingDirectory() wrapper. The data directory selector in the intro screen is updated to use the new wrapper instead of calling Qt directly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a non-native file dialog option to the Qt GUI.
Description check ✅ Passed The description is well-structured, explaining the motivation, changes, and validation. It directly relates to the changeset and issue being addressed.
Linked Issues check ✅ Passed The code changes fully address issue #6935 by providing an escape hatch to disable native file dialogs that freeze on affected Linux/KDE systems, matching the reported problem.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the non-native file dialog option and routing relevant dialog calls through the GUIUtil wrapper, with no extraneous modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/qt/intro.cpp`:
- Line 328: The call to GUIUtil::getExistingDirectory in
on_ellipsisButton_clicked uses a bare string and nullptr parent; wrap the
caption in tr() and pass the Intro widget as the parent instead of nullptr.
Update the invocation of GUIUtil::getExistingDirectory(nullptr, "Choose data
directory", ui->dataDirectory->text()) to use tr("Choose data directory") for
translation and use this (the Intro/QWidget instance) as the parent so the file
chooser is localized and properly parented to the Intro dialog.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0521312b-907f-4b6d-8ac1-9d711b04bc65

📥 Commits

Reviewing files that changed from the base of the PR and between 5fd84aa and 0639e13.

📒 Files selected for processing (4)
  • src/qt/bitcoin.cpp
  • src/qt/guiutil.cpp
  • src/qt/guiutil.h
  • src/qt/intro.cpp

Comment thread src/qt/intro.cpp Outdated
@thepastaclaw thepastaclaw force-pushed the fix/file-dialog-nonnative-option branch 2 times, most recently from f9c8fe4 to d0de36d Compare May 7, 2026 11:29
@thepastaclaw
Copy link
Copy Markdown
Author

The remaining red linux64-test failure is feature_asset_locks.py timing out while waiting for an llmq_test_platform quorum. This is unrelated to this PR’s Qt-only diff and is now tracked separately in #7310.

Copy link
Copy Markdown
Author

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Small Qt GUI change adding -nativefiledialogs (default true) to opt out of native file dialogs on desktop environments where they hang. The wrapper plumbing is consistent and the default preserves existing behavior. Codex found no issues; only one minor maintainability nit retained.

Reviewed commit: e1c4012

💬 1 nitpick(s)

Comment thread src/qt/guiutil.cpp
Comment on lines +500 to +505
static QFileDialog::Options GetFileDialogOptions()
{
return gArgs.GetBoolArg("-nativefiledialogs", /*fDefault=*/true)
? QFileDialog::Options()
: QFileDialog::Options(QFileDialog::DontUseNativeDialog);
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 Nitpick: Default value for -nativefiledialogs is duplicated

The default true is hardcoded in two places: in SetupUIArgs at src/qt/bitcoin.cpp:509 (the help text uses strprintf(... %u, true)) and in GetFileDialogOptions() at src/qt/guiutil.cpp:502 (gArgs.GetBoolArg("-nativefiledialogs", /*fDefault=*/true)). If the default ever changes, both sites must be updated in lock-step. Hoisting a static constexpr bool DEFAULT_NATIVE_FILE_DIALOGS = true; (alongside DEFAULT_SPLASHSCREEN / similar) and reusing it in both locations would single-source the value. Not a correctness issue — the surrounding code (e.g. -splash two lines below) follows the same %u + bool pattern, so this is consistent with existing style.

source: ['claude']

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No transaction export/No backup function

1 participant