1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 20:34:39 +01:00

When clicking on a provider, on the global search result list, add all results from this provider to the playlist.

Fixes issue 3132.
This commit is contained in:
Arnaud Bienner 2014-09-13 22:57:58 +02:00
parent 8be65b8565
commit bc1d56f935

View File

@ -240,6 +240,23 @@ void GlobalSearchModel::GetChildResults(
QVariant result = item->data(Role_Result);
if (result.isValid()) {
results->append(result.value<SearchProvider::Result>());
} else {
// Maybe it's a provider then?
bool is_provider;
const int sort_index = item->data(Role_ProviderIndex).toInt(&is_provider);
if (is_provider) {
// Go through all the items (through the proxy to keep them ordered) and
// add the ones belonging to this provider to our list
for (int i = 0; i < proxy_->rowCount(invisibleRootItem()->index()); ++i) {
QModelIndex child_index =
proxy_->index(i, 0, invisibleRootItem()->index());
const QStandardItem* child_item =
itemFromIndex(proxy_->mapToSource(child_index));
if (child_item->data(Role_ProviderIndex).toInt() == sort_index) {
GetChildResults(child_item, results, visited);
}
}
}
}
}
}