Setting a protocol handler

Patrick O'Callaghan pocallaghan at gmail.com
Wed Mar 28 21:51:18 UTC 2012


On Wed, 2012-03-28 at 22:19 +0800, Ed Greshko wrote:
> On 03/28/2012 08:26 PM, Patrick O'Callaghan wrote:
> > Because I'm not trying to set a handler for BitTorrent. That part
> > already works. As I noted in my OP, the problem here is that magnet
> > links are not signalled by a special file extension or MIME type, just
> > by a magnet: protocol flag at the start of the URI. Here's an example of
> > one:
> >
> > magnet:?xt=urn:btih:29b30e19144ee41266e40096ffa09714b6541103&dn= ... etc.
> >
> > IOW it's analogous to http: or file: or email: but I can't get a clear
> > answer on the mechanics of how this is handled by KDE. Clearly something
> > in my KDE setup thinks that these things should be handled by Ktorrent,
> > but where is this stated and how do I change it? I repeat that no
> > Ktorrent .desktop file on my system even mentions magnet, so what's
> > going on?
> 
> OK....  I see what you're after....
> 
> Doing a little "test"....
> 
> If I use chrome and click on a magnet link it will call ktorrent.  If I erase
> ktorrent it will call transmission.  If I erase transmission it will do nothing.
> 
> If I use firefox, it will only use transmission....but when it does it brings up a
> dialog box asking if I want to use it or choose another application.  So, one could
> pick ktorrent or in your case qBittorrent.
> 
> Now, the question is...what is the installation of ktorrent or transmission doing
> that make chrome aware that it can deal with the magnet protocol

Chrome as such may have nothing to do with it. Try the following:

kioclient openProperties <some magnet URI>

The behaviour is exactly the same as what I've been getting from Chrome,
ergo it's probably not a problem of Chrome.

Some further burrowing has revealed the existence
of /usr/share/kde4/services/magnet.protocol, which calls kio_magnet to
do the work. I can't see where to configure kio_magnet, so I copied the
file to ~/.kde/share/services and simply substituted QBT for kio_magnet
in the file, logged out, logged in.

And got exactly the same result.

Tried it again but editting the original system file. Got a error bell
(so a: it doesn't work that way, and b: it doesn't look at the user's
personal settings).

Note that kio_magnet is not an executable, it's a .so file which comes
as part of the Ktorrent RPM (as does the magnet.protocol file itself),
so it may not even be configurable.

Does anyone still maintain that this is "not hard"?

poc




More information about the kde mailing list