Add another fallback

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad 2022-11-01 18:40:12 +00:00
parent d1626d20bd
commit 576867605d

View File

@ -290,15 +290,18 @@ void ModPage::openUrl(const QUrl& url)
ModPlatform::ListModel* model = newPage->listModel; ModPlatform::ListModel* model = newPage->listModel;
QListView* view = newPage->ui->packView; QListView* view = newPage->ui->packView;
connect(model->activeJob(), &Task::finished, [slug, model, view] { connect(model->activeJob(), &Task::finished, [url, slug, model, view] {
for (int row = 0; row < model->rowCount({}); row++) { for (int row = 0; row < model->rowCount({}); row++) {
QModelIndex index = model->index(row); QModelIndex index = model->index(row);
ModPlatform::IndexedPack pack = model->data(index, Qt::UserRole).value<ModPlatform::IndexedPack>(); ModPlatform::IndexedPack pack = model->data(index, Qt::UserRole).value<ModPlatform::IndexedPack>();
if (pack.slug == slug) { if (pack.slug == slug) {
view->setCurrentIndex(index); view->setCurrentIndex(index);
break; return;
} }
} }
// The final fallback.
QDesktopServices::openUrl(url);
}); });
return; return;