branches/KDE/3.5/kdelibs/kio/kio
    Thiago Macieira 
    thiago at kde.org
       
    Tue Nov 14 01:00:17 GMT 2006
    
    
  
Alexander Neundorf wrote:
>
>int main()
>{
>   KURL url("http://www.neundorf.net/main.\nphp");
>   QString pretty=url.prettyURL();
>   QString filename=url.fileName();
>   cout<<"pretty: -"<<pretty.latin1()<<"- name: -"<<filename.latin1
>()<<"-"<<endl;
>
This line is wrong:
>   KURL url2(filename);
This is KDE 3 code. You have to use KURL::fromPathOrURL().
>   QString pretty2(url2.prettyURL());
>   cout<<"pretty2: -"<<pretty2.latin1()<<"-"<<endl;
>   return 0;
>}
>
>produces:
>
>~/src/tests/kde3kurl$ ./hello
>pretty: -http://www.neundorf.net/main.%0Aphp- name: -main.
>php-
>pretty2: -main.
>php-
>
>So it seems prettyURL()/lazy_encode() doesn't handle the newline. Or
I'd say your first test pretty much showed that prettyURL() handles the 
newline. See the %0A in the first line of your debug output.
> maybe it's just that KURL::bMalFormed is true, since just the filename
> is probably no valid URL, is it ?
>So, do I really have to do something like
>url.prettyURL().mid(url.prettyURL().findRev('/')); or something like
> this ?
Huh? I didn't get this part.
-- 
  Thiago Macieira  -  thiago (AT) macieira.info - thiago (AT) kde.org
    PGP/GPG: 0x6EF45358; fingerprint:
    E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20061114/c1470603/attachment.sig>
    
    
More information about the kde-core-devel
mailing list