Commit c2ea0afb authored by David Edmundson's avatar David Edmundson

Fallback to in-process prompt if logout prompt fails

Summary:
KSmserver is currently very heavily tied to the shutdown prompt dialog.
On upgrades a user ends up in a situation where they have an old
ksmserver running but a newer shutdown dialog. This has caused issues
repeatedly in the past.

I want to make some changes to how the shutdown prompt is shown for
5.15. First step is making the old releases more robust.

Prompt looks ugly but a user will only see it at most once. Hopefully
never.

Test Plan:
rm'd the greeter
Got an ugly messagebox instead of nothing

Reviewers: #plasma, broulik, ngraham

Reviewed By: #plasma, broulik

Subscribers: ngraham, broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15869
parent 69dcd548
......@@ -215,9 +215,36 @@ void KSMServer::shutdown( KWorkSpace::ShutdownConfirm confirm,
const int resultPipe = pipeFds[0];
connect(p, static_cast<void (QProcess::*)(QProcess::ProcessError)>(&QProcess::error), this,
[this, resultPipe] {
[this, resultPipe, sdmode, sdtype] {
close(resultPipe);
dialogActive = false;
auto fallbackPrompt = new QMessageBox;
fallbackPrompt->setAttribute(Qt::WA_DeleteOnClose, true);
fallbackPrompt->setStandardButtons(QMessageBox::Ok | QMessageBox::Cancel);
switch (sdtype) {
case KWorkSpace::ShutdownTypeHalt:
//i18nd is used as this patch was backported to an LTS with stable translations
fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Shutdown"));
break;
case KWorkSpace::ShutdownTypeReboot:
fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Reboot"));
break;
case KWorkSpace::ShutdownTypeNone:
Q_FALLTHROUGH();
default:
fallbackPrompt->setText(i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Logout"));
break;
}
connect(fallbackPrompt, &QMessageBox::buttonClicked, this, [=](QAbstractButton *button) {
if (button != fallbackPrompt->button(QMessageBox::Ok)) {
return;
}
shutdownType = sdtype;
shutdownMode = sdmode;
bootOption = QString();
performLogout();
});
fallbackPrompt->show();
}
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment