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

Clicking "No" or "Cancel" on pfd::message pfd::choice::yes_no_cancel returns pfd::button::ok on Linux KDE and pfd::message freezes the application #92

Open
OfficialKrisHass opened this issue Aug 27, 2023 · 2 comments

Comments

@OfficialKrisHass
Copy link

` auto m = pfd::message(title, description, pfd::choice::yes_no_cancel, pfd::icon::warning);
pfd::button btn = m.result();
Log((int32_t) btn);

    switch(btn) {

        case pfd::button::yes: return PopupResult::Yes;
        case pfd::button::no: return PopupResult::No;
        case pfd::button::cancel: return PopupResult::Cancel;
        default: return PopupResult::Invalid;

    }`

This code returns PopupResult::Invalid when clicking on the button "No" or "Cancel", and the Log((int32_t) btn); prints 0 into the console on both cases, which is equal to pfd::button::ok. But prints 1 (pfd::button::yes) when pressing the button "Yes".

Also, when this code runs, it freezes the application (the title of the window says "Not Responding") and after a few seconds it shows me a dialog saying "This application is not responding, do you wish to terminate it or keep waiting ?".

I am running on Manjaro KDE, and using kdialog.

@OfficialKrisHass
Copy link
Author

Also I did some digging and found that inside pfd::message::result "ret" is always empty, and m_mappings[exit_code] is pfd::button::no. When I press "Yes", exit_code is equal to 0 and m_mappings[exit_code] is equal to pfd::button::yes (1). When I press "No" exit_code is 1, m_mappings[exit_code] is pfd::button::ok (0) and when I press "Cancel" exit_code is 2, but m_mappings[exit_code] is pfd::button::ok (0).

samangh added a commit to samangh/portable-file-dialogs that referenced this issue Mar 11, 2024
@samangh
Copy link

samangh commented Mar 11, 2024

@OfficialKrisHass in case you are interested, I've fixed this in my fork.

@samhocevar let me know if you would like a pull request for this.

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

No branches or pull requests

2 participants