Added possibility to remove bookmarks and quickmarks.
This commit is contained in:
parent
c8bbef0ab0
commit
f1874ff44f
@ -171,7 +171,7 @@ class UrlCompletionModel(base.BaseCompletionModel):
|
|||||||
url: The url of the bookmark which has been removed.
|
url: The url of the bookmark which has been removed.
|
||||||
"""
|
"""
|
||||||
for i in range(self._bookmark_cat.rowCount()):
|
for i in range(self._bookmark_cat.rowCount()):
|
||||||
url_item = self._bookmark_cat.child(i, 1)
|
url_item = self._bookmark_cat.child(i, 0)
|
||||||
if url_item.data(Qt.DisplayRole) == url:
|
if url_item.data(Qt.DisplayRole) == url:
|
||||||
self._bookmark_cat.removeRow(i)
|
self._bookmark_cat.removeRow(i)
|
||||||
break
|
break
|
||||||
|
@ -26,7 +26,7 @@ from qutebrowser.keyinput import modeman, modeparsers
|
|||||||
from qutebrowser.commands import cmdexc, cmdutils
|
from qutebrowser.commands import cmdexc, cmdutils
|
||||||
from qutebrowser.misc import cmdhistory
|
from qutebrowser.misc import cmdhistory
|
||||||
from qutebrowser.misc import miscwidgets as misc
|
from qutebrowser.misc import miscwidgets as misc
|
||||||
from qutebrowser.utils import usertypes, log, objreg, qtutils
|
from qutebrowser.utils import message, usertypes, log, objreg, qtutils
|
||||||
|
|
||||||
|
|
||||||
class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
||||||
@ -211,7 +211,30 @@ class Command(misc.MinimalLineEditMixin, misc.CommandLineEdit):
|
|||||||
e.ignore()
|
e.ignore()
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
super().keyPressEvent(e)
|
if e.key() == Qt.Key_D and e.modifiers() & Qt.ControlModifier == Qt.ControlModifier:
|
||||||
|
self.delete_current_item()
|
||||||
|
else:
|
||||||
|
super().keyPressEvent(e)
|
||||||
|
|
||||||
|
def delete_current_item(self):
|
||||||
|
completer_obj = objreg.get('completer', scope='window',
|
||||||
|
window=self._win_id)
|
||||||
|
completion = objreg.get('completion', scope='window',
|
||||||
|
window=self._win_id)
|
||||||
|
index = completion.currentIndex()
|
||||||
|
model = completion.model()
|
||||||
|
url = model.data(index)
|
||||||
|
category = index.parent()
|
||||||
|
if category.isValid():
|
||||||
|
if category.data() == 'Bookmarks':
|
||||||
|
bookmark_manager = objreg.get('bookmark-manager')
|
||||||
|
bookmark_manager.bookmark_del(url)
|
||||||
|
message.info(self._win_id, "Bookmarks deleted")
|
||||||
|
elif category.data() == 'Quickmarks':
|
||||||
|
quickmark_manager = objreg.get('quickmark-manager')
|
||||||
|
name = model.data(index.sibling(index.row(), index.column() + 1))
|
||||||
|
quickmark_manager.quickmark_del(name)
|
||||||
|
message.info(self._win_id, "Quickmarks deleted")
|
||||||
|
|
||||||
def sizeHint(self):
|
def sizeHint(self):
|
||||||
"""Dynamically calculate the needed size."""
|
"""Dynamically calculate the needed size."""
|
||||||
|
Loading…
Reference in New Issue
Block a user