Fix URL handling for quickmarks.

This commit is contained in:
Florian Bruhin 2014-06-20 22:57:32 +02:00
parent 2d2ee71bee
commit 736f559afa
2 changed files with 11 additions and 5 deletions

View File

@ -639,8 +639,8 @@ class CommandDispatcher:
@cmdutils.register(instance='mainwindow.tabs.cmd') @cmdutils.register(instance='mainwindow.tabs.cmd')
def quickmark_load(self, name): def quickmark_load(self, name):
"""Load a quickmark.""" """Load a quickmark."""
url = quickmarks.get(name) urlstr = quickmarks.get(name)
self._tabs.currentWidget().openurl(url) self._tabs.currentWidget().openurl(QUrl(urlstr))
@cmdutils.register(instance='mainwindow.tabs.cmd') @cmdutils.register(instance='mainwindow.tabs.cmd')
def quickmark_load_tab(self, name): def quickmark_load_tab(self, name):

View File

@ -17,7 +17,12 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Manager for quickmarks.""" """Manager for quickmarks.
Note we violate our general QUrl rule by storing url strings in the marks
OrderedDict. This is because we read them from a file at start and write them
to a file on shutdown, so it makes semse to keep them as strings her.e
"""
from functools import partial from functools import partial
from collections import OrderedDict from collections import OrderedDict
@ -88,7 +93,8 @@ def quickmark_add(url, name):
def get(name): def get(name):
"""Get the URL of the quickmark named name.""" """Get the URL of the quickmark named name as a QUrl."""
if name not in marks: if name not in marks:
raise CommandError("Quickmark '{}' does not exist!".format(name)) raise CommandError("Quickmark '{}' does not exist!".format(name))
return marks[name] urlstr = marks[name]
return QUrl(urlstr)