summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2016-07-23 15:42:33 +0200
committerFlorian Bruhin <git@the-compiler.org>2016-07-23 15:42:33 +0200
commit91b754d6ea73a95b6301a3e3f1e8183a14ed7fe5 (patch)
tree5848ba5bd207c4f185fa8796a5bb07fd0f222a81
parent02a06732ffc5a380208868f01aafb4a15b999874 (diff)
parent1f320b86869fa23111fcdb54f30105ba0a86d1a1 (diff)
downloadqutebrowser-91b754d6ea73a95b6301a3e3f1e8183a14ed7fe5.tar.gz
qutebrowser-91b754d6ea73a95b6301a3e3f1e8183a14ed7fe5.zip
Merge branch 'issue_1033_bookmark_display' of https://github.com/winged/qutebrowser into winged-issue_1033_bookmark_display
-rw-r--r--qutebrowser/browser/commands.py3
-rw-r--r--qutebrowser/browser/urlmarks.py3
-rw-r--r--qutebrowser/browser/webkit/network/qutescheme.py15
-rw-r--r--qutebrowser/html/bookmarks.html34
-rw-r--r--tests/end2end/features/urlmarks.feature13
5 files changed, 68 insertions, 0 deletions
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"