Akregator feed detector plugin: Port the context menu plugin
ClosedPublic

Authored by marten on May 10 2018, 2:08 PM.

Details

Summary

This is the context menu plugin - the first target in CMakeLists.txt - which was never ported to KF5. This change implements it using the new KAbstractFileItemActionPlugin plugin system.

Test Plan

Built Konqueror with this change. Checked that the context menu over an RSS link (e.g. as on dot.kde.org) has an action item "Add Feed to Akregator", and that selecting this action sends the feed URL to Akregator.

Diff Detail

Repository
R226 Konqueror
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
marten requested review of this revision.May 10 2018, 2:08 PM
marten created this revision.
dfaure requested changes to this revision.May 10 2018, 8:19 PM
dfaure added a subscriber: dfaure.

Nice

plugins/akregator/akregatorplugin.cpp
82

coding style: "return acts", no parenthesis needed

95

This reads like it would trigger false positives easily.
E.g. https://www.w3schools.com/xml/xml_whatis.asp would be treated as a feed URL because it contains xml?

I wonder if this code meant to say endsWith...

plugins/akregator/akregatorplugin.h
40

override ?

44–45

while at it: const, or static, or better, make it file-static

44–45

white at it: private

45–46

const

This revision now requires changes to proceed.May 10 2018, 8:19 PM
marten updated this revision to Diff 33971.May 11 2018, 7:33 AM
marten marked 6 inline comments as done.

Diff updated in accordance with review comments: coding style, modern C++ features and reducing visibility wherever possible.

David, would you also be able to look at https://phabricator.kde.org/D12616 - KF5 conversion of the other target - so that they can both be committed in sequence?

plugins/akregator/akregatorplugin.h
44–45

Made file-static, but left the next function as member to avoid having to construct m_feedMimeTypes every time (or complicate with global static).

marten added inline comments.May 11 2018, 7:44 AM
plugins/akregator/akregatorplugin.cpp
95

Not sure what that test was intended to catch either, but as you say looking for "xml" anywhere in the path will accept many links that aren't feeds. Rewrote this test to only look at the URL path (not the full URL, including scheme/host/query!), and only accept "rss" or "rdf" within that path. This string test is only done if the MIME type test fails, anyway, so hopefully for a properly configured web site the MIME type test will accept the link.

dfaure accepted this revision as: dfaure.May 11 2018, 6:36 PM

Still strange that "rss" or "rdf" anywhere in the path is enough, but I'm no rss expert... Looks good overall.

plugins/akregator/akregatorplugin.cpp
72

BTW why the '{' on separate lines? The Qt5/KF5 coding style is to have it on the same line, and you left it that way further down in this file, which is now inconsistent with itself.

plugins/akregator/akregatorplugin.h
44–45

Sure, the other function should stay.

marten marked an inline comment as done.May 12 2018, 8:00 PM
marten added inline comments.
plugins/akregator/akregatorplugin.cpp
72

Will fix in commit.

This revision was not accepted when it landed; it landed in state Needs Review.May 13 2018, 1:42 PM
This revision was automatically updated to reflect the committed changes.
marten marked an inline comment as done.