diff options
author | Florian Bruhin <git@the-compiler.org> | 2016-07-23 15:48:41 +0200 |
---|---|---|
committer | Florian Bruhin <git@the-compiler.org> | 2016-07-23 15:48:41 +0200 |
commit | 3d4a01ef4ce5e5007393229b5e725995dbbbfc1d (patch) | |
tree | ecf47f259db854aed9cfc684fe82df525afdf9a1 | |
parent | 02a06732ffc5a380208868f01aafb4a15b999874 (diff) | |
parent | 19077c8b47b7ef5eada5fa767990439ada02e4ac (diff) | |
download | qutebrowser-3d4a01ef4ce5e5007393229b5e725995dbbbfc1d.tar.gz qutebrowser-3d4a01ef4ce5e5007393229b5e725995dbbbfc1d.zip |
Merge branch 'winged-issue_1033_bookmark_display'
-rw-r--r-- | CHANGELOG.asciidoc | 1 | ||||
-rw-r--r-- | README.asciidoc | 1 | ||||
-rw-r--r-- | doc/help/commands.asciidoc | 4 | ||||
-rw-r--r-- | qutebrowser/browser/commands.py | 3 | ||||
-rw-r--r-- | qutebrowser/browser/urlmarks.py | 3 | ||||
-rw-r--r-- | qutebrowser/browser/webkit/network/qutescheme.py | 15 | ||||
-rw-r--r-- | qutebrowser/html/bookmarks.html | 34 | ||||
-rw-r--r-- | tests/end2end/features/urlmarks.feature | 13 |
8 files changed, 73 insertions, 1 deletions
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 16884d96d..6ebc25e6d 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -31,6 +31,7 @@ Added - New `:repeat-command` command (mapped to `.`) to repeat the last command. Note that two former default bundings conflict with that binding, unbinding them via `:unbind .i` and `:unbind .o` is recommended. +- New `qute:bookmarks` page which displays all bookmarks and quickmarks. Changed ~~~~~~~ diff --git a/README.asciidoc b/README.asciidoc index 33a11911e..acf7fbc09 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -181,6 +181,7 @@ Contributors, sorted by the number of commits in descending order: * Tomasz Kramkowski * Ismail S * Halfwit +* David Vogt * rikn00 * kanikaa1234 * haitaka diff --git a/doc/help/commands.asciidoc b/doc/help/commands.asciidoc index 4c64c9068..713b75d60 100644 --- a/doc/help/commands.asciidoc +++ b/doc/help/commands.asciidoc @@ -120,7 +120,7 @@ Syntax: +:bookmark-add ['url'] ['title']+ Save the current page as a bookmark, or a specific url. -If no url and title are provided, then save the current page as a bookmark. If a url and title have been provided, then save the given url as a bookmark with the provided title. +If no url and title are provided, then save the current page as a bookmark. If a url and title have been provided, then save the given url as a bookmark with the provided title. You can view all saved bookmarks on the link:qute://bookmarks[bookmarks page]. ==== positional arguments * +'url'+: url to save as a bookmark. If None, use url of current page. @@ -512,6 +512,8 @@ Syntax: +:quickmark-add 'url' 'name'+ Add a new quickmark. +You can view all saved quickmarks on the link:qute://bookmarks[bookmarks page]. + ==== positional arguments * +'url'+: The url to add as quickmark. * +'name'+: The name for the new quickmark. diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index 5192ac895..42b91f737 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1104,6 +1104,9 @@ class CommandDispatcher: If a url and title have been provided, then save the given url as a bookmark with the provided title. + You can view all saved bookmarks on the + link:qute://bookmarks[bookmarks page]. + Args: url: url to save as a bookmark. If None, use url of current page. title: title of the new bookmark. diff --git a/qutebrowser/browser/urlmarks.py b/qutebrowser/browser/urlmarks.py index df1302535..e7b78c310 100644 --- a/qutebrowser/browser/urlmarks.py +++ b/qutebrowser/browser/urlmarks.py @@ -178,6 +178,9 @@ class QuickmarkManager(UrlMarkManager): def quickmark_add(self, win_id, url, name): """Add a new quickmark. + You can view all saved quickmarks on the + link:qute://bookmarks[bookmarks page]. + Args: win_id: The window ID to display the errors in. url: The url to add as quickmark. diff --git a/qutebrowser/browser/webkit/network/qutescheme.py b/qutebrowser/browser/webkit/network/qutescheme.py index bfa722d43..85be4ceff 100644 --- a/qutebrowser/browser/webkit/network/qutescheme.py +++ b/qutebrowser/browser/webkit/network/qutescheme.py @@ -261,3 +261,18 @@ def qute_pdfjs(_win_id, request): "pdfjs resource requested but not found: {}".format(e.path)) raise QuteSchemeError("Can't find pdfjs resource '{}'".format(e.path), QNetworkReply.ContentNotFoundError) + + +@add_handler('bookmarks') +def qute_bookmarks(_win_id, _request): + """Handler for qute:bookmarks. Display all quickmarks / bookmarks.""" + bookmarks = sorted(objreg.get('bookmark-manager').marks.items(), + key=lambda x: x[1]) # Sort by title + quickmarks = sorted(objreg.get('quickmark-manager').marks.items(), + key=lambda x: x[0]) # Sort by name + + html = jinja.render('bookmarks.html', + title='Bookmarks', + bookmarks=bookmarks, + quickmarks=quickmarks) + return html.encode('UTF-8', errors='xmlcharrefreplace') diff --git a/qutebrowser/html/bookmarks.html b/qutebrowser/html/bookmarks.html new file mode 100644 index 000000000..2f82453ab --- /dev/null +++ b/qutebrowser/html/bookmarks.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} + +{% block style %} +table { border: 1px solid grey; border-collapse: collapse; width: 100%;} +th, td { border: 1px solid grey; padding: 0px 5px; } +th { background: lightgrey; } +{% endblock %} + +{% block content %} + +<table> + <tr> + <th><h3>Bookmark</h3></th> + <th><h3>URL</h3></th> + </tr> + {% for url, title in bookmarks %} + <tr> + <td><a href="{{url}}">{{title}}</a></td> + <td>{{url}}</td> + </tr> + {% endfor %} + <tr> + <th><h3>Quickmark</h3></th> + <th><h3>URL</h3></th> + </tr> + {% for name, url in quickmarks %} + <tr> + <td><a href="{{url}}">{{name}}</a></td> + <td>{{url}}</td> + </tr> + {% endfor %} +</table> + +{% endblock %} diff --git a/tests/end2end/features/urlmarks.feature b/tests/end2end/features/urlmarks.feature index 8f0136e59..010d87f90 100644 --- a/tests/end2end/features/urlmarks.feature +++ b/tests/end2end/features/urlmarks.feature @@ -186,3 +186,16 @@ Feature: quickmarks and bookmarks When I run :quickmark-add http://localhost:(port)/data/numbers/15.txt fifteen And I run :quickmark-del fifteen Then the quickmark file should not contain "fourteen http://localhost:*/data/numbers/15.txt " + + Scenario: Listing quickmarks + When I run :quickmark-add http://localhost:(port)/data/numbers/15.txt fifteen + And I run :quickmark-add http://localhost:(port)/data/numbers/14.txt fourteen + And I open qute:bookmarks + Then the page should contain the plaintext "fifteen" + And the page should contain the plaintext "fourteen" + + Scenario: Listing bookmarks + When I open data/title.html + And I run :bookmark-add + And I open qute:bookmarks + Then the page should contain the plaintext "Test title" |