Review Request: Clean up KUrl::setFileName and do not add a slash at the beginning when there is no slash in the path

Peter Oberndorfer kumbayo84 at arcor.de
Sun Apr 5 15:45:34 BST 2009


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


A regression test would be nice.
probably at kdecore/tests/kurltest.cpp KUrlTest::testSetFileName

- Peter


On 2009-04-04 13:55:42, Raphael Kubo da Costa wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviewboard.kde.org/r/523/
> -----------------------------------------------------------
> 
> (Updated 2009-04-04 13:55:42)
> 
> 
> Review request for kdelibs.
> 
> 
> Summary
> -------
> 
> Currently, if you have:
> 
>  KUrl test("foo.txt");
> 
> Then test.path() returns "foo.txt" and so does test.pathOrUrl(). But after you call test.setFileName("bar.txt"), test.path() and
> test.pathOrUrl() both return "/bar.txt".
> 
> This patch makes setFileName not add this extra slash when there is no directory in the current path, and also cleans up some dead code.
> 
> 
> Diffs
> -----
> 
>   /trunk/KDE/kdelibs/kdecore/io/kurl.cpp 948757 
> 
> Diff: http://reviewboard.kde.org/r/523/diff
> 
> 
> Testing
> -------
> 
> I have tested it with local files as in the example given in the description. Using a path like "http://www.kde.org/test/foo.txt" and later calling setFileName maintains its correct behaviour -- path() returns "/test/bar.txt" and pathOrUrl() returns "http://www.kde.org/test/bar.txt".
> 
> 
> Thanks,
> 
> Raphael
> 
>





More information about the kde-core-devel mailing list