Review Request 110223: Fix two bugs when renaming multiple files

Commit Hook null at kde.org
Thu May 2 18:24:02 BST 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110223/
-----------------------------------------------------------

(Updated May 2, 2013, 5:24 p.m.)


Status
------

This change has been marked as submitted.


Review request for Dolphin.


Description
-------

When renaming multiple files, the user can provide a pattern for the new name, which contains one or more '#' that will be replaced by digits. The "Rename" button is only enabled if the pattern contains exactly one sequence of '#'.

Currently, there are two small problems:

(a) The button is not enabled if the pattern contains just a '#' and nothing else.
(b) The button is enabled if there is no '#' at all in the pattern.

The code that determines if the button should be enabled is obviously incorrect, and also needlessly complex. I think we can just check if the distance between the first and last '#' in the pattern is 1 less than the total number of '#'. That is the case if and only if there is exactly one sequence of '#'.

In the special case that the count is zero, both QString::indexOf() and QString::lastIndexOf() return -1, and the check fails, so it's not necessary to add a special case for that in the code.


This addresses bug 318942.
    http://bugs.kde.org/show_bug.cgi?id=318942


Diffs
-----

  dolphin/src/views/renamedialog.cpp 07add11 

Diff: http://git.reviewboard.kde.org/r/110223/diff/


Testing
-------

Works for me.


Thanks,

Frank Reininghaus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20130502/0c7ca901/attachment.htm>


More information about the kfm-devel mailing list