Warning, /plasma/xdg-desktop-portal-kde/src/DynamicLauncherDialog.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0002 // SPDX-FileCopyrightText: 2022 Harald Sitter <sitter@kde.org> 0003 0004 import QtQuick 2.15 0005 import QtQuick.Layouts 1.15 0006 import QtQuick.Controls 2.15 as QQC2 0007 import org.kde.kirigami 2.14 as Kirigami 0008 import org.kde.plasma.workspace.dialogs 1.0 as PWD 0009 import org.kde.kquickcontrolsaddons 2.0 as KQuickAddons 0010 0011 PWD.SystemDialog 0012 { 0013 id: root 0014 0015 property var dialog 0016 property string appID 0017 property var launcherURL: "" 0018 property bool edit: false 0019 0020 readonly property var displayComponent: Component { 0021 ColumnLayout { 0022 Kirigami.Icon { 0023 id: icon 0024 Layout.alignment: Qt.AlignHCenter 0025 implicitWidth: Kirigami.Units.iconSizes.enormous 0026 implicitHeight: implicitWidth 0027 source: dialog.icon 0028 } 0029 0030 Kirigami.Heading { 0031 Layout.alignment: Qt.AlignHCenter 0032 Layout.fillWidth: true 0033 level: 3 0034 wrapMode: Text.Wrap 0035 text: dialog.name 0036 verticalAlignment: Qt.AlignTop 0037 } 0038 0039 Kirigami.LinkButton { 0040 Layout.fillWidth: true 0041 visible: text.length > 0 0042 Layout.alignment: Qt.AlignHCenter 0043 elide: Text.ElideMiddle 0044 text: launcherURL 0045 onClicked: Qt.openUrlExternally(launcherURL) 0046 } 0047 } 0048 } 0049 0050 readonly property var editComponent: Component { 0051 ColumnLayout { 0052 QQC2.Button { 0053 Layout.alignment: Qt.AlignHCenter 0054 contentItem: Kirigami.Icon { 0055 id: icon 0056 implicitHeight: implicitWidth 0057 implicitWidth: Kirigami.Units.iconSizes.enormous 0058 source: dialog.icon 0059 0060 KQuickAddons.IconDialog { 0061 id: iconDialog 0062 onIconNameChanged: dialog.icon = iconName 0063 } 0064 0065 TapHandler { 0066 onTapped: iconDialog.open() 0067 } 0068 } 0069 } 0070 0071 QQC2.Label { 0072 text: i18nc("@label name of a launcher/application", "Name") 0073 } 0074 QQC2.TextField { 0075 verticalAlignment: Qt.AlignTop 0076 Layout.alignment: Qt.AlignHCenter 0077 Layout.fillWidth: true 0078 onTextChanged: dialog.name = text 0079 Component.onCompleted: text = dialog.name 0080 } 0081 } 0082 } 0083 0084 Loader { 0085 id: contentLoader 0086 sourceComponent: root.edit ? editComponent : displayComponent 0087 } 0088 0089 actions: [ 0090 Kirigami.Action { 0091 text: i18nc("@action edit launcher name/icon", "Edit Info…") 0092 iconName: "document-edit" 0093 onCheckedChanged: root.edit = checked 0094 checkable: true 0095 }, 0096 Kirigami.Action { 0097 text: i18nc("@action accept dialog and create launcher", "Accept") 0098 iconName: "dialog-ok" 0099 onTriggered: accept() 0100 }, 0101 Kirigami.Action { 0102 text: i18nc("@action", "Cancel") 0103 iconName: "dialog-cancel" 0104 onTriggered: reject() 0105 } 0106 ] 0107 }