[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] Let KUrl::List::fromMimeData() follow XDnd spec
From:       Tobias Koenig <tokoe () kde ! org>
Date:       2009-11-12 9:44:24
Message-ID: 20091112094424.GA24033 () ghostdog ! localnet
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hej,

according to the XDnd spec, the URIs from a text/uri-list drag object must
contain a hostname from where the drag where initiated. In 99% of the time
this will be the local machine, so the hostname can be simply ignored.
In the other 1% the drag'n'drop framework would somehow have to download the
files locally and rewrite the uris (which seems to be a broken idea IMHO... well specs...)

However in trunk, KDE applications can't accept drags from applications that
follow the XDnd spec, because the KIO classes (or better said QUrl::toLocalPath()) can't
handle URIs like file://myhost/tmp/foo.pdf correctly.

The attached patch simply removes the host information in KUrl::List::fromMimeData().

Ok to commit?

Ciao,
Tobias

["kurl-dnd.patch" (text/x-diff)]

Index: io/kurl.cpp
===================================================================
--- io/kurl.cpp	(revision 1047273)
+++ io/kurl.cpp	(working copy)
@@ -354,6 +354,16 @@
         }
     }
 
+    for (int i = 0; i < uris.count(); ++i) {
+        KUrl &uri = uris[ i ];
+        // According to XDnd spec, the text/uri-list URIs can contain a hostname
+        if (uri.hasHost()) {
+            // We assume it is localhost and remove this information from the URI
+            // to not confuse KIO
+            uri.setHost(QString());
+        }
+    }
+
     return uris;
 }
 

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic