From c890aa18f7b24bbb0429456d8c4a9cbb1c8d2bb1 Mon Sep 17 00:00:00 2001 From: TheKodeToad Date: Tue, 1 Nov 2022 18:25:54 +0000 Subject: [PATCH] Only select correct mod Signed-off-by: TheKodeToad --- launcher/ui/pages/modplatform/ModPage.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 6a53e25e5..231e98f67 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -262,7 +262,7 @@ void ModPage::openUrl(const QUrl& url) prefixLength = 5; page = "modrinth"; } else if (APPLICATION->capabilities() & Application::SupportsFlame - && url.host() == "www.curseforge.com" + && (url.host() == "curseforge.com" || url.host() == "www.curseforge.com") && url.path().toLower().startsWith("/minecraft/mc-mods/")) { prefixLength = 19; page = "curseforge"; @@ -287,8 +287,15 @@ void ModPage::openUrl(const QUrl& url) newPage->ui->searchEdit->setText(slug); newPage->triggerSearch(); - connect(newPage->listModel->activeJob(), &Task::finished, [newPage] { - newPage->ui->packView->setCurrentIndex(newPage->listModel->index(0)); + connect(newPage->listModel->activeJob(), &Task::finished, [slug, newPage] { + for (int row = 0; row < newPage->listModel->rowCount({}); row++) { + QModelIndex index = newPage->listModel->index(row); + auto pack = newPage->listModel->data(index, Qt::UserRole).value(); + if (pack.slug == slug) { + newPage->ui->packView->setCurrentIndex(index); + break; + } + } }); return;