Port and enable the User Agent Changer plugin
ClosedPublic

Authored by marten on May 1 2020, 10:05 AM.

Details

Summary

The plugin is ported to use Qt5 and KF5, including:

  • Install rc file in additionally for WebEngine
  • Fix up include files
  • Use new Qt connect syntax
  • Conditionalise Qt::SkipEmptyParts/QString::SkipEmptyParts ready for 5.15
  • Use QUrl::topLevelDomain() in findTLD()

Note that a fix for D28647 needs to be incorporated into KIO, as otherwise the user agent can only be changed once.

Test Plan

Built Konqueror with this change and the initial fix from D28647. Tested with https://kluge.in-chemnitz.de/tools/browser.php to demonstrate that selecting a user agent from the menu changes the resulting HTTP header sent.

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 1 2020, 10:05 AM
marten created this revision.
dfaure requested changes to this revision.May 1 2020, 11:01 AM
dfaure added a subscriber: dfaure.
dfaure added inline comments.
plugins/uachanger/uachangerplugin.cpp
39

(not needed)

98

Are you sure the KConfigGroup keeps the KSharedConfig alive? It would be good if it did, but I'm not sure it does.
Putting the KSharedConfig into a local var seems safer to me.

Any reason not to use QLocale().uiLanguages()?

256

(wow that was broken)

394

could be const too

396

Please use return hostname; without parenthesis. return isn't a function.

401

same

This revision now requires changes to proceed.May 1 2020, 11:01 AM
pino added a subscriber: pino.May 1 2020, 11:06 AM
pino added inline comments.
plugins/uachanger/uachangerplugin.cpp
96–104

please use KLocalizedString::languages() instead

marten updated this revision to Diff 81677.May 1 2020, 2:13 PM
marten marked 6 inline comments as done.

Updated in accordance with review comments.

marten added inline comments.May 1 2020, 2:15 PM
plugins/uachanger/uachangerplugin.cpp
96–104

Didn't know about KLocalizedString::languages(), thanks for the pointer.

98

Have used the KSharedConfig::openConfig()->group(...) construct before and it seems to work, but no longer necessary because of below.

dfaure accepted this revision.May 1 2020, 3:10 PM
dfaure added inline comments.
plugins/uachanger/uachangerplugin.cpp
385

QUrl u; u.setScheme("http"); u.setHostName(hostname); would be better in case of special characters in the hostname.

This revision is now accepted and ready to land.May 1 2020, 3:10 PM
This revision was automatically updated to reflect the committed changes.