2023-07-30 08:49:34 -04:00
|
|
|
// SPDX-FileCopyrightText: 2023 Joshua Goins <josh@redstrate.com>
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2023-09-16 17:32:38 -04:00
|
|
|
import QtCore
|
2023-09-20 15:57:27 -04:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls as QQC2
|
2023-09-16 17:32:38 -04:00
|
|
|
import QtQuick.Dialogs
|
2023-09-20 15:57:27 -04:00
|
|
|
import QtQuick.Layouts
|
2023-09-16 18:15:11 -04:00
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
import org.kde.kirigamiaddons.formcard as FormCard
|
2023-07-30 08:49:34 -04:00
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
FormCard.AbstractFormDelegate {
|
|
|
|
id: root
|
2023-07-30 08:49:34 -04:00
|
|
|
|
|
|
|
property string folder
|
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
signal accepted(string folder)
|
2023-07-30 08:49:34 -04:00
|
|
|
|
|
|
|
onClicked: dialog.open()
|
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
contentItem: RowLayout {
|
2023-10-08 20:24:35 -04:00
|
|
|
spacing: Kirigami.Units.mediumSpacing
|
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
ColumnLayout {
|
2023-10-08 20:24:35 -04:00
|
|
|
spacing: Kirigami.Units.mediumSpacing
|
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
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
|
2023-10-08 13:21:22 -04:00
|
|
|
direction: Qt.RightArrow
|
2023-09-20 15:57:27 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-16 17:32:38 -04:00
|
|
|
FolderDialog {
|
2023-07-30 08:49:34 -04:00
|
|
|
id: dialog
|
|
|
|
|
2023-09-20 15:57:27 -04:00
|
|
|
currentFolder: "file://" + root.folder
|
|
|
|
selectedFolder: "file://" + root.folder
|
|
|
|
|
|
|
|
onAccepted: root.accepted(decodeURIComponent(selectedFolder.toString().replace("file://", "")))
|
2023-07-30 08:49:34 -04:00
|
|
|
}
|
|
|
|
}
|