tdf#130857 uui: Move showing warning dialog out of PasswordDialog ctor
Move logic to show a warning dialog that the (previously entered) password was incorrect from the PasswordDialog ctor to the executePasswordDialog function which calls the ctor. As the dialog is meant to be shown before the PasswordDialog, there is no reason to have the logic in the ctor, and (while the underlying issue is potentially a Qt bug) this helps avoid the problem described in previous commit Change-Id: I9d1ffeaf48380aa4849e3cb771f6ff517d588790 Author: Michael Weghorn <m.weghorn@posteo.de> Date: Mon Apr 7 15:23:02 2025 +0200 tdf#130857 qt weld: Support PasswordDialog > When typing an incorrect password and confirming using > the OK button, the dialog is oddly shown as "Set Password" > dialog on top of the warning dialog ("The password is incorrect. > The file cannot be opened.") when using qt6, which is not the > case for qt5. > This will be addressed in a separate commit. which is somehow caused by both dialogs using the same parent. (It wouldn't occur e.g. when not setting a parent for one of them.) Change-Id: Iba10d44294c5c94f3fb7f8ce7aaf9135d1113736 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183796 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -531,6 +531,19 @@ executePasswordDialog(
|
||||
}
|
||||
else // enter password or reenter password
|
||||
{
|
||||
if (nMode == task::PasswordRequestMode_PASSWORD_REENTER)
|
||||
{
|
||||
TranslateId pOpenToModifyErrStrId = bIsPasswordToModify
|
||||
? STR_ERROR_PASSWORD_TO_MODIFY_WRONG
|
||||
: STR_ERROR_PASSWORD_TO_OPEN_WRONG;
|
||||
TranslateId pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG
|
||||
: pOpenToModifyErrStrId;
|
||||
OUString aErrorMsg(Translate::get(pErrStrId, aResLocale));
|
||||
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(
|
||||
pParent, VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg));
|
||||
xBox->run();
|
||||
}
|
||||
|
||||
std::unique_ptr<PasswordDialog> xDialog(new PasswordDialog(pParent, nMode,
|
||||
aResLocale, aDocName, bIsPasswordToModify, bIsSimplePasswordRequest));
|
||||
xDialog->SetMinLen(0);
|
||||
|
@@ -45,16 +45,6 @@ PasswordDialog::PasswordDialog(weld::Window* pParent,
|
||||
// tdf#115964 we can be launched before the parent has resized to its final size
|
||||
m_xDialog->set_centered_on_parent(true);
|
||||
|
||||
if( nDialogMode == task::PasswordRequestMode_PASSWORD_REENTER )
|
||||
{
|
||||
TranslateId pOpenToModifyErrStrId = bOpenToModify ? STR_ERROR_PASSWORD_TO_MODIFY_WRONG : STR_ERROR_PASSWORD_TO_OPEN_WRONG;
|
||||
TranslateId pErrStrId = bIsSimplePasswordRequest ? STR_ERROR_SIMPLE_PASSWORD_WRONG : pOpenToModifyErrStrId;
|
||||
OUString aErrorMsg(Translate::get(pErrStrId, rResLocale));
|
||||
std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
|
||||
VclMessageType::Warning, VclButtonsType::Ok, aErrorMsg));
|
||||
xBox->run();
|
||||
}
|
||||
|
||||
m_xPass[0] = m_xBuilder->weld_toggle_button(u"togglebt1"_ustr);
|
||||
m_xPass[1] = m_xBuilder->weld_toggle_button(u"togglebt2"_ustr);
|
||||
|
||||
|
Reference in New Issue
Block a user