Don't show message when deleting items.

This commit is contained in:
Florian Bruhin 2015-07-26 18:48:00 +02:00
parent ecf3e166ff
commit b962fff7f1
2 changed files with 6 additions and 8 deletions

View File

@ -486,7 +486,9 @@ class Completer(QObject):
modes=[usertypes.KeyMode.command], scope='window') modes=[usertypes.KeyMode.command], scope='window')
def completion_item_del(self): def completion_item_del(self):
"""Delete the current completion item.""" """Delete the current completion item."""
completion = objreg.get('completion', scope='window',
window=self._win_id)
try: try:
self.model().srcmodel.delete_cur_item(self._win_id) self.model().srcmodel.delete_cur_item(completion)
except NotImplementedError: except NotImplementedError:
raise cmdexc.CommandError("Cannot delete this item.") raise cmdexc.CommandError("Cannot delete this item.")

View File

@ -23,7 +23,7 @@ import datetime
from PyQt5.QtCore import pyqtSlot, Qt from PyQt5.QtCore import pyqtSlot, Qt
from qutebrowser.utils import message, objreg, utils, qtutils from qutebrowser.utils import objreg, utils, qtutils
from qutebrowser.completion.models import base from qutebrowser.completion.models import base
from qutebrowser.config import config from qutebrowser.config import config
@ -143,14 +143,12 @@ class UrlCompletionModel(base.BaseCompletionModel):
""" """
self._remove_item(url, self._bookmark_cat, self.URL_COLUMN) self._remove_item(url, self._bookmark_cat, self.URL_COLUMN)
def delete_cur_item(self, win_id): def delete_cur_item(self, completion):
"""Delete the selected item. """Delete the selected item.
Args: Args:
win_id: The current windows id. completion: The Completion object to use.
""" """
completion = objreg.get('completion', scope='window',
window=win_id)
index = completion.currentIndex() index = completion.currentIndex()
model = completion.model() model = completion.model()
url = model.data(index) url = model.data(index)
@ -159,11 +157,9 @@ class UrlCompletionModel(base.BaseCompletionModel):
if category.data() == 'Bookmarks': if category.data() == 'Bookmarks':
bookmark_manager = objreg.get('bookmark-manager') bookmark_manager = objreg.get('bookmark-manager')
bookmark_manager.delete(url) bookmark_manager.delete(url)
message.info(win_id, "Bookmarks deleted")
elif category.data() == 'Quickmarks': elif category.data() == 'Quickmarks':
quickmark_manager = objreg.get('quickmark-manager') quickmark_manager = objreg.get('quickmark-manager')
sibling = index.sibling(index.row(), self.TEXT_COLUMN) sibling = index.sibling(index.row(), self.TEXT_COLUMN)
qtutils.ensure_valid(sibling) qtutils.ensure_valid(sibling)
name = model.data(sibling) name = model.data(sibling)
quickmark_manager.quickmark_del(name) quickmark_manager.quickmark_del(name)
message.info(win_id, "Quickmarks deleted")