Commit Graph

12252 Commits

Author SHA1 Message Date
Ryan Roden-Corrent
d89898ef7d Implement delete_cur_item for sql completion.
This re-enables bookmark/quickmark deletion for url completions via the new SQL
interface.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
fe80878788 Implement custom where clause in SQL.
Allow categories to specify a WHERE clause that applies in addition to the
pattern filter. This allows the url completion model to filter out redirect
entries.

This also fixed the usage of ESCAPE so it applies to all the LIKE statements.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
9f27a9a5d7 Implement column selectors for sql completion.
A SQL completion category can now provide a customized column expression for
the select statement. This enables the url model to format timestamps, as well
as rearrange the name and url in the quickmark section.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
3f6f03e325 Respect web-history-max-items with SQL.
Use a LIMIT with the sql competion model to limit history entries as the old
completion implementation did.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
df995c02a3 Get rid of varargs in sql.run_query.
Things are clearer when just passing a list.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
b70d5ba901 Use QSqlQueryModel instead of QSqlTableModel.
This allows setting the query as a QSqlQuery instead of a string, which allows:

- Escaping quotes
- Using LIMIT (needed for history-max-items)
- Using ORDER BY (needed for sorting history)
- SELECTing columns (needed for quickmark completion)
- Creating a custom select (needed for history timestamp formatting)
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
52d7d1df0c Use SQL completer for quickmarks/bookmarks. 2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
839d49a8ac Fix up pylint/flake8 for completion revamp. 2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
5bd047b70b Fix CompletionView.completion_item_del for new API.
The new function based completion models work a little differently so the view
needed slightly different error handling.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
b381148e06 Unittest CompletionView.completion_item_del.
There were no unit tests for this and the various ways it can fail, and I'm
about to screw with it a bit.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
c3155afc21 Rethrow KeyError as DoesNotExistError in urlmarks.
From @TheCompiler:
To expand on this: I think it's fine to use KeyError on a lower level, i.e.
with the SqlTable object with a dict-like interface. However, on this higher
level, I think it makes sense to re-raise them as more specific exceptions.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
a774647c26 Get test_models mostly working again.
- Adjust _check_completions to work for CompletionModel and SqlCompletionModel
- Move sql initialization into a reusable fixture
- Remove the bookmark/quickmark/history stubs, as they're now handled by sql
- Disable quickmark/bookmark model tests until their completion is ported to
  sql.
- Disable urlmodel tests for features that have to be implemented in SQL:
    - LIMIT (for history-max-items)
    - Configurable column order (for quickmarks)
    - Configurable formatting (for timestamp-format
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
d4f2a70f83 Slightly simplify CompletionModel.new_item.
There was no need to have a branch based on whether the misc value was None or
not.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
93f8984987 Install pyqt5.qtsql bindings for debian CI.
SQL is included in the Archlinux pyqt5 package, but not in Debian.
We need this so the debian-based CI builds will pass with the new
sql-based completion implementation.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
3005374ada Simplify sorting logic in sortfilter.
For URL completion, time-based sorting is handled by the SQL model.
All the other models use simple alphabetical sorting. This allowed cleaning up
some logic in the sortfilter, removing DUMB_SORT, and removing the
completion.Role.sort.

This also removes the userdata completion field as it was only used in url
completion and is no longer necessary with the SQL model.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
acea0d3c67 Use SQL completion for the open command.
Now that history, bookmark, and quickmark storage are SQL-backed, use
a sql completion model to serve url completions.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
6e1ea89ca1 Implement SQL completion model.
This model wraps one or more SQL tables and exposes data in a tiered
manner that can be consumed by the tree view used for completion.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
93d81d96ce Use SQL for quickmark/bookmark storage.
Store quickmarks and bookmarks in an in-memory sql database instead of a
python dict. Long-term storage is not affected, bookmarks and
quickmarks are still persisted in a text file.

The added and deleted signals were removed, as once sql completion
models are used the models will no longer need to update themselves.

This will set the stage for SQL-based history completion.
See #1765.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
9477a2eeb2 Use SQL for history storage.
The browser-wide in-memory web history is now stored in an in-memory sql
database instead of a python dict. Long-term storage is not affected, it
is still persisted in a text file of the same format.

This will set the stage for SQL-based history completion.
See #1765.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
f43f78c40f Implement SQL interface.
When qutebrowser starts, it creates an in-memory sqlite database. One
can instantiate a SqlTable to create a new table in the database. The
object provides an interface to query and modify the table.

This intended to serve as the base class for the quickmark, bookmark,
and history manager objects in objreg. Instead of reading their data
into an in-memory dict, they will read into an in-memory sql table.

Eventually the completion models for history, bookmarks, and quickmarks
can be replaced with SqlQuery models for faster creation and filtering.

See #1765.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
3b30b42211 Remove completion.instances, usertypes.Completion.
The new completion API no longer needs either of these. Instead of
referencing an enum member, cmdutils.argument.completion now points to
a function that returnsthe desired completion model.
This vastly simplifies the addition of new completion types. Previously
it was necessary to define the new model as well as editing usertypes
and completion.models.instances. Now it is only necessary to define a
single function under completion.models.

This is the next step of Completion Model/View Revamping (#74).
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
b36cf0572d Avoid potential circular import in config.py.
There was a circular import from
config -> keyconf -> miscmodels -> config.
This is resolved by scoping config's keyconf import to the one function
that uses it.
2017-06-19 07:42:12 -04:00
Ryan Roden-Corrent
08bb3f4f19 Implement completion models as functions.
First step of Completion Model/View revamping (#74). Rewrite the
completion models as functions that each return an instance of a
CompletionModel class.

Caching is removed from all models except the UrlModel. Models other
than the UrlModel can be generated very quickly so caching just adds
needless complexity and can lead to incorrect results if one forgets to
wire up a signal.
2017-06-19 07:42:12 -04:00
Florian Bruhin
bef372e5f5 Clear search on page load
Fixes #2728
2017-06-19 10:27:27 +02:00
Florian Bruhin
4ae8e247d0 Show 'legacy QtWebKit' in version output 2017-06-19 10:24:33 +02:00
Florian Bruhin
8191a5465a Regenerate authors 2017-06-19 09:44:04 +02:00
Florian Bruhin
5bb63e67e0 Remove another stray # 2017-06-19 09:43:45 +02:00
Florian Bruhin
8494332c3a Merge branch 'fix-tabbar-padding' of https://github.com/kmarius/qutebrowser 2017-06-19 09:43:26 +02:00
Florian Bruhin
df6c4c6e73 Fix earlyinit.qt_version issues 2017-06-19 09:42:49 +02:00
Florian Bruhin
9b5227b987 Improve test_version output 2017-06-19 09:06:18 +02:00
Florian Bruhin
6c534bea6b Actually remove version import in earlyinit... 2017-06-19 08:59:26 +02:00
Florian Bruhin
fdba676933 Move version.qt_version() to earlyinit
Importing version in earlyinit is a bad idea, as it already pulls in a lot of
stuff we don't want.
2017-06-19 08:57:29 +02:00
Marius
de743732aa remove # inside comment 2017-06-19 08:29:23 +02:00
Marius
ebd442ea95 add needed parens and remove trailing whitespace 2017-06-18 23:07:38 +02:00
Marius
68f172558b fix line length 2017-06-18 22:44:06 +02:00
Marius
4b2bf12efa Fix padding of remaining tabbar space with pinned tabs 2017-06-18 21:49:04 +02:00
Florian Bruhin
a5db21abe9 Update FAQ, fixes #2732 2017-06-17 15:47:39 +02:00
Florian Bruhin
695a2656fe Rename webelem.js functions to match WebEngineElem
Fixes #2726
2017-06-16 23:14:17 +02:00
Florian Bruhin
9cc688ea2b Fix initial tab sizing with vertical tabbar 2017-06-16 23:00:16 +02:00
Florian Bruhin
b37d040d44 Add version check for 5.8 search segfault workaround 2017-06-14 10:57:32 +02:00
Florian Bruhin
2ffb10badf Merge pull request #2715 from qutebrowser/pyup-scheduled-update-06-12-2017
Scheduled weekly dependency update for week 24
2017-06-14 10:44:11 +02:00
Florian Bruhin
54154e2434 Mark :stop test as flaky
Looks like the requests sometimes aren't updated, but I have no idea why.
2017-06-12 18:15:05 +02:00
Florian Bruhin
38d54cb112 Stabilize history tests
Get current URL right away in :view-source, and wait until source is shown in
the test.
2017-06-12 18:13:17 +02:00
pyup-bot
c9979d18db Update pytest from 3.1.1 to 3.1.2 2017-06-12 15:45:19 +02:00
pyup-bot
a2878a382c Update hypothesis from 3.11.1 to 3.11.3 2017-06-12 15:45:17 +02:00
pyup-bot
1deb6e53d0 Update chardet from 3.0.3 to 3.0.4 2017-06-12 15:45:16 +02:00
pyup-bot
227fd47f2f Update chardet from 3.0.3 to 3.0.4 2017-06-12 15:45:15 +02:00
pyup-bot
62d56237bd Update chardet from 3.0.3 to 3.0.4 2017-06-12 15:45:13 +02:00
Florian Bruhin
b687ede25c Adjust eslintrc for eslint 4.0 2017-06-12 09:23:20 +02:00
Florian Bruhin
57fbfbd606 Set an initial window size for background tabs
When we open a background tab, it gets a hardcoded size (800x600 or so) because
it doesn't get resized by the layout yet.

By resizing it to the size it'll actually have later, we make sure scrolling to
an anchor in an background tab works, and JS also gets the correct size for
background tabs.

Fixes #1190
Fixes #2495
See #1417
2017-06-11 17:48:01 +02:00