This implements Web Share API Level 1 [1] through Purpose and also adds a generic "Share..." context menu entry.
It can be tested on [2].
[1] https://w3c.github.io/web-share/
[2] https://w3c.github.io/web-share/demos/share.html
fvogt | |
davidedmundson | |
nicolasfella | |
apol | |
ognarb |
Plasma |
This implements Web Share API Level 1 [1] through Purpose and also adds a generic "Share..." context menu entry.
It can be tested on [2].
[1] https://w3c.github.io/web-share/
[2] https://w3c.github.io/web-share/demos/share.html
The browser context menu also gets a "Share..." entry where you can share whatever page, link, image, video, etc you're pointing at. Unfortunately, when both this and KDE Connect Devices are present, you now get a "Plasma Browser Integration" sub menu with both entries in it.
Lint Skipped |
Unit Tests Skipped |
host/purposeplugin.cpp | ||
---|---|---|
128 | I was wondering the same but the email plugin does something very strange: if (url.isLocalFile()) { query.addQueryItem(QStringLiteral("attachment"), att.toString()); } else { query.addQueryItem(QStringLiteral("body"), att.toString()); } | |
162 | I don't see any special-casing for default mimetype in Purpose. |
AFAICT this won't work on wayland and will also break the browser's native implementation once that actually exists.
extension/content-script.js | ||
---|---|---|
22 | generateGuid, otherwise it looks like a getter | |
863 | Where is that documented? | |
host/purposeplugin.cpp | ||
44 | Just call onUnload()? | |
48 | Can remove this, parent class does that already. | |
87 | Now we have error, errorCode and errorMessage? | |
132 | Merge this with the same if above and put the KIO::mimetype query into the other if. Currently it would break if both url and text are empty. | |
145 | No response. IMO this should be handled in the plugin manager though, as discussed on that diff. | |
154 | 0 is a valid serial... | |
host/purposeplugin.h | ||
58 | std::unique_ptr? | |
59 | Unused? | |
60 | Unused? |
extension/content-script.js | ||
---|---|---|
863 | https://w3c.github.io/web-share/#security-and-privacy-considerations
| |
host/purposeplugin.cpp | ||
87 | errorCode and errorMessage are forwarded from the Purpose plugin, error is our own. I could change errorCode to return a string from us then I guess. Or I hardcode a magic 1 here which is ERR_USER_CANCELED which Purpose uses when canceled but that won't help for the busy case? | |
154 | :) |
host/purposeplugin.cpp | ||
---|---|---|
145 | Yeah, I will clean that up everywhere separate of this patch as to not entangle it even further. |
host/purposeplugin.cpp | ||
---|---|---|
123 | Doesn't use urls now? |
It should only add the navigator.share stuff if the host side is supported and loaded, in case you run old host with new extension.
The setting will be correctly hidden but since it is enabled by default it will still add the then defunct JS bits.
host/purposeplugin.cpp | ||
---|---|---|
87 | Just call the argument int errorCode then, one variablename less | |
115 | This whole if chain looks a bit weird - not having any items in the urls list results in an error at the end, so why not bail out early and then refactor out all urls.isEmpty() checks? | |
host/purposeplugin.h | ||
57 | Whitespace |