/*SPDX-FileCopyrightText: 2023 Fushan Wen <qydwhotmail@gmail.com>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Layoutsimport QtQuick.Controls as QQC2import org.kde.kirigami as Kirigamiimport org.kde.kcmutils as KCMKCM.SimpleKCM {id: rootKCM.ConfigModule.buttons: KCM.ConfigModule.Default | KCM.ConfigModule.ApplyimplicitWidth: Kirigami.Units.gridUnit * 30implicitHeight: Kirigami.Units.gridUnit * 20// FIXME: get actual scrollbar width,// don't assume gridUnit is rightreadonly property int availableSpace: root.width - (__flickableOverflows ? Kirigami.Units.gridUnit : 0)- buttonMetrics.implicitWidth- desktop.spacing- leftPadding- rightPaddingreadonly property int commonFieldWidth: Math.min(availableSpace,Math.max(desktop.implicitTextFieldWidth,documents.implicitTextFieldWidth,downloads.implicitTextFieldWidth,videos.implicitTextFieldWidth,pictures.implicitTextFieldWidth,music.implicitTextFieldWidth,publicPath.implicitTextFieldWidth,templates.implicitTextFieldWidth,projects.implicitTextFieldWidth))// Need to get the width of a standard button since UrlRequester includes one,// so we can subtract it from the available width for the text field.Otherwise// the layout overflows in FormLayout's narrow modeQQC2.Button {id: buttonMetricsvisible: falseicon.name: "document-open"}Kirigami.FormLayout {UrlRequester {id: desktopKirigami.FormData.label: i18nc("@label:textbox", "Desktop folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.desktopLocationdefaultLocation: kcm.settings.defaultDesktopLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder contains all the files you see on your desktop.")onNewLocationSelected: (newLocation) => kcm.settings.desktopLocation = newLocation}UrlRequester {id: documentsKirigami.FormData.label: i18nc("@label:textbox", "Documents folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.documentsLocationdefaultLocation: kcm.settings.defaultDocumentsLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to open or save documents.")onNewLocationSelected: (newLocation) => kcm.settings.documentsLocation = newLocation}UrlRequester {id: downloadsKirigami.FormData.label: i18nc("@label:textbox", "Downloads folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.downloadsLocationdefaultLocation: kcm.settings.defaultDownloadsLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to save your downloaded items.")onNewLocationSelected: (newLocation) => kcm.settings.downloadsLocation = newLocation}UrlRequester {id: videosKirigami.FormData.label: i18nc("@label:textbox", "Videos folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.videosLocationdefaultLocation: kcm.settings.defaultVideosLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to open or save video files.")onNewLocationSelected: (newLocation) => kcm.settings.videosLocation = newLocation}UrlRequester {id: picturesKirigami.FormData.label: i18nc("@label:textbox", "Pictures folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.picturesLocationdefaultLocation: kcm.settings.defaultPicturesLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to open or save image files.")onNewLocationSelected: (newLocation) => kcm.settings.picturesLocation = newLocation}UrlRequester {id: musicKirigami.FormData.label: i18nc("@label:textbox", "Music folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.musicLocationdefaultLocation: kcm.settings.defaultMusicLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to open or save music files.")onNewLocationSelected: (newLocation) => kcm.settings.musicLocation = newLocation}UrlRequester {id: publicPathKirigami.FormData.label: i18nc("@label:textbox", "Public folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.publicLocationdefaultLocation: kcm.settings.defaultPublicLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default for publicly-shared files when network sharing is enabled.")onNewLocationSelected: (newLocation) => kcm.settings.publicLocation = newLocation}UrlRequester {id: templatesKirigami.FormData.label: i18nc("@label:textbox", "Templates folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.templatesLocationdefaultLocation: kcm.settings.defaultTemplatesLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to open or save file templates.")onNewLocationSelected: (newLocation) => kcm.settings.templatesLocation = newLocation}UrlRequester {id: projectsKirigami.FormData.label: i18nc("@label:textbox", "Projects folder:")textFieldWidth: root.commonFieldWidthlocation: kcm.settings.projectsLocationdefaultLocation: kcm.settings.defaultProjectsLocationAccessible.description: i18nc("@info:tooltip and accessible description", "This folder will be used by default to open or save projects.")onNewLocationSelected: (newLocation) => kcm.settings.projectsLocation = newLocation}}}