/** SPDX-FileCopyrightText: 2015 Ivan Cukic <ivan.cukic@kde.org>* SPDX-FileCopyrightText: 2023 Ismael Asensio <isma.af@gmail.com>** SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Controls as QQC2import org.kde.kirigami as Kirigamiimport org.kde.kquickcontrols as KQuickControlsimport org.kde.iconthemes as KIconThemesimport org.kde.kcmutils as KCMimport org.kde.kcms.activitiesKCM.SimpleKCM {property alias activityId: settings.activityIdtitle: activityId ? i18nc("@title:window", "Activity Settings for %1", settings.name): i18nc("@title:window", "Create a New Activity")actions: Kirigami.Action {text: i18nc("@action:button as in, 'save changes'", "Save")icon.name: "document-save"enabled: settings.name.length > 0 && settings.isSaveNeededonTriggered: saveContents();}Keys.onReturnPressed: saveContents();Keys.onEscapePressed: kcm.pop();function saveContents() {settings.save();kcm.pop();}ActivityConfig {id: settings}Kirigami.FormLayout {anchors.fill: parentItem {height: Kirigami.Units.smallSpacing}QQC2.Button {implicitHeight: Kirigami.Units.iconSizes.medium + Kirigami.Units.largeSpacing * 2implicitWidth: heighticon.height: Kirigami.Units.iconSizes.mediumicon.width: Kirigami.Units.iconSizes.mediumicon.name: settings.iconNameKirigami.FormData.label: i18nc("@label:chooser", "Icon:")onClicked: iconDialog.open();KIconThemes.IconDialog {id: iconDialogonIconNameChanged: iconName => settings.iconName = iconName}}QQC2.TextField {Kirigami.FormData.label: i18nc("@label:textbox", "Name:")text: settings.nameonTextEdited: settings.name = text}QQC2.TextField {Kirigami.FormData.label: i18nc("@label:textbox", "Description:")text: settings.descriptiononTextEdited: settings.description = text}Kirigami.Separator {Kirigami.FormData.isSection: true}QQC2.CheckBox {Kirigami.FormData.label: i18nc("@title:group for checkbox group", "While on this activity, allow:")text: i18nc("@option:check While on activity, allow", "Tracking file and app use")checked: !settings.isPrivateonToggled: settings.isPrivate = !checked}QQC2.CheckBox {text: i18nc("@option:check While on activity, allow", "Automatically turning off the screen")checked: !settings.inhibitScreenonToggled: settings.inhibitScreen = !checked}QQC2.CheckBox {text: i18nc("@option:check While on activity, allow", "Automatically shutting down or sleeping")checked: !settings.inhibitSleeponToggled: settings.inhibitSleep = !checked}KQuickControls.KeySequenceItem {Kirigami.FormData.label: i18nc("@label prefix for keyboard shortcut input button", "Shortcut for switching:")keySequence: settings.shortcutonCaptureFinished: settings.shortcut = keySequence}}}