From 13199786ed3889f256cb168ae19f4fbdb5089369 Mon Sep 17 00:00:00 2001 From: Andrew Borodin Date: Tue, 14 Jan 2014 10:20:23 +0400 Subject: [PATCH] Ticket #3150: achown: escape on user list should not accept value. Open the Advanced chown dialog. Navigate to owner or group, and press Enter. A dialog enlisting the available usernames or groups appears. Move up or down in this dialog, then press double Esc or F10. Actual behavior: The selected value gets accepted, just as if Enter was pressed. Expected behavior: The user or group is not changed, as if this dialog was not opened at all. Signed-off-by: Andrew Borodin --- src/filemanager/achown.c | 78 +++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/src/filemanager/achown.c b/src/filemanager/achown.c index 2a1072d25..c9d6ebe50 100644 --- a/src/filemanager/achown.c +++ b/src/filemanager/achown.c @@ -369,53 +369,57 @@ do_enter_key (WDialog * h, int f_pos) result = dlg_run (chl_dlg); - if (b_pos != chl_list->pos) + if (result != B_CANCEL) { - gboolean ok = FALSE; - char *text; + if (b_pos != chl_list->pos) + { + gboolean ok = FALSE; + char *text; - listbox_get_current (chl_list, &text, NULL); - if (is_owner) - { - chl_pass = getpwnam (text); - if (chl_pass != NULL) + listbox_get_current (chl_list, &text, NULL); + if (is_owner) { - ok = TRUE; - sf_stat->st_uid = chl_pass->pw_uid; + chl_pass = getpwnam (text); + if (chl_pass != NULL) + { + ok = TRUE; + sf_stat->st_uid = chl_pass->pw_uid; + } } - } - else - { - chl_grp = getgrnam (text); - if (chl_grp != NULL) + else { - sf_stat->st_gid = chl_grp->gr_gid; - ok = TRUE; + chl_grp = getgrnam (text); + if (chl_grp != NULL) + { + sf_stat->st_gid = chl_grp->gr_gid; + ok = TRUE; + } } + if (ok) + { + ch_flags[f_pos + 6] = '+'; + update_ownership (); + } + dlg_focus (h); + if (ok) + print_flags (); } - if (ok) + if (result == KEY_LEFT) { - ch_flags[f_pos + 6] = '+'; - update_ownership (); + if (!is_owner) + chl_end = TRUE; + dlg_one_up (ch_dlg); + f_pos--; + } + else if (result == KEY_RIGHT) + { + if (is_owner) + chl_end = TRUE; + dlg_one_down (ch_dlg); + f_pos++; } - dlg_focus (h); - if (ok) - print_flags (); - } - if (result == KEY_LEFT) - { - if (!is_owner) - chl_end = TRUE; - dlg_one_up (ch_dlg); - f_pos--; - } - else if (result == KEY_RIGHT) - { - if (is_owner) - chl_end = TRUE; - dlg_one_down (ch_dlg); - f_pos++; } + /* Here we used to redraw the window */ dlg_destroy (chl_dlg); }