A few thoughts about KUrl

Jarosław Staniek js at iidea.pl
Thu Dec 21 14:47:16 GMT 2006


Leonardo Stern said the following, On 2006-12-21 15:16:

> Just trying to understand the desired behavior (not to current one)  of kurl ..
> 
> Given:
> 
> KUrl kurl("file:///c:/");
> 
> there are 2 suggested behaviors for kurl.path() and kurl.toLocalFile() :
> 
> ===Case 1 - as seen in QUrl ===
> kurl.path() => "/c:/"
> kurl.toLocalFile() => "c:/"
> 
> Some questions :
> kurl.isRelative() ? [no in QUrl]
> QDir(kurl.path()).isRoot ? [yes in QUrl]
> kurl.setPath("/") creates a valid URL ?  [yes in QUrl]; What should be
> kurl.toLocalFile() on Windows ? ["/" in QUrl]

[..]

> kurl.setPath("c:/") will be interpreted as kurl.setPath("/c:/") ? [no in QUrl]

How about using "%3A" instead of ':' ?
Then we'd have no problem in places where ':' is considered as a separator.
Assume nobody should win32-specific absolute paths ("c:/") in portable code.

Let's see whether this could work...

 > Should KUrl("/") act as a relative path on windows ? (
 > KUrl("file:///C:/foo/bar") + KUrl("/") = KUrl("file:///C:/") , similar
 > to "cd /" in windows console)

Wouldn't using this side effect make the code unportable?


PS: back in 2003 when I digged deeply in kdelibs to port them, I proposed 
using '|' instead of ':' as some browsers did. Eventually I give up with such 
deep change (mostly needed for open/save dialogs) because I switched to Qt's 
QFileDialog in win32 and did not use KUrl too much in code that run on win32.

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice: http://www.kexi-project.org, http://www.koffice.org
  KDE3 & KDE4 Libraries for MS Windows: http://kdelibs.com, http://www.kde.org




More information about the kde-core-devel mailing list