From 5e9fcfab7879095cbea566305b106fd41b518808 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Mon, 31 Jul 2023 19:00:42 -0400 Subject: [PATCH] Prevent opening windows and external browsers on the Steam Deck --- launcher/resources.qrc | 1 + launcher/ui/Pages/BrowserPage.qml | 26 ++++++++++++++++++++++++++ launcher/ui/main.qml | 18 ++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 launcher/ui/Pages/BrowserPage.qml diff --git a/launcher/resources.qrc b/launcher/resources.qrc index d4cd555..967f754 100644 --- a/launcher/resources.qrc +++ b/launcher/resources.qrc @@ -2,6 +2,7 @@ ui/Components/FormFileDelegate.qml ui/Components/FormFolderDelegate.qml + ui/Pages/BrowserPage.qml ui/Pages/LoginPage.qml ui/Pages/MainPage.qml ui/Pages/NewsPage.qml diff --git a/launcher/ui/Pages/BrowserPage.qml b/launcher/ui/Pages/BrowserPage.qml new file mode 100644 index 0000000..8ac751f --- /dev/null +++ b/launcher/ui/Pages/BrowserPage.qml @@ -0,0 +1,26 @@ +// SPDX-FileCopyrightText: 2023 Joshua Goins +// SPDX-License-Identifier: GPL-3.0-or-later + +import QtQuick 2.15 +import QtQuick.Window 2.15 +import org.kde.kirigami 2.20 as Kirigami +import QtQuick.Controls 2.15 as Controls +import QtQuick.Layouts 1.15 +import QtWebEngine 1.10 +import com.redstrate.astra 1.0 + +Kirigami.Page { + id: page + + property var url + + title: i18n("Web Browser") + + padding: 0 + + WebEngineView { + anchors.fill: parent + + url: page.url + } +} \ No newline at end of file diff --git a/launcher/ui/main.qml b/launcher/ui/main.qml index 4b54780..3974842 100644 --- a/launcher/ui/main.qml +++ b/launcher/ui/main.qml @@ -52,6 +52,24 @@ Kirigami.ApplicationWindow { } } + function pushDialogLayer(url) { + if (LauncherCore.isSteamDeck) { + pageStack.layers.push(url) + } else { + pageStack.pushDialogLayer(url) + } + } + + function openUrl(url) { + if (LauncherCore.isSteamDeck) { + pageStack.layers.push('qrc:/ui/Pages/BrowserPage.qml', { + url: url + }) + } else { + Qt.openUrlExternally(url) + } + } + Connections { target: LauncherCore