From a2b1e041d6ca9c41be34927cca7a1b96a59d06bf Mon Sep 17 00:00:00 2001 From: Philip Date: Sun, 17 Jun 2018 10:29:57 +0200 Subject: [PATCH] Implemented use of the order of url.open_categories_shown in the :open dialogue. Reworded the description of this option to match. --- qutebrowser/completion/models/urlmodel.py | 19 ++++++++++++------- qutebrowser/config/configdata.yml | 2 +- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/qutebrowser/completion/models/urlmodel.py b/qutebrowser/completion/models/urlmodel.py index 5b544ea3d..6cb3b1501 100644 --- a/qutebrowser/completion/models/urlmodel.py +++ b/qutebrowser/completion/models/urlmodel.py @@ -62,20 +62,25 @@ def url(*, info): bookmarks = objreg.get('bookmark-manager').marks.items() searchengines = config.val.url.searchengines.items() categories = config.val.url.open_categories_shown + models = {} if searchengines and "searchengines" in categories: - model.add_category(listcategory.ListCategory( - 'Search engines', searchengines, sort=False)) + models["searchengines"] = listcategory.ListCategory( + 'Search engines', searchengines, sort=False) if quickmarks and "quickmarks" in categories: - model.add_category(listcategory.ListCategory( + models["quickmarks"] = listcategory.ListCategory( 'Quickmarks', quickmarks, delete_func=_delete_quickmark, - sort=False)) + sort=False) if bookmarks and "bookmarks" in categories: - model.add_category(listcategory.ListCategory( - 'Bookmarks', bookmarks, delete_func=_delete_bookmark, sort=False)) + models["bookmarks"] = listcategory.ListCategory( + 'Bookmarks', bookmarks, delete_func=_delete_bookmark, sort=False) if info.config.get('completion.web_history_max_items') != 0 and "history" in categories: hist_cat = histcategory.HistoryCategory(delete_func=_delete_history) - model.add_category(hist_cat) + models["history"] = hist_cat + + for category in categories: + model.add_category(models[category]) + return model diff --git a/qutebrowser/config/configdata.yml b/qutebrowser/config/configdata.yml index a5a5a067e..d2176916c 100644 --- a/qutebrowser/config/configdata.yml +++ b/qutebrowser/config/configdata.yml @@ -1575,7 +1575,7 @@ url.open_categories_shown: - quickmarks - bookmarks - history - desc: Which categories should be shown in the :open dialogue. + desc: Which categories to show in the :open dialogue. The order of this list is used for ordering the categories. url.searchengines: