/*SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>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: rootfunction unsupportedMimeText(kcm_component) {return i18n("β%1β seems to not support the following mimetypes associated with this kind of application: %2", kcm_component.applications[kcm_component.index]["name"], kcm_component.unsupportedMimeTypes.join(", "))}topPadding: 0bottomPadding: Kirigami.Units.gridUnitComponentOverlay {id: overlayparent: root.QQC2.Overlay.overlay}Kirigami.FormLayout {id: formreadonly property int longestComboBox: Math.max(browserCombo.implicitWidth,fileManagerCombo.implicitWidth,textEditorCombo.implicitWidth,pdfViewerCombo.implicitWidth,imageViewerCombo.implicitWidth,musicPlayerCombo.implicitWidth,videoPlayerCombo.implicitWidth,emailCombo.implicitWidth,archiveCombo.implicitWidth,terminalCombo.implicitWidth,mapCombo.implicitWidth,dialerCombo.implicitWidth)Item {Kirigami.FormData.label: i18nc("Internet related applicationβs categoryβs name", "Internet")Kirigami.FormData.isSection: true}RowLayout {Kirigami.FormData.label: i18n("Web browser:")ComponentComboBox {id: browserCombocomponent: kcm.browsersLayout.preferredWidth: form.longestComboBoxKCM.SettingHighlighter {highlight: !kcm.browsers.isDefaults}}QQC2.Button {visible: !kcm.browsers.isSaveNeeded && (kcm.browsers.unsupportedMimeTypes.length > 0 || kcm.browsers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.browsersoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18n("Email client:")ComponentComboBox {id: emailComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.emailClientsKCM.SettingHighlighter {highlight: !kcm.emailClients.isDefaults}}QQC2.Button {visible: !kcm.emailClients.isSaveNeeded && (kcm.emailClients.unsupportedMimeTypes.length > 0 || kcm.emailClients.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.emailClientsoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18nc("Default phone app", "Phone Numbers:")ComponentComboBox {id: dialerComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.telUriHandlersKCM.SettingHighlighter {highlight: !kcm.telUriHandlers.isDefaults}}QQC2.Button {visible: !kcm.telUriHandlers.isSaveNeeded && (kcm.telUriHandlers.unsupportedMimeTypes.length > 0 || kcm.telUriHandlers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.telUriHandlersoverlay.open()}}}Item {Kirigami.FormData.label: i18nc("Multimedia related applicationβs categoryβs name", "Multimedia")Kirigami.FormData.isSection: true}RowLayout {Kirigami.FormData.label: i18n("Image viewer:")ComponentComboBox {id: imageViewerComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.imageViewersKCM.SettingHighlighter {highlight: !kcm.imageViewers.isDefaults}}QQC2.Button {visible: !kcm.imageViewers.isSaveNeeded && (kcm.imageViewers.unsupportedMimeTypes.length > 0 || kcm.imageViewers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.imageViewersoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18n("Music player:")ComponentComboBox {id: musicPlayerComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.musicPlayersKCM.SettingHighlighter {highlight: !kcm.musicPlayers.isDefaults}}QQC2.Button {visible: !kcm.musicPlayers.isSaveNeeded && (kcm.musicPlayers.unsupportedMimeTypes.length > 0 || kcm.musicPlayers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.musicPlayersoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18n("Video player:")ComponentComboBox {id: videoPlayerComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.videoPlayersKCM.SettingHighlighter {highlight: !kcm.videoPlayers.isDefaults}}QQC2.Button {visible: !kcm.videoPlayers.isSaveNeeded && (kcm.videoPlayers.unsupportedMimeTypes.length > 0 || kcm.videoPlayers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.videoPlayersoverlay.open()}}}Item {Kirigami.FormData.label: i18nc("Documents related applicationβs categoryβs name", "Documents")Kirigami.FormData.isSection: true}RowLayout {Kirigami.FormData.label: i18n("Text editor:")ComponentComboBox {id: textEditorComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.textEditorsKCM.SettingHighlighter {highlight: !kcm.textEditors.isDefaults}}QQC2.Button {visible: !kcm.textEditors.isSaveNeeded && (kcm.textEditors.unsupportedMimeTypes.length > 0 || kcm.textEditors.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.textEditorsoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18n("PDF viewer:")ComponentComboBox {id: pdfViewerComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.pdfViewersKCM.SettingHighlighter {highlight: !kcm.pdfViewers.isDefaults}}QQC2.Button {visible: !kcm.pdfViewers.isSaveNeeded && (kcm.pdfViewers.unsupportedMimeTypes.length > 0 || kcm.pdfViewers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.pdfViewersoverlay.open()}}}Item {Kirigami.FormData.label: i18nc("Utilities related applicationβs categoryβs name", "Utilities")Kirigami.FormData.isSection: true}RowLayout {Kirigami.FormData.label: i18n("File manager:")ComponentComboBox {id: fileManagerComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.fileManagersKCM.SettingHighlighter {highlight: !kcm.fileManagers.isDefaults}}QQC2.Button {visible: !kcm.fileManagers.isSaveNeeded && (kcm.fileManagers.unsupportedMimeTypes.length > 0 || kcm.fileManagers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.fileManagersoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18n("Terminal emulator:")ComponentComboBox {id: terminalComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.terminalEmulatorsKCM.SettingHighlighter {highlight: !kcm.terminalEmulators.isDefaults}}}RowLayout {Kirigami.FormData.label: i18n("Archive manager:")ComponentComboBox {id: archiveComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.archiveManagersKCM.SettingHighlighter {highlight: !kcm.archiveManagers.isDefaults}}QQC2.Button {visible: !kcm.archiveManagers.isSaveNeeded && (kcm.archiveManagers.unsupportedMimeTypes.length > 0 || kcm.archiveManagers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.archiveManagersoverlay.open()}}}RowLayout {Kirigami.FormData.label: i18nc("Map related applicationβs categoryβs name", "Map:")ComponentComboBox {id: mapComboLayout.preferredWidth: form.longestComboBoxcomponent: kcm.geoUriHandlersKCM.SettingHighlighter {highlight: !kcm.geoUriHandlers.isDefaults}}QQC2.Button {visible: !kcm.geoUriHandlers.isSaveNeeded && (kcm.geoUriHandlers.unsupportedMimeTypes.length > 0 || kcm.geoUriHandlers.mimeTypesNotAssociated.length > 0)icon.name: "help-contextual"onClicked: {overlay.componentChooser = kcm.geoUriHandlersoverlay.open()}}}}}