In KDE4 when the action for the power button was set to shutdown it showed a confirmation dialog. In KDE5 the machine shuts down immediately. This is especially infuriating when there is a power button on the keyboard, and it gets pressed accidentally.
Plasma 5 does too. Please check whether system settings -> startup and shutdown -> desktop session -> confirm logout is checked and output of qdbus local.org_kde_powerdevil then reset this bug status to unconfirmed
Yep, confirm logout is checked. When I try to logout there is a confirmation dialog. When I select shutdown in Kickoff there is a confirmation dialog. When I accidentally press the power button it shuts down immediately.
Please check whether System Settings → Power Management → "When power of button is pressed" is set to "show logout dialog"
Let me see if I understand it correctly. When "System Settings → Power Management → When power button is pressed" is set to "Shut down" it deliberately shuts down immediately. If I want a confirmation dialog, I need to set it to "Prompt log out dialog", and set "Startup and Shutdown" → "Desktop Session" → "Default Leave Option" to "Turn Off Computer". Seems a bit convoluted.
Yes, my Arch Linux (plasma 5.12.4) also turns off my computer immediately if system settings -> startup and shutdown -> desktop session -> confirm logout is checked and System Settings → Power Management → "When power of button is pressed" is set to "Shut down"
It sounds like System Settings → Power Management → "When power of button is pressed" should respect the value of system settings → startup and shutdown → desktop session → "Confirm logout" rather than having its own independent setting.
Then again, I see see the value in it. You might want to have the machine shut down immediately when you trigger this from the UI, but not when you accidentally brush the power button. In fact, that's exactly my personal use case: I uncheck "Confirm logout", but have my laptop's easy-to-accidentally-press power button set to show the confirmation screen rather than immediately turning off the machine. Now that I think about it, it has to stay this way.