Bug 306767

Summary: ICONVIEW : thumb focus is lost after renaming
Product: [Applications] digikam Reporter: DrSlony <bugs>
Component: Thumbs-IconViewAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: bugs, caulier.gilles, skoushik333
Priority: NOR    
Version: 4.2.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.5.0
Sentry Crash Report:
Attachments: Select next thumbnail after renaming
Select next thumbnail after renaming

Description DrSlony 2012-09-13 20:26:06 UTC
After renaming a file, the focus seems to fall on the file after that one - it has the dashed rectangle around it. But in fact no file is properly focused, because if you now hit F2 to rename this allegedly focused file, nothing happens. You have to hit the right arrow and then the left arrow to properly focus and rename this file.

I know this sounds confusing, but follow the steps to reproduce and it will be immediately clear and apparent why this is an annoying bug.

Reproducible: Always

Steps to Reproduce:
Let's say you have some files named 01 to 10.

1. Click on 05. It gets selected. You know it's selected because it has both the dashed outline and the slide background color changed.
2. Press F2 and rename it to anything, enter.

Focus seems to have fallen on 06 because 06 has a dashed border (but the slide background color did not change).

3. Now you want to rename 06, so you press F2. Nothing happens.

To rename 06 you must either move your hand over to the mouse and click on 06, or if you want to keep on your hands on the keyboard you have to follow these steps:

4. Press the right arrow, now 07 is focused (it has both the dashed outline and the slide background color changed).
5. Press the left arrow, now 06 is properly focused (it has both the dashed outline and the slide background color changed). Now when you press F2, you can rename it.

You have to repeat steps 4 and 5 if you want to keep renaming files one by one.


Expected Results:  
1. Click on 05
2. F2 to rename it, enter.
3. F2 again to rename 06, enter.
4. F2 again to rename 07, enter.
and so on.
Comment 1 Marcel Wiesweg 2012-09-14 16:11:27 UTC
The dashed outline does not mean focus, it's some other thing called "active" which has not too much effect on anything. Only the color shows selection. So in fact, your bug is that the selection is cleared, and your wish is the selection to be moved to the next item.
Comment 2 DrSlony 2012-09-14 17:12:51 UTC
Sure, as long as I can just keep hitting F2 without arrow key ninjutsu :]
Comment 3 DrSlony 2014-08-06 22:29:02 UTC
Still an issue in 4.2.0!
It's impossible to manipulate images without what would be superfluous clicking in any other program, but here it's necessary just because you never know which thumb is focused after renaming/deleting/moving a bunch of images, and as a result you can end up moving/deleting the wrong images or not all of the images.
Comment 4 Koushik S 2014-10-22 19:33:28 UTC
Created attachment 89265 [details]
Select next thumbnail after renaming

Hi,
    The patch seems to fix the issue, although I haven't tried it out extensively. It selects the next one in the list order (before renaming changes the order). 
    
    As this is my first patch to this project, it's likely that I may have made a mistake, or have ignored some aspect of the working. I'll rectify it if that's the case.
Comment 5 caulier.gilles 2014-10-22 21:19:03 UTC
Koushik,

The selection of next item from icon view must be done after Rename dialog, only if dialog is accepted (Ok pressed). If dialog is rejected (Cancel pressed), nothing must be done.
Comment 6 Koushik S 2014-10-23 07:44:35 UTC
(In reply to Gilles Caulier from comment #5)
> Koushik,
> 
> The selection of next item from icon view must be done after Rename dialog,
> only if dialog is accepted (Ok pressed). If dialog is rejected (Cancel
> pressed), nothing must be done.

Hi,

I tested it out, and it seems to do exactly that. Since the code is in an if condition which checks if the images are renamed, I think it would work as expected, as the dialog is deleted in the code before the selection takes place. Atleast that's my guess of what's happening. Please let me know if I'm wrong.
Comment 7 caulier.gilles 2014-10-23 08:34:31 UTC
You must check value returned by QDialog::exec() :

http://qt-project.org/doc/qt-4.8/qdialog.html#exec

To check which button have been pressed by user...

Gilles Caulier
Comment 8 Koushik S 2014-10-23 11:09:32 UTC
Created attachment 89278 [details]
Select next thumbnail after renaming

I've made the change as you said. I realized what I've been doing incorrectly before, and hopefully this might fix it.

Thanks!
Comment 9 caulier.gilles 2014-10-23 13:05:57 UTC
Git commit 619ffd385b2851e9986fbfc8328dae7d8b2e5aea by Gilles Caulier.
Committed on 23/10/2014 at 13:04.
Pushed by cgilles into branch 'master'.

apply patch #89265 from Koushik to select next item from icon view before to perform files renaming.
FIXED-IN: 4.5.0

M  +2    -1    NEWS
M  +12   -8    app/items/digikamimageview.cpp

http://commits.kde.org/digikam/619ffd385b2851e9986fbfc8328dae7d8b2e5aea