Warning, /plasma/plasma-desktop/kcms/activities/ui/ActivityEditor.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Ivan Cukic <ivan.cukic@kde.org> 0003 * SPDX-FileCopyrightText: 2023 Ismael Asensio <isma.af@gmail.com> 0004 * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 import QtQuick 2.15 0009 import QtQuick.Controls 2.15 as QQC2 0010 0011 import org.kde.kirigami 2.19 as Kirigami 0012 import org.kde.kquickcontrols 2.0 as KQuickControls 0013 import org.kde.iconthemes 1.0 as KIconThemes 0014 0015 import org.kde.kcmutils as KCM 0016 import org.kde.kcms.activities 0017 0018 KCM.SimpleKCM { 0019 0020 property alias activityId: settings.activityId 0021 0022 title: activityId ? i18nc("@title:window", "Activity Settings for %1", settings.name) 0023 : i18nc("@title:window", "Create a New Activity") 0024 0025 actions: Kirigami.Action { 0026 text: i18nc("@action:button as in, 'save changes'", "Save") 0027 icon.name: "document-save" 0028 enabled: settings.name.length > 0 && settings.isSaveNeeded 0029 onTriggered: saveContents(); 0030 } 0031 0032 Keys.onReturnPressed: saveContents(); 0033 Keys.onEscapePressed: kcm.pop(); 0034 0035 function saveContents() { 0036 settings.save(); 0037 kcm.pop(); 0038 } 0039 0040 ActivityConfig { 0041 id: settings 0042 } 0043 0044 Kirigami.FormLayout { 0045 anchors.fill: parent 0046 0047 Item { 0048 height: Kirigami.Units.smallSpacing 0049 } 0050 0051 QQC2.Button { 0052 implicitHeight: Kirigami.Units.iconSizes.medium + Kirigami.Units.largeSpacing * 2 0053 implicitWidth: height 0054 icon.height: Kirigami.Units.iconSizes.medium 0055 icon.width: Kirigami.Units.iconSizes.medium 0056 icon.name: settings.iconName 0057 Kirigami.FormData.label: i18nc("@label:chooser", "Icon:") 0058 onClicked: iconDialog.open(); 0059 0060 KIconThemes.IconDialog { 0061 id: iconDialog 0062 onIconNameChanged: iconName => settings.iconName = iconName 0063 } 0064 0065 } 0066 0067 QQC2.TextField { 0068 Kirigami.FormData.label: i18nc("@label:textbox", "Name:") 0069 text: settings.name 0070 onTextEdited: settings.name = text 0071 } 0072 0073 QQC2.TextField { 0074 Kirigami.FormData.label: i18nc("@label:textbox", "Description:") 0075 text: settings.description 0076 onTextEdited: settings.description = text 0077 } 0078 0079 Kirigami.Separator { 0080 Kirigami.FormData.isSection: true 0081 } 0082 0083 QQC2.CheckBox { 0084 Kirigami.FormData.label: i18nc("@option:check", "While on this activity, allow:") 0085 text: i18n("Tracking file and app use") 0086 checked: !settings.isPrivate 0087 onToggled: settings.isPrivate = !checked 0088 } 0089 0090 QQC2.CheckBox { 0091 text: i18nc("@option:check", "Automatically turning off the screen") 0092 checked: !settings.inhibitScreen 0093 onToggled: settings.inhibitScreen = !checked 0094 } 0095 0096 QQC2.CheckBox { 0097 text: i18nc("@option:check", "Automatically shutting down or sleeping") 0098 checked: !settings.inhibitSleep 0099 onToggled: settings.inhibitSleep = !checked 0100 } 0101 0102 KQuickControls.KeySequenceItem { 0103 Kirigami.FormData.label: i18n("Shortcut for switching:") 0104 keySequence: settings.shortcut 0105 onCaptureFinished: settings.shortcut = keySequence 0106 } 0107 } 0108 }