[gparted] After LUKS unlock failure select failed password (#795617)



commit 1be7b8bc2e379ed113a981ff1f341f3629f16284
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri May 25 19:10:30 2018 +0100

    After LUKS unlock failure select failed password (#795617)
    
    When the wrong LUKS password is entered and the [Unlock] button clicked,
    the wrong password is left in the entry box and focus remains on the
    [Unlocked] button.  Improve the user experience by selecting
    (highlighting) the whole of the wrong password ready for deletion or
    retyping and ensuring that the entry box always has focus.
    
    Just for completeness also programmatically make the password entry box
    have focus when the dialog box is created and first displayed, even
    though it gets this by default.
    
    Bug 795617 - Implement opening and closing of LUKS mappings

 src/DialogPasswordEntry.cc | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/DialogPasswordEntry.cc b/src/DialogPasswordEntry.cc
index e1f94099..a531d54b 100644
--- a/src/DialogPasswordEntry.cc
+++ b/src/DialogPasswordEntry.cc
@@ -53,6 +53,7 @@ DialogPasswordEntry::DialogPasswordEntry( const Partition & partition )
        entry->set_width_chars( 30 );
        entry->set_visibility( false );
        entry->set_activates_default( true );
+       entry->grab_focus();
        entry_hbox->pack_start( *entry );
        vbox->pack_start( *entry_hbox );
 
@@ -84,6 +85,10 @@ const char * DialogPasswordEntry::get_password()
 void DialogPasswordEntry::set_error_message( const Glib::ustring & message )
 {
        error_message->set_label( message );
+       // After unlock failure, also select failed password and make the password entry
+       // box have focus ready for retyping the correct password.
+       entry->select_region( 0, -1 );
+       entry->grab_focus();
 }
 
 } //GParted


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]