Bug 427141 - Unify prompt formatting of KPasswordDialog and KNewPasswordDialog
Summary: Unify prompt formatting of KPasswordDialog and KNewPasswordDialog
Status: REPORTED
Alias: None
Product: kdialog
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Brad Hards
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-30 08:43 UTC by Tristan Miller
Modified: 2020-10-21 16:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tristan Miller 2020-09-30 08:43:43 UTC
The behaviour of KPasswordDialog::setPrompt() and KNewPasswordDialog::setPrompt() is inconsistent with respect to how the prompt is formatted: the former applies word wrap whereas the latter does not.  Since both dialogs are intended for similar purposes (i.e., to enter a password), the formatting of the prompt should be similar.  Either both prompts should apply word wrap, or neither of them should.
Comment 1 Christoph Feck 2020-10-21 00:36:36 UTC
I cannot reproduce, both dialogs use word wrap.

See src/knewpassworddialog.ui line 20
and src/kpassworddialog.ui line 41

Please clarify how to reproduce.
Comment 2 Tristan Miller 2020-10-21 13:02:34 UTC
Well, let me explain how this report arose.

KDialog is more or less a wrapper for the dialog APIs of frameworks-kwidgetsaddons. With the current Git master of KDialog, invoking

kdialog --newpassword foo\\nbar

results in a new password dialog that says

foo
bar

but invoking it as

kdialog --password foo\\nbar

results in a password dialog that says

foo bar

That is, in one case the newline is being converted to a space and in the other it is not.  The desired behaviour (at least from KDialog's point of view) is to preserve the newline.

Since the KDialog code for handling the --password and --newpassword options is pretty much the same, except that one invokes a KPasswordDialog and the other invokes a KNewPasswordDialog, I assume that the discrepancy in behaviour lies in frameworks-kdewidgetsaddons.  From reading its source, I see that the setPrompt() function on line 291 of kpassworddialog.cpp invokes d->ui.prompt->setWordWrap(true), whereas the setPrompt() function on line 264 of knewpassworddialog.cpp does not.  I had assumed that this was the cause of the problem, but did not test this by changing and building the code myself.

If this isn't the cause of the problem, then the cause must lie elsewhere, though I'm still pretty sure it's in frameworks-kdewidgetsaddons and not KDialog.