Set button on QMessageBox before changing the text

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
This commit is contained in:
Felix Weilbach 2021-05-21 13:31:27 +02:00 committed by Matthieu Gallien (Rebase PR Action)
parent ba5f517417
commit 03610cb706

View File

@ -88,10 +88,14 @@ bool showEnableE2eeWithVirtualFilesWarningDialog()
" End-to-End Encryption, make sure the encrypted folder is marked with"
" \"Make always available locally\"."));
e2eeWithVirtualFilesWarningMsgBox.setIcon(QMessageBox::Warning);
const auto dontEncryptButton = e2eeWithVirtualFilesWarningMsgBox.button(QMessageBox::StandardButton::Ok);
const auto encryptButton = e2eeWithVirtualFilesWarningMsgBox.button(QMessageBox::StandardButton::Cancel);
const auto dontEncryptButton = e2eeWithVirtualFilesWarningMsgBox.addButton(QMessageBox::StandardButton::Ok);
Q_ASSERT(dontEncryptButton);
dontEncryptButton->setText(AccountSettings::tr("Don't encrypt folder"));
const auto encryptButton = e2eeWithVirtualFilesWarningMsgBox.addButton(QMessageBox::StandardButton::Cancel);
Q_ASSERT(encryptButton);
encryptButton->setText(AccountSettings::tr("Encrypt folder"));
e2eeWithVirtualFilesWarningMsgBox.exec();
return e2eeWithVirtualFilesWarningMsgBox.clickedButton() != dontEncryptButton;
}