Review Request: Clean up KUrl::setFileName and do not add a slash at the beginning when there is no slash in the path
Raphael Kubo da Costa
kubito at gmail.com
Sun Apr 5 17:27:45 BST 2009
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/523/
-----------------------------------------------------------
(Updated 2009-04-05 09:27:45.389952)
Review request for kdelibs.
Changes
-------
Implemented regression test for the fix as suggested by Peter Obemdorfer.
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 (updated)
-----
/trunk/KDE/kdelibs/kdecore/io/kurl.cpp 948757
/trunk/KDE/kdelibs/kdecore/tests/kurltest.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