Implement feature request #1033: Bookmark display

There is a new page now, qute:bookmarks that will display all bookmarks and
quickmarks. It's still missing a search / filter feature, but you can use
the built-in search / navigation just as easily for now.
This commit is contained in:
David Vogt 2016-07-23 12:09:49 +02:00
parent 63e466f019
commit 85be6565fc
3 changed files with 75 additions and 0 deletions

View File

@ -261,3 +261,17 @@ 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. Show a list of all quickmarks / bookmarks"""
bookmarks = objreg.get('bookmark-manager').marks.items()
quickmarks = objreg.get('quickmark-manager').marks.items()
html = jinja.render('bookmarks.html',
title='Bookmarks',
bookmarks=bookmarks,
quickmarks=quickmarks)
return html.encode('UTF-8', errors='xmlcharrefreplace')

View File

@ -0,0 +1,48 @@
{% extends "base.html" %}
{% block script %}
var win_id = {{ win_id }};
var cset = function(section, option, el) {
value = el.value;
window.qute.set(win_id, section, option, value);
}
{% endblock %}
{% block style %}
table { border: 1px solid grey; border-collapse: collapse; width: 100%;}
pre { margin: 2px; }
th, td { border: 1px solid grey; padding: 0px 5px; }
th { background: lightgrey; }
th pre { color: grey; text-align: left; }
.noscript, .noscript-text { color:red; }
.noscript-text { margin-bottom: 5cm; }
h4 { line-height: 1.2em; }
{% endblock %}
{% block content %}
<noscript><h1 class="noscript">View Only</h1><p class="noscript-text">Changing settings requires javascript to be enabled!</p></noscript>
<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 %}

View File

@ -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"