D24433: Move URL parsing methods from kioslave to query object
iasensio created this revision. iasensio added reviewers: Baloo, meven. Herald added projects: Frameworks, Baloo. Herald added a subscriber: kde-frameworks-devel. iasensio requested review of this revision. REVISION SUMMARY This allows for query objects generated from `Baloo::Query::fromSearchUrl` to use the same URLs parsing as those using the kioslave. Previously, only query urls with `json` format were available, while the kioslave could also parse the `query` keyword and simple type urls (e.g. `baloosearch://videos`) This was preventing the file type to be updated for places panels' default search urls (e.g. `baloosearch://videos`) TEST PLAN - Open dolphin searchbar and activate "More Options" - Type `baloosearch://images` - The type 'Images' gets selected REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 AFFECTED FILES src/kioslaves/search/kio_search.cpp src/lib/query.cpp To: iasensio, #baloo, meven Cc: kde-frameworks-devel, #dolphin, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio edited the summary of this revision. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven Cc: kde-frameworks-devel, #dolphin, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio added a comment. Friday ping 😃 REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven Cc: kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio added a dependent revision: D25130: [dolphin/search] Search by (multiple) tags. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven Cc: kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio removed a dependent revision: D25130: [dolphin/search] Search by (multiple) tags. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven Cc: kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
meven added a reviewer: ngraham. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham Cc: kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
meven added a reviewer: astippich. REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
meven accepted this revision. meven added a comment. This revision is now accepted and ready to land. Seems good to me. Tested and works REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, bruns, abrahams
D24433: Move URL parsing methods from kioslave to query object
bruns added inline comments. INLINE COMMENTS > query.cpp:317 > +{ > +const QString jsonQuery(QStringLiteral("{\"dayFilter\": 0,\ > + \"monthFilter\": 0, \ dayFilter/monthFilter/yearFilter are pointless, as they just default, but have to be parsed in `fromJSON`. > query.cpp:329 > +if (path == QLatin1String("/documents")) { > +return jsonQueryForType(QStringLiteral("Document")); > +} else if (path.endsWith(QLatin1String("/images"))) { can be replaced by `QStringLiteral("{\"type\":[\"Document\"]}")`, dito below. REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio updated this revision to Diff 69613. iasensio marked 2 inline comments as done. iasensio added a comment. Simplify helper function REPOSITORY R293 Baloo CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D24433?vs=67361&id=69613 BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 AFFECTED FILES src/kioslaves/search/kio_search.cpp src/lib/query.cpp To: iasensio, #baloo, meven, ngraham, astippich Cc: bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
bruns added a subscriber: broulik. bruns added inline comments. INLINE COMMENTS > kio_search.cpp:88 > -return jsonQueryForType(QStringLiteral("Document")); > -} else if (path.endsWith(QLatin1String("/images"))) { > -return jsonQueryForType(QStringLiteral("Image")); @broulik - why `endsWith()`? REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio updated this revision to Diff 69836. iasensio added a comment. Remove extra spaces REPOSITORY R293 Baloo CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D24433?vs=69613&id=69836 BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 AFFECTED FILES src/kioslaves/search/kio_search.cpp src/lib/query.cpp To: iasensio, #baloo, meven, ngraham, astippich Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio added inline comments. INLINE COMMENTS > bruns wrote in kio_search.cpp:88 > @broulik - why `endsWith()`? should I just change the comparisons to `path == ...`, just like the `/documents` one? REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
ngraham added a comment. @bruns, is this good to go now? REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
ngraham accepted this revision. ngraham added a comment. Let's do this unless @bruns objects soon. :) REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
bruns added inline comments. INLINE COMMENTS > query.cpp:342 > +QString jsonString = urlQuery.queryItemValue(QStringLiteral("json"), > QUrl::FullyDecoded); > +q = Query::fromJSON(jsonString.toUtf8()); > +} else if (urlQuery.hasQueryItem(QStringLiteral("query"))) { just `return Query::fromJSON(jsonString.toUtf8());` > query.cpp:343 > +q = Query::fromJSON(jsonString.toUtf8()); > +} else if (urlQuery.hasQueryItem(QStringLiteral("query"))) { > +QString queryString = > urlQuery.queryItemValue(QStringLiteral("query"), QUrl::FullyDecoded); remove the `else` > query.cpp:345 > +QString queryString = > urlQuery.queryItemValue(QStringLiteral("query"), QUrl::FullyDecoded); > +q.setSearchString(queryString); > +} else { just `return q;` > query.cpp:346 > +q.setSearchString(queryString); > +} else { > +const QString jsonString = jsonQueryFromUrl(url); remove `else` > query.cpp:349 > +if (!jsonString.isEmpty()) { > +q = Query::fromJSON(jsonString.toUtf8()); > +} just `return Query::fromJSON(jsonString.toUtf8());` REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
bruns requested changes to this revision. bruns added a comment. This revision now requires changes to proceed. just nitpicks ... REPOSITORY R293 Baloo REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich, bruns Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
iasensio updated this revision to Diff 71523. iasensio marked 5 inline comments as done. iasensio added a comment. - Use return statements REPOSITORY R293 Baloo CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D24433?vs=69836&id=71523 BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 AFFECTED FILES src/kioslaves/search/kio_search.cpp src/lib/query.cpp To: iasensio, #baloo, meven, ngraham, astippich, bruns Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
bruns accepted this revision. This revision is now accepted and ready to land. REPOSITORY R293 Baloo BRANCH extend_query_url REVISION DETAIL https://phabricator.kde.org/D24433 To: iasensio, #baloo, meven, ngraham, astippich, bruns Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams
D24433: Move URL parsing methods from kioslave to query object
This revision was automatically updated to reflect the committed changes. Closed by commit R293:34e682a1c0ed: Move URL parsing methods from kioslave to query object (authored by iasensio). REPOSITORY R293 Baloo CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D24433?vs=71523&id=71531 REVISION DETAIL https://phabricator.kde.org/D24433 AFFECTED FILES src/kioslaves/search/kio_search.cpp src/lib/query.cpp To: iasensio, #baloo, meven, ngraham, astippich, bruns Cc: broulik, bruns, kde-frameworks-devel, #dolphin, hurikhan77, lots0logs, LeGast00n, fbampaloukas, GB_2, domson, ashaposhnikov, michaelh, astippich, spoorun, ngraham, abrahams