From ee2f4664705e139e90b28351f4d76a3e5fbab12d Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 6 Sep 2020 13:48:52 +0200 Subject: cleanup: use taxonomy_get_value() instead of taxonomy_get_index() Instead of getting the index and using that to access values, use the taxonomy_get_value() helper function. Two places are affected: 1) reverse geo-lookup 2) location filter delegate The behavior of reverse geo-lookup is changed slightly: now an empty string is likewise recognized as missing "TC_ADMIN_L3". Before, only a missing category was interpreted as such. Signed-off-by: Berthold Stoeger --- desktop-widgets/modeldelegates.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'desktop-widgets') diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp index 093a25a43..94162fd8f 100644 --- a/desktop-widgets/modeldelegates.cpp +++ b/desktop-widgets/modeldelegates.cpp @@ -404,12 +404,12 @@ void LocationFilterDelegate::paint(QPainter *painter, const QStyleOptionViewItem for (int i = 0; i < 3; i++) { if (prefs.geocoding.category[i] == TC_NONE) continue; - int idx = taxonomy_index_for_category(&ds->taxonomy, prefs.geocoding.category[i]); - if (idx == -1) + const char *value = taxonomy_get_value(&ds->taxonomy, prefs.geocoding.category[i]); + if (empty_string(value)) continue; if(!bottomText.isEmpty()) bottomText += " / "; - bottomText += QString(ds->taxonomy.category[idx].value); + bottomText += QString(value); } if (bottomText.isEmpty()) -- cgit v1.2.3-70-g09d2