Android: Make enum parsing readable

Fix tr() messages so that they don't contain newlines.

Change-Id: I705e56796393501da1a2917adb6673a24c1cbcf6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Jarek Kobus
2024-05-17 11:44:11 +02:00
parent 0db878c2f8
commit 3380c3f968

View File

@@ -444,35 +444,21 @@ void AndroidDeployQtStep::slotAskForUninstall(DeployErrorCode errorCode)
{ {
Q_ASSERT(errorCode > 0); Q_ASSERT(errorCode > 0);
QString uninstallMsg = Tr::tr("Deployment failed with the following errors:\n\n"); QString uninstallMsg = Tr::tr("Deployment failed with the following errors:") + "\n\n";
uint errorCodeFlags = errorCode; if (errorCode & InconsistentCertificates)
uint mask = 1; uninstallMsg += InstallFailedInconsistentCertificatesString + '\n';
while (errorCodeFlags) { if (errorCode & UpdateIncompatible)
switch (errorCodeFlags & mask) { uninstallMsg += InstallFailedUpdateIncompatible + '\n';
case DeployErrorCode::PermissionModelDowngrade: if (errorCode & PermissionModelDowngrade)
uninstallMsg += InstallFailedPermissionModelDowngrade+"\n"; uninstallMsg += InstallFailedPermissionModelDowngrade + '\n';
break; if (errorCode & VersionDowngrade)
case InconsistentCertificates: uninstallMsg += InstallFailedVersionDowngrade + '\n';
uninstallMsg += InstallFailedInconsistentCertificatesString+"\n"; uninstallMsg += '\n';
break; uninstallMsg.append(Tr::tr("Uninstalling the installed package may solve the issue.") + '\n');
case UpdateIncompatible: uninstallMsg.append(Tr::tr("Do you want to uninstall the existing package?"));
uninstallMsg += InstallFailedUpdateIncompatible+"\n";
break;
case VersionDowngrade:
uninstallMsg += InstallFailedVersionDowngrade+"\n";
break;
default:
break;
}
errorCodeFlags &= ~mask;
mask <<= 1;
}
uninstallMsg.append(Tr::tr("\nUninstalling the installed package may solve the issue.\n" m_askForUninstall = QMessageBox::critical(nullptr, Tr::tr("Install failed"), uninstallMsg,
"Do you want to uninstall the existing package?")); QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes;
int button = QMessageBox::critical(nullptr, Tr::tr("Install failed"), uninstallMsg,
QMessageBox::Yes, QMessageBox::No);
m_askForUninstall = button == QMessageBox::Yes;
} }
// TODO: This implementation is not thread safe. // TODO: This implementation is not thread safe.