Bug 326718

Summary: Clear text button on file rename does nothing [patch]
Product: [Applications] digikam Reporter: rjwgnr27
Component: AdvancedRename-dialogAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: minor CC: caulier.gilles, marcel.wiesweg, skoushik333, tpr
Priority: NOR    
Version: 4.0.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 4.5.0
Sentry Crash Report:
Attachments: Fix Clear text button working

Description rjwgnr27 2013-10-27 07:35:40 UTC
When entering rename pattern in the file rename dialog, pressing the clear text on the input field does nothing.

Reproducible: Always

Steps to Reproduce:
1. Select an image or images
2. Select "Image -> Rename"
3. Enter text in the "rename pattern" input.
4. Try to clear the text by pressing the small 'x' on right of input field.
Actual Results:  
Nothing happens

Expected Results:  
The input field should be cleared.


Same behavior in the rename file option of the batch manager.
Comment 1 Teemu Rytilahti 2014-10-26 23:41:21 UTC
Hello there,

Just took a quick peek at the code.
The widget used is ProxyLineEdit defined in libs/widgets/common/comboboxutilities.cpp
This widget overrides the input events of KLineEdit for some reason, found just this comment there:
/**
 * We just re-implement all relevant QWidget event handlers and call
 * the QWidget implementation, not the KLineEdit one.
 */

As one can see from here, the signal is being emited in KLineEdit implementation, and is not therefore ever emited in this case: http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/klineedit_8cpp_source.html#l01144

Marcel probably has insight why it was done so, added to CC.
Comment 2 Koushik S 2014-10-27 06:41:28 UTC
(In reply to Teemu Rytilahti from comment #1)
> Hello there,
> 
> Just took a quick peek at the code.
> The widget used is ProxyLineEdit defined in
> libs/widgets/common/comboboxutilities.cpp
> This widget overrides the input events of KLineEdit for some reason, found
> just this comment there:
> /**
>  * We just re-implement all relevant QWidget event handlers and call
>  * the QWidget implementation, not the KLineEdit one.
>  */
> 
> As one can see from here, the signal is being emited in KLineEdit
> implementation, and is not therefore ever emited in this case:
> http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/klineedit_8cpp_source.
> html#l01144
> 
> Marcel probably has insight why it was done so, added to CC.

Hi,

I just changed the mousePressEvent and mouseReleaseEvent to KLineEdit's implementation and it seems to work, although I'm not sure why it was avoided in the first place. So i'll hold onto making the patch until it's confirmed that there's no problems involved.
Comment 3 caulier.gilles 2014-10-29 08:43:37 UTC
I don't know exactly why QWidget is used instead KLineEdit to call parent methods in ProxyLineEdit.

Marcel, any feedback about this topic please...

Gilles Caulier
Comment 4 caulier.gilles 2014-10-29 08:43:49 UTC
Anyway, look where is used comboboxutilities.h :

- Advanced Searches dialog :
ratingsearchutilities.h
choisesearchutilities.h
searchutilities.h

- Rename tool :
advancedrenameinput.h

- Album combobox selector used in many place in digiKam :
albumselectcombobox.h

So, if you patch comboboxutilities.h about calling KLineEdit instead QWidget, you need to check if regression are introduced in all ProxyLineEdit children classes.

Gilles Caulier
Comment 5 Koushik S 2014-10-29 15:52:02 UTC
> So, if you patch comboboxutilities.h about calling KLineEdit instead
> QWidget, you need to check if regression are introduced in all ProxyLineEdit
> children classes.
> 
> Gilles Caulier

I tested it out on a couple of parameters, and I haven't experienced any problems so far. It seems to work on parameters which are not text entries as well. 

I don't know what the album combobox selector is in the application, sorry. How can I use it? I checked it out on the rest of the dialogues, and it seems to work fine. 

I think the only anamoly that I found was in the advanced rename input-- when you clear the text, and enter a new name, the clear button gets disabled. I don't know if that's the intended behaviour or if it needs to be changed.
Comment 6 caulier.gilles 2014-10-29 16:42:57 UTC
Look in Maintenance tool, there are combobox to select albums or tags to process on top of dialog.

It's also available in left sidebar, to Fuzzy Seach view, on the bottom.

Look also Scan for Face dialog, on the bottom.

Gilles Caulier
Comment 7 Koushik S 2014-10-29 18:47:20 UTC
Got it. I tested it on all the options you've mentioned, and it seems to work fine. Clearing it sets it to 'Any album' which, I think, is the expected option.

Should I send in the patch?
Comment 8 caulier.gilles 2014-10-29 19:30:46 UTC
Attach the patch this this file.

Gilles Caulier
Comment 9 Koushik S 2014-10-29 20:04:18 UTC
Created attachment 89366 [details]
Fix Clear text button working
Comment 10 caulier.gilles 2014-10-29 22:15:33 UTC
Git commit 64cdd14274352575e26b47a5baacb59f4ea105de by Gilles Caulier.
Committed on 29/10/2014 at 22:14.
Pushed by cgilles into branch 'master'.

Apply patch #89366 to make clear text button usable.
FIXED-IN: 4.5.0

M  +2    -1    NEWS
M  +11   -9    libs/widgets/common/comboboxutilities.cpp

http://commits.kde.org/digikam/64cdd14274352575e26b47a5baacb59f4ea105de