Review Request 121461: Fix for bug 341773 and minor changes
David Faure
faure at kde.org
Mon Dec 29 21:32:43 UTC 2014
> On Dec. 26, 2014, 8:14 a.m., David Faure wrote:
> > This has been reverted for now, it broke the kio_trash unittest, because it doesn't preserve extensions anymore. Please revisit.
>
> Arjun AK wrote:
> Like i said in the ML, what should be done with the following files:
> `.txt`
> `..txt`
> `...`
>
> David Faure wrote:
> With the goal of "preserving extensions", I would say:
>
> .txt -> 1.txt
> ..txt -> 1..txt or .1.txt (don't really care which one)
> ... -> whatever
>
> What the patch broke was much more severe: file.foo became file.foo1 (for any unknown extension).
>
> Arjun AK wrote:
> >.txt -> 1.txt
> >..txt -> 1..txt or .1.txt (don't really care which one)
>
> But the problem with that is `.txt` is a hidden file, If you change it to `1.txt`, it becomes visible. The user most likely doesn't want that.
>
> >What the patch broke was much more severe: file.foo became file.foo1 (for any unknown extension).
>
> That indeed was wrong, i didn't handle the else part of `!db.suffixForFileName(oldName).isEmpty()`
>
> David Faure wrote:
> Ah right. Then let's try to meet both goals:
>
> .txt -> .1.txt (special case, adding '.' in front again so it stays hidden)
> ..txt -> .1.txt
> ... -> ..1.
>
> It seems to me that this is easy to achieve: with the old (current) algorithm, just add
> if (oldName.startsWith('.') && !newName.startsWith('.')) {
> newName.prepend('.');
> }
>
> Arjun AK wrote:
> >.1.txt
>
> Shouldn't there be a space before 1 (ie ". 1.txt") else the second file will be ".1 1.txt" instead of ". 2.txt"
>
> >..txt -> .1.txt
>
> Shouldn't that be "..1.txt" ?
Right about the first one, I forgot that the code adds spaces.
For the second, I would say ". 1.txt". There's no need to prepend another dot, since it's already a hidden file. My suggested code above would work like this.
- David
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/121461/#review72518
-----------------------------------------------------------
On Dec. 23, 2014, 5:56 p.m., Arjun AK wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/121461/
> -----------------------------------------------------------
>
> (Updated Dec. 23, 2014, 5:56 p.m.)
>
>
> Review request for KDE Frameworks and David Faure.
>
>
> Bugs: 341773
> https://bugs.kde.org/show_bug.cgi?id=341773
>
>
> Repository: kio
>
>
> Description
> -------
>
> 1.Fix bug 341773 (Replace dialog suggests incorrect filename when it contains dots). Make use of `QMimeDatabase::suffixForFileName` for calculating the extension.
> 2. Rename `.foo` and `..foo` into `.foo 1` and `..foo 1` respectively, instead of `1.foo` and `.1.foo`, since they are hidden files and we shouldn't be changing that.
>
>
> Diffs
> -----
>
> autotests/globaltest.cpp 06cb500
> src/core/global.cpp f18ac10
>
> Diff: https://git.reviewboard.kde.org/r/121461/diff/
>
>
> Testing
> -------
>
>
> Thanks,
>
> Arjun AK
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20141229/4c70493f/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list