git ls-files | \
xargs grep -l "This file is part of qutebrowser" | \
xargs grep -l SPDX-License-Identifier | \
xargs sed -i '/# This file is part of qutebrowser\./,/along with qutebrowser\. If not, see <https:\/\/www\.gnu.org\/licenses\/>./d'
We're deprecating vim modelines in favor of `.editorconfig`.
Removing vim modelines could be done using two one-liners. Most of the vim modelines
were followed by an empty line, so this one-liner took care of these ones:
```sh
rg '^# vim: .+\n\n' -l | xargs sed -i '/^# vim: /,+1d'
```
Then some of the vim modelines were followed by a pylint configuration line, so running
this one-liner afterwards took care of that:
```sh
rg '^# vim:' -l | xargs sed -i '/^# vim: /d'
```
Those are handled separately from the other settings, but were never initialized
properly in init_settings().
For content.javascript.clipboard, this is a recent regression introduced in
4a6df3a8e8. For content.default_encoding, this has
been around since 2018: 3956f81e73.
Fixes#7281
When e.g. doing:
- '?foo' (search with reverse=True -> FindBackwards)
- 'N' (prev_result -> no FindBackwards)
- 'n' (next_result -> FindBackwards again)
we need to take a copy of the flags so that we can temporarily clear
FindBackwards when pressing 'N'.
Relevant history:
- We originally did int(self._flags) in
d450257485.
- In f0da508c21, we used
QWebPage.FindFlags(int(self._flags)) instead.
- With 97bdcb8e674c8ff27ab92448effef263880ab3aa (picked from
c349fbd180) we instead do:
flags = QWebEnginePage.FindFlag(self._flags)
Using FindFlag instead of FindFlags seemed to work fine with PyQt6 and
enum.Flag. With PyQt5, however, later clearing a flag bit ends up with us
getting 0 as an integer, thus losing the type information about this being a
FindFlag instance, and resulting in a TypeError when calling into Qt.
We could use FindFlags() with PyQt 6 but FindFlag() with PyQt 5 to copy the
original flags, but that's getting rather cumbersome. Instead, let's have a
helper dataclass of bools, do away with the bit-twiddling, and only convert it
to a Qt flags when we actually need them. This solves the copying issue nicely,
and also makes the code a lot nicer.
Finally, this also adds a test case which fails when the flags are mutated in
place instead of copied.
We could do the same kind of change for QtWebKit as well, but given that it's
somewhat dead - and perhaps more importantly, won't run with Qt 6 - let's not
bother. To not break the end2end tests with QtWebKit, the output still is the
same as before.
(cherry picked from commit 96a0cc39512753445bc7a01b218b2f1290819ddd)
We now use versions.webengine_versions() to get the real QtWebEngine
version. This is more accurate and also allows us to drop the
InstalledApp workaround with QtWebEngine 5.15.3.
Also, we pass a WebEngineVersions object around instead of asking for
the versions multiple times. This also leads to less patching in tests.
See #3785
With QtWebEngine, downloading a data: URL seems to give us the raw data:
URL as filename, similar to #1214 / #1321 but for QtWebEngine.
With QtWebKit, the logic is now also improved so that we get a proper
extension rather than a "binary blob" filename.
See #1099
Since #5813, we now do more work there - and there already is quite a
bit of odd patching, so this isn't really the right way forward.
For now, replicate the initialization steps we *actually* need inside
the tests. I'm not entirely happy with this solution, but it's likely we
can revisit this to find something nicer when refactoring profile
initialization in general, see #5935.
This unfortunately also means there's no good way we can do what
`test_default_user_agent_saved` did, so I ended up removing it.
Turns out Qt 5.15.{0,1} also needs `--force-dark-mode`. This commit
fixes it to only use the blink-setting on Qt 5.15.2 and up. It also
parameterizes the tests better to test that the settings work on their
respective Qt versions.
On Qt 5.15+, `--force-dark-mode` does not set the preferred colorscheme.
A blink-setting is used instead to set the preferred colorscheme.
The `--force-dark-mode` flag is only set for Qt 5.14. All later versions
will use the blink-setting flag.