Bug 91970 - KPasswordDialog: Display warning if Caps Lock is on
Summary: KPasswordDialog: Display warning if Caps Lock is on
Status: CONFIRMED
Alias: None
Product: frameworks-kwidgetsaddons
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Christoph Feck
URL:
Keywords:
: 107274 119403 131077 153483 221356 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-10-23 21:32 UTC by Knut Johansson
Modified: 2017-09-03 16:21 UTC (History)
12 users (show)

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


Attachments
Warns the user about caps lock state (2.77 KB, patch)
2005-01-13 10:56 UTC, Matías Costa
Details
Caps Lock warning (4.76 KB, patch)
2005-01-13 18:29 UTC, Knut Johansson
Details
Patchs to kpassdlg.cpp and kpassdlg.h (10.00 KB, patch)
2005-03-16 00:45 UTC, Hugo Parente Lima
Details
KPasswordDialog capslock test (12.17 KB, image/png)
2005-03-16 00:46 UTC, Hugo Parente Lima
Details
Patch to show a warning label (1.86 KB, patch)
2010-01-13 17:57 UTC, charly ghislain
Details
Correction to the previous pathch. (2.85 KB, patch)
2010-01-13 18:06 UTC, charly ghislain
Details
new KPasswordLineEdit widget (7.69 KB, patch)
2010-01-14 03:17 UTC, charly ghislain
Details
Use a KPasswordLineEdit to show the warning (5.15 KB, patch)
2010-01-14 03:19 UTC, charly ghislain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Knut Johansson 2004-10-23 21:32:19 UTC
Version:            (using KDE KDE 3.3.0)
Installed from:    Compiled From Sources
OS:                Linux

Make kdesu display a warning if Caps Lock is on, like kdesktop_lock does and I believe also KDM. This will be both helpfull and make KDE more consistent.
Comment 1 Waldo Bastian 2005-01-07 16:53:18 UTC
Good idea. Would be a good junior job.
Comment 2 Matías Costa 2005-01-13 10:56:38 UTC
Created attachment 9065 [details]
Warns the user about caps lock state

Just copied from kdesktop/lock/lockdlg.cc, adapted and simplified.

The warning text is not red but makes the work :)
Comment 3 Knut Johansson 2005-01-13 18:29:56 UTC
Created attachment 9075 [details]
Caps Lock warning
Comment 4 Knut Johansson 2005-01-13 18:36:30 UTC
Comment on attachment 9075 [details]
Caps Lock warning

I tok a look at this again when Waldo clasified it as an junior job. Looking at
the code has convinced me it is not really a kdesu "bug". Since kdesu basicly
only uses the KPasswordDialog class. So i think it makes more sense to make
implement it there, would aslo increase consistency since it's used several
places. KPasswordDialog is located in kdelibs/kdeui/kpassdlg.cpp so changes may
give concerns regarding BIC and such.

I have given it a try myself, like Matías I have copied and adapted from 
kdesktop/lock/lockdlg.cc. Sadly I can't get it to work right, having some
problems with the event filtering and the layoutcode are not qyite right. But
its a start.

Made a few obsevations also:
The layoutcode uses some obsolete functions like addRowSpacing.
Why does kdesktop/lock/lockdlg.cc have its own implementation insted of using
KPasswordDialog
Comment 5 Hugo Parente Lima 2005-03-16 00:45:13 UTC
Created attachment 10140 [details]
Patchs to kpassdlg.cpp and kpassdlg.h

I implemented it on KPasswordDialog.
Notes:
 - I removed (commented) the obsoletes method calls to
QGridLayout::addRowSpacing() and QGridLayout::addColSpacing(), so you need
check if the layout still good.
 - I used hardcoded color (red) to display the warning, I think that this can
cause problems if the user is using red, pink, etc as background color in your
theme settings.

P.S.: How to attach tow files on a single post? I have two diff files, so I
"tar'ed" it.
Comment 6 Hugo Parente Lima 2005-03-16 00:46:46 UTC
Created attachment 10141 [details]
KPasswordDialog capslock test

Screenshot of KPasswordDialog with the patch.
Comment 7 Hugo Parente Lima 2005-03-16 01:09:54 UTC
I'm thinking in create a new widget "KPassiveTip" or any other name...
KPassiveTip could be a ballon pointing to the widget (like WinXP) with some tip/text inside, it dissepear after a user definied time or when the parent widget lose the keyboard focus.

It is like KPassivePopup (but more beautifull), but can be used on any widget. I'm posting it here because if anyone like this idea it can be used on KPasswordEdit to handle the capslock warning, etc...

But on the other side... it can be only a extension to KPassivePopup.. I dont know...

P.S.: English is not my natural language, need I post it on kde-devel maillist?
Comment 8 Thiago Macieira 2005-09-12 01:41:22 UTC
*** Bug 107274 has been marked as a duplicate of this bug. ***
Comment 9 Christian Loose 2006-01-03 01:39:41 UTC
*** Bug 119403 has been marked as a duplicate of this bug. ***
Comment 10 Mike Williams 2007-01-11 16:19:15 UTC
Why has this not been imported into svn?
Comment 11 Oleg Atamanenko 2007-09-08 06:16:23 UTC
I think it is necessary not only show tooltip, if caps lock is on, but also we need to show tooltip, if user's current locale is not english. Example use case - users with more than one locale. I.e. I'm russian and I have 2 locales, so now I have to look everytime I need to enter password at tray, to see, which locale is currently active. 
Comment 12 Pino Toscano 2007-12-05 16:05:33 UTC
*** Bug 153483 has been marked as a duplicate of this bug. ***
Comment 13 Thomas Friedrichsmeier 2007-12-21 00:06:59 UTC
Regarding comment #4: Yes, you're right, this really needs to be fixed in KPasswordDialog in kdelibs. Reassigning.
Comment 14 Michael Leupold 2008-11-01 17:23:57 UTC
*** Bug 131077 has been marked as a duplicate of this bug. ***
Comment 15 Richard Hartmann 2008-11-01 18:52:07 UTC
As I am not 100% sure what people mean by tooltip, I just wanted to say that the warning should not be modal.

Also, the warning for keyboard layout (and the a way to change it) should have an option to only appear when the current one is not the default one. Along those lines, it might be an idea to allow _all_ keyboard layouts (and their variants) to be selected in a submenu.
Comment 16 Christoph Feck 2010-01-05 12:00:37 UTC
*** Bug 221356 has been marked as a duplicate of this bug. ***
Comment 17 charly ghislain 2010-01-13 17:57:12 UTC
Created attachment 39852 [details]
Patch to show a warning label

Once patched with this patch, kpassworddialog shows a warning label when the capslock key is locked using KModifierKeyInfo. I'm working toward adding a keyboard locale icon button.
Comment 18 Richard Hartmann 2010-01-13 18:00:02 UTC
Thanks!

Looking at the code, do you display an actual warning text explaining what is wrong or simply an icon?
Comment 19 charly ghislain 2010-01-13 18:06:20 UTC
Created attachment 39853 [details]
Correction to the previous pathch.

I forgot to add the diff for the ui file.
Comment 20 charly ghislain 2010-01-13 18:08:20 UTC
#18: So it's a label, the String is in the ui file so i guess it will be translatable.

For the locale, i was thinking of a toolbutton, visible if there is more than one locale, with the current locale flag as an icon and a dropdown menu to select others.
Comment 21 charly ghislain 2010-01-13 18:45:19 UTC
In fact there is already keyboard layout widgets intended to be reused. The problem is it lies in kdebase/workspace/kcontrol/kxkb, and i guess kdelibs can't depends on kdebase. So my suggestion is to move that code in kdelibs and leave the control module in kdebase.
Comment 22 charly ghislain 2010-01-14 03:17:59 UTC
Created attachment 39874 [details]
new KPasswordLineEdit widget

This widget makes it easier to use capslock warning in various places, such as the kdm login manager.
Comment 23 charly ghislain 2010-01-14 03:19:59 UTC
Created attachment 39875 [details]
Use a KPasswordLineEdit to show the warning

Final patch against HEAD to show a warning when capslock is on.
Comment 24 Christoph Feck 2010-01-14 04:01:26 UTC
I am not sure if it makes sense to create a special subclass for password line edit fields. The idea is that the application only uses the KPasswordDialog and the KNewPasswordDialog, without trying to create custom dialogs. At least it should not be public API.

There are memory leaks in your code, formatting issues, as well as other problems. Please open a review request on http://reviewboard.kde.org/ for group kdelibs to discuss the issues.

Thanks.
Comment 25 Oswald Buddenhagen 2010-03-07 10:53:13 UTC
fwiw, http://reviewboard.kde.org/r/2591/
Comment 26 Christoph Feck 2014-10-26 16:06:49 UTC
Since KWidgetsAddons cannot depend on KModifierKeyInfo from KGuiAddons, and Qt will not help either, we need minimal platform-specific code, e.g. http://stackoverflow.com/questions/2968336/qt-password-field