Simplify delete_cur_item for UrlCompletionModel.
This commit is contained in:
parent
08fe1d59e6
commit
d9d68db5df
@ -150,16 +150,17 @@ class UrlCompletionModel(base.BaseCompletionModel):
|
|||||||
completion: The Completion object to use.
|
completion: The Completion object to use.
|
||||||
"""
|
"""
|
||||||
index = completion.currentIndex()
|
index = completion.currentIndex()
|
||||||
model = completion.model()
|
qtutils.ensure_valid(index)
|
||||||
url = model.data(index)
|
url = index.data()
|
||||||
category = index.parent()
|
category = index.parent()
|
||||||
if category.isValid():
|
qtutils.ensure_valid(category)
|
||||||
if category.data() == 'Bookmarks':
|
|
||||||
bookmark_manager = objreg.get('bookmark-manager')
|
if category.data() == 'Bookmarks':
|
||||||
bookmark_manager.delete(url)
|
bookmark_manager = objreg.get('bookmark-manager')
|
||||||
elif category.data() == 'Quickmarks':
|
bookmark_manager.delete(url)
|
||||||
quickmark_manager = objreg.get('quickmark-manager')
|
elif category.data() == 'Quickmarks':
|
||||||
sibling = index.sibling(index.row(), self.TEXT_COLUMN)
|
quickmark_manager = objreg.get('quickmark-manager')
|
||||||
qtutils.ensure_valid(sibling)
|
sibling = index.sibling(index.row(), self.TEXT_COLUMN)
|
||||||
name = model.data(sibling)
|
qtutils.ensure_valid(sibling)
|
||||||
quickmark_manager.quickmark_del(name)
|
name = model.data(sibling)
|
||||||
|
quickmark_manager.quickmark_del(name)
|
||||||
|
Loading…
Reference in New Issue
Block a user