[Client] Route cockatrice:// link clicks from chat to the intent chain (#7136)

* [Client] Route cockatrice:// link clicks from chat to the intent chain

A cockatrice:// link clicked in chat is currently handed to the OS (or
does nothing in-process). Clicks now emit a cockatriceLinkActivated signal
that travels ChatView -> Tab -> TabSupervisor -> MainWindow, which feeds
the URL through the same IntentUrlParser the OS activation path uses, so
the join runs entirely in-process. card/user schemes and all other links
behave as before.

* [Client] Route cockatrice:// link clicks from the in-game chat to the intent chain

* [Client] Reuse one IntentUrlParser instance for cockatrice:// links

Took 59 seconds

---------

Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
BruebachL 2026-08-17 01:03:37 +02:00 committed by GitHub
parent 3de7882f0c
commit 60ee81cfbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 25 additions and 0 deletions

View file

@ -40,6 +40,7 @@
#include "intents/intent_connect_to_server.h"
#include "intents/intent_login.h"
#include "intents/intent_open_server_room_by_name.h"
#include "intents/url_parser.h"
#include "logger.h"
#include "version_string.h"
#include "widgets/dialogs/dlg_connect.h"
@ -497,6 +498,7 @@ MainWindow::MainWindow(QWidget *parent)
pixmapCacheSizeChanged(SettingsCache::instance().cacheStorage().getPixmapCacheSize());
connectionController = new ConnectionController(this, this);
urlParser = new IntentUrlParser(this, this);
createActions();
createMenus();
@ -508,6 +510,7 @@ MainWindow::MainWindow(QWidget *parent)
connect(tabSupervisor, &TabSupervisor::setMenu, this, &MainWindow::updateTabMenu);
connect(tabSupervisor, &TabSupervisor::localGameEnded, this, &MainWindow::localGameEnded);
connect(tabSupervisor, &TabSupervisor::showWindowIfHidden, this, &MainWindow::showWindowIfHidden);
connect(tabSupervisor, &TabSupervisor::cockatriceLinkActivated, this, &MainWindow::handleCockatriceLink);
connect(connectionController, &ConnectionController::tabSupervisorStartRequested, tabSupervisor,
&TabSupervisor::start);
connect(connectionController, &ConnectionController::tabSupervisorStopRequested, tabSupervisor,
@ -861,6 +864,11 @@ void MainWindow::showWindowIfHidden()
show();
}
void MainWindow::handleCockatriceLink(const QString &url)
{
urlParser->handle(url);
}
void MainWindow::cardDatabaseLoadingFailed()
{
if (askedForDbUpdater) {