[Patch] KUrl::prettyUrl and xmpp: url

Olivier Goffart ogoffart at kde.org
Sun Oct 7 19:06:30 BST 2007


Hi,

So since we are in a freeze, I send patches to this list.
The patch is pretty simple, but I'm not sure of possible side effect.

In Konqueror, if you have a link such as, 
<a href="xmpp:foo at bar.com"> , it is modified to xmpp://foo@bar.com
xmpp: and xmpp:// have very different meaning, and the most common use is 
xmpp:

The attached path fixes the issue.

I've made a special case for file: because tests seems to require file:/// 
I don't know the logic behind this.


Ok to commit ?
-------------- next part --------------
Index: tests/kurltest.cpp
===================================================================
--- tests/kurltest.cpp	(revision 722424)
+++ tests/kurltest.cpp	(working copy)
@@ -634,6 +634,9 @@ void KUrlTest::testPrettyURL()
   KUrl urlWithPass("ftp://user:password@ftp.kde.org/path");
   QCOMPARE( urlWithPass.pass(), QString::fromLatin1( "password" ) );
   QCOMPARE( urlWithPass.prettyUrl(), QString::fromLatin1( "ftp://user@ftp.kde.org/path" ) );
+  
+  KUrl xmppUri("xmpp:ogoffart at kde.org");
+  QCOMPARE( xmppUri.prettyUrl(), QString::fromLatin1( "xmpp:ogoffart at kde.org" ) );
 }
 
 void KUrlTest::testIsRelative()
Index: io/kurl.cpp
===================================================================
--- io/kurl.cpp	(revision 722424)
+++ io/kurl.cpp	(working copy)
@@ -914,7 +914,12 @@ QString KUrl::prettyUrl( AdjustPathOptio
   // - the pathname and fragment parts are shown in Unicode (as opposed to %-encoding)
   QString result = scheme();
   if (!result.isEmpty())
-    result += QLatin1String("://");
+  {
+    if(!authority().isEmpty() || result == QLatin1String("file"))
+        result += QLatin1String("://");
+    else
+        result += QLatin1String(":");
+  }
 
   QString tmp = userName();
   if (!tmp.isEmpty()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20071007/c9bd4623/attachment.sig>


More information about the kde-core-devel mailing list