Fixed empty title.
This commit is contained in:
parent
1e354a797e
commit
5dbaea7a83
@ -76,12 +76,13 @@ class BookmarkManager(QObject):
|
|||||||
if not line.strip():
|
if not line.strip():
|
||||||
# Ignore empty or whitespace-only lines.
|
# Ignore empty or whitespace-only lines.
|
||||||
continue
|
continue
|
||||||
try:
|
|
||||||
url, title = line.split(maxsplit=1)
|
parts = line.split(maxsplit=1)
|
||||||
except ValueError:
|
if len(parts) == 2:
|
||||||
message.error(0, "Invalid bookmark '{}'".format(line))
|
self.bookmarks[parts[0]] = parts[1]
|
||||||
else:
|
elif len(parts) == 1:
|
||||||
self.bookmarks[url] = title
|
self.bookmarks[parts[0]] = ''
|
||||||
|
|
||||||
filename = os.path.join(standarddir.config(), 'bookmarks/urls')
|
filename = os.path.join(standarddir.config(), 'bookmarks/urls')
|
||||||
objreg.get('save-manager').add_saveable(
|
objreg.get('save-manager').add_saveable(
|
||||||
'bookmark-manager', self.save, self.changed,
|
'bookmark-manager', self.save, self.changed,
|
||||||
|
@ -102,8 +102,7 @@ class CommandDispatcher:
|
|||||||
|
|
||||||
def _current_title(self):
|
def _current_title(self):
|
||||||
"""Convenience method to get the current title."""
|
"""Convenience method to get the current title."""
|
||||||
title = self._current_widget().title()
|
return self._current_widget().title()
|
||||||
return title if title else "(null)"
|
|
||||||
|
|
||||||
def _current_widget(self):
|
def _current_widget(self):
|
||||||
"""Get the currently active widget from a command."""
|
"""Get the currently active widget from a command."""
|
||||||
|
Loading…
Reference in New Issue
Block a user