From b502b0a94a804e4dd748bf1999eb74d18655d43d Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Fri, 26 Sep 2014 21:41:54 +0200 Subject: [PATCH] QML UI: Allow shortcut prefixes in UI (bug 1949) Due to the way the QML UI re-uses the search field as URL entry field, we have to special-case additional prefixes, so that they are properly detected in the UI. --- share/gpodder/ui/qml/Subscribe.qml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/share/gpodder/ui/qml/Subscribe.qml b/share/gpodder/ui/qml/Subscribe.qml index 744a7c6c..003966fa 100644 --- a/share/gpodder/ui/qml/Subscribe.qml +++ b/share/gpodder/ui/qml/Subscribe.qml @@ -21,14 +21,23 @@ Item { function search() { var q = searchInput.text; - if (q.indexOf('http://') === 0 || q.indexOf('https://') === 0) { - /* Directly subscribe to a URL */ - subscribe.subscribe([q]); - } else { - /* Search the web directory */ - searchResultsListModel.search(q); - resultsSheet.open(); + var direct_prefixes = { + // See src/gpodder/util.py, normalize_feed_url(), this + // should be kept in sync if new prefixes are added + 'http://', 'https://', 'fb:', 'yt:', 'sc:', 'ytpl:' + }; + + for (var i=0; i