Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make 'No' button default in Unknown Certificate dialog #11540

Merged
merged 1 commit into from
Mar 15, 2024

Conversation

erikjv
Copy link
Collaborator

@erikjv erikjv commented Mar 11, 2024

Fixes: #11531

@erikjv erikjv requested a review from TheOneRing March 11, 2024 10:38
@erikjv erikjv self-assigned this Mar 11, 2024
@TheOneRing
Copy link
Contributor

The ui tests have multiple crashes in the tls dialog, please have a look.

@TheOneRing TheOneRing added this to the Desktop 6.0 milestone Mar 12, 2024
Copy link
Contributor

@TheOneRing TheOneRing left a comment

Choose a reason for hiding this comment

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

^

@erikjv erikjv force-pushed the work/default-no-button branch from 3e35089 to f0c7f3e Compare March 15, 2024 14:28
@erikjv erikjv requested a review from TheOneRing March 15, 2024 15:18

// Try to set the No-button (the reject button) as the default
if (QPushButton *noButton = _ui->buttonBox->button(QDialogButtonBox::No)) {
Q_ASSERT(_ui->buttonBox->buttonRole(noButton) == QDialogButtonBox::RejectRole || _ui->buttonBox->buttonRole(noButton) == QDialogButtonBox::NoRole);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm according to https://doc.qt.io/qt-6/qdialogbuttonbox.html#ButtonRole-enum it is supposed to always be NoRole?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But how can clicking the "No" button then reject the dialog?

Copy link
Collaborator Author

@erikjv erikjv Mar 15, 2024

Choose a reason for hiding this comment

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

ah, in QDialogButtonBoxPrivate::_q_handleButtonClicked():

        case QPlatformDialogHelper::RejectRole:
        case QPlatformDialogHelper::NoRole:
            emit q->rejected();
            break;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I removed the assert, it's superfluous to check the NoRole on the "No" button.

@erikjv erikjv force-pushed the work/default-no-button branch from f0c7f3e to a5763ec Compare March 15, 2024 16:33
@erikjv erikjv requested a review from TheOneRing March 15, 2024 16:35
@TheOneRing TheOneRing merged commit 0dad3ff into master Mar 15, 2024
6 of 7 checks passed
@delete-merged-branch delete-merged-branch bot deleted the work/default-no-button branch March 15, 2024 17:46
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.

Select 'No' button by default in the unknown certificate dialog, and show the dialog above the main window
2 participants