diff --git a/launcher/ui/Components/FormFolderDelegate.qml b/launcher/ui/Components/FormFolderDelegate.qml index d6d3c45..0f8f9bb 100644 --- a/launcher/ui/Components/FormFolderDelegate.qml +++ b/launcher/ui/Components/FormFolderDelegate.qml @@ -2,23 +2,66 @@ // SPDX-License-Identifier: GPL-3.0-or-later import QtCore +import QtQuick +import QtQuick.Controls as QQC2 import QtQuick.Dialogs +import QtQuick.Layouts -import org.kde.kirigamiaddons.labs.mobileform as MobileForm +import org.kde.kirigami as Kirigami +import org.kde.kirigamiaddons.formcard as FormCard -MobileForm.FormButtonDelegate { - id: control +FormCard.AbstractFormDelegate { + id: root property string folder - icon.name: "document-open-folder" - description: folder + signal accepted(string folder) onClicked: dialog.open() + contentItem: RowLayout { + ColumnLayout { + Layout.fillWidth: true + + QQC2.Label { + text: root.text + + Layout.fillWidth: true + } + + QQC2.Label { + text: root.folder + elide: Text.ElideRight + maximumLineCount: 1 + color: Kirigami.Theme.disabledTextColor + + Layout.fillWidth: true + } + } + + QQC2.ToolButton { + text: i18n("Open Folder") + icon.name: "document-open-folder" + display: QQC2.AbstractButton.IconOnly + onClicked: Qt.openUrlExternally("file://" + root.folder) + + QQC2.ToolTip.text: text + QQC2.ToolTip.delay: Kirigami.Units.toolTipDelay + QQC2.ToolTip.visible: hovered + } + + FormCard.FormArrow { + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + direction: FormCard.FormArrow.Right + } + } + FolderDialog { id: dialog - currentFolder: StandardPaths.standardLocations(StandardPaths.HomeLocation)[0] + currentFolder: "file://" + root.folder + selectedFolder: "file://" + root.folder + + onAccepted: root.accepted(decodeURIComponent(selectedFolder.toString().replace("file://", ""))) } } \ No newline at end of file diff --git a/launcher/ui/Settings/ProfileSettings.qml b/launcher/ui/Settings/ProfileSettings.qml index 307e75b..bc1fb03 100644 --- a/launcher/ui/Settings/ProfileSettings.qml +++ b/launcher/ui/Settings/ProfileSettings.qml @@ -44,6 +44,8 @@ FormCard.FormCardPage { text: i18n("Game Path") folder: page.profile.gamePath + + onAccepted: (folder) => page.profile.gamePath = folder } FormCard.FormDelegateSeparator {