D7343: auto generate desktop file for url handling
Harald Sitter
noreply at phabricator.kde.org
Wed Aug 16 10:12:14 UTC 2017
sitter created this revision.
Restricted Application added a project: Plasma.
Restricted Application added a subscriber: plasma-devel.
REVISION SUMMARY
configure_file on the desktop file to generate a NoDisplay variant to
handle URLs (currently appstream: only) and have the standard desktop file
only accept files.
Discover can accept local files corresponding to a package format mimetype
(e.g. rpm or deb) but these files must be strictly local as discover has
no provisioning for downloading them on the file. To make this work
we'll need an Exec line containing %F which makes kio download a remote
URL to a local file before then passing it to discover. Namely clicking
on a http://foo.bar/x.deb in a browser will cause kio to download the file
and then start discover with the locally downloaded version.
Conversely, discover also implements a scheme handler for appstream: which
isn't itself a protocol implemented by KIO but instead acts as lookup
URI. These URLS cannot be downloaded but instead must be passed verbatim
to discover for handling, to have this working we need %U rather than %F.
End result being that clicking appstream://org.kde.krita.desktop in a
browser will immediately start discover displaying the krita page.
To support both methods we need two separate desktop files, one to handle
the package formats with %F and another handling appstream: with %U.
We are now calling configure_file on a generic desktop file template to
adjust it for these two use cases. The main org.kde.discover.desktop is
visible in menus and can only handle local files. The new
org.kde.discover.urlhandler.desktop is not visible in menus but used when
KIO encounters an appstream url which it won't know what to do with.
TEST PLAN
- try opening a http url pointing to a deb (probably needs to have mimetype deb in the http header fields)
- should make plasma show a download arrow thingy
- try opening appstream://org.kde.krita.desktop
- should open discover right away and point it to the krita page
- download old discord and install on neon https://dl.discordapp.net/apps/linux/0.0.1/discord-0.0.1.deb
- open discord
- should notify of new version and recommend to download the deb
- click download
- discord closes and plasma shows a download notification
- discover starts with page for downloaded deb in ~/.cache/...
REPOSITORY
R134 Discover Software Store
BRANCH
Plasma/5.10
REVISION DETAIL
https://phabricator.kde.org/D7343
AFFECTED FILES
discover/CMakeLists.txt
discover/org.kde.discover.desktop
discover/org.kde.discover.desktop.cmake
To: sitter, apol
Cc: plasma-devel, ZrenBot, progwolff, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart, lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20170816/557e09e4/attachment.html>
More information about the Plasma-devel
mailing list