Warning, /plasma/plasma-sdk/lookandfeelexplorer/package/contents/ui/MetadataEditor.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 2.3 0008 import QtQuick.Layouts 1.1 0009 import QtQuick.Controls 2.15 as QQC2 0010 import QtQuick.Dialogs 0011 import org.kde.kirigami 2.3 as Kirigami 0012 0013 QQC2.Dialog { 0014 id: dialog 0015 property alias pluginName: pluginNameField.text 0016 property alias name: nameField.text 0017 property alias comment: commentField.text 0018 property alias author: authorField.text 0019 property alias email: emailField.text 0020 property alias license: licenseField.editText 0021 property alias website: websiteField.text 0022 0023 property bool canEdit: false 0024 0025 width: 500 0026 x: (parent.width - width) / 2 0027 y: (parent.height - height) / 2 0028 title: i18n("New Theme") 0029 0030 onVisibleChanged: { 0031 nameField.focus = true 0032 } 0033 0034 contentItem: Rectangle { 0035 SystemPalette { 0036 id: palette 0037 } 0038 color: palette.window 0039 0040 ColumnLayout { 0041 id: layout 0042 anchors { 0043 fill: parent 0044 margins: Kirigami.Units.smallSpacing 0045 } 0046 QQC2.Label { 0047 id: errorMessage 0048 text: "" 0049 wrapMode: Text.WordWrap 0050 Layout.fillWidth: true 0051 } 0052 Kirigami.FormLayout { 0053 Layout.fillWidth: true 0054 QQC2.TextField { 0055 id: pluginNameField 0056 Layout.fillWidth: true 0057 Kirigami.FormData.label: i18n("Theme Plugin Name:") 0058 onTextChanged: { 0059 for (var i = 0; i < lnfLogic.lnfList.count; ++i) { 0060 if (pluginNameField.text == lnfLogic.lnfList.get(i).packageNameRole) { 0061 dialog.canEdit = false; 0062 errorMessage.text = i18n("This theme plugin name already exists"); 0063 return; 0064 } 0065 } 0066 errorMessage.text = ""; 0067 dialog.canEdit = true; 0068 } 0069 } 0070 QQC2.TextField { 0071 id: "nameField" 0072 Kirigami.FormData.label: i18n("Theme Name:") 0073 } 0074 QQC2.TextField { 0075 id: "commentField" 0076 Kirigami.FormData.label: i18n("Comment:") 0077 } 0078 QQC2.TextField { 0079 id: "authorField" 0080 Kirigami.FormData.label: i18n("Author:") 0081 } 0082 QQC2.TextField { 0083 id: "emailField" 0084 Kirigami.FormData.label: i18n("Email:") 0085 } 0086 QQC2.TextField { 0087 id: "versionField" 0088 Kirigami.FormData.label: i18n("Version:") 0089 } 0090 QQC2.TextField { 0091 id: "websiteField" 0092 Kirigami.FormData.label: i18n("Website:") 0093 } 0094 QQC2.ComboBox { 0095 id: licenseField 0096 Layout.fillWidth: true 0097 Kirigami.FormData.label: i18n("License:") 0098 editable: true 0099 editText: "LGPL 2.1+" 0100 model: ["LGPL 2.1+", "GPL 2+", "GPL 3+", "LGPL 3+", "BSD"] 0101 } 0102 } 0103 } 0104 } 0105 0106 0107 footer: QQC2.DialogButtonBox { 0108 QQC2.Button { 0109 text: i18n("OK ") 0110 enabled: canEdit && nameField.text && authorField.text && emailField.text && websiteField.text 0111 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole 0112 onClicked: dialog.accept() 0113 } 0114 QQC2.Button { 0115 text: i18n("Cancel") 0116 QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.DestructiveRole 0117 onClicked: dialog.reject() 0118 } 0119 } 0120 0121 onAccepted: { 0122 lnfLogic.createNewTheme(pluginNameField.text, nameField.text, commentField.text, authorField.text, emailField.text, licenseField.editText, websiteField.text); 0123 for (var i = 0; i < lnfLogic.lnfList.count; ++i) { 0124 if (nameField.text == lnfLogic.lnfList.get(i).packageNameRole) { 0125 themeSelector.currentIndex = i; 0126 break; 0127 } 0128 } 0129 } 0130 }