Review Request 110223: Fix two bugs when renaming multiple files

Frank Reininghaus frank78ac at googlemail.com
Sat Apr 27 21:30:14 BST 2013


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

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/20130427/24c0d1cd/attachment.htm>


More information about the kfm-devel mailing list