Warning, /plasma/plasma-desktop/kcms/access/ui/Bell.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2018 Tomaz Canabrava <tcanabrava@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 import QtQuick 2.6
0008 import QtQuick.Layouts 1.1
0009 import QtQuick.Controls 2.12 as QQC2
0010 import QtQuick.Dialogs 6.3 as Dialogs
0011 import org.kde.kcmutils as KCM
0012 import org.kde.kquickcontrols 2.0 as KQuickAddons
0013 import org.kde.kirigami 2.3 as Kirigami
0014 
0015 Kirigami.FormLayout {
0016 
0017     Dialogs.FileDialog {
0018         id: fileDialog
0019         title: i18n("Please choose an audio file")
0020         nameFilters: [i18nc("Name filters in a file dialog", "Audio Files (*.ogg *.wav)")]
0021         onAccepted: {
0022             kcm.bellSettings.customBellFile = fileDialog.selectedFile
0023         }
0024     }
0025 
0026     QQC2.CheckBox {
0027         id: systemBell
0028 
0029         Kirigami.FormData.label: i18n("Audible bell:")
0030         text: i18nc("Enable the system bell", "Enable")
0031         KCM.SettingStateBinding {
0032             configObject: kcm.bellSettings
0033             settingName: "SystemBell"
0034         }
0035 
0036         checked: kcm.bellSettings.systemBell
0037         onToggled: kcm.bellSettings.systemBell = checked
0038     }
0039 
0040     RowLayout {
0041         Kirigami.FormData.label: i18nc("Defines if the system will use a sound system bell", "Custom sound:")
0042         spacing: 0
0043 
0044         QQC2.CheckBox {
0045             id: customBell
0046             Layout.alignment: Qt.AlignVCenter
0047 
0048             KCM.SettingStateBinding {
0049                 configObject: kcm.bellSettings
0050                 settingName: "CustomBell"
0051                 extraEnabledConditions: kcm.bellSettings.systemBell
0052             }
0053 
0054             checked: kcm.bellSettings.customBell
0055             onToggled: kcm.bellSettings.customBell= checked
0056         }
0057 
0058         QQC2.TextField {
0059             id: textEdit
0060 
0061             text: kcm.bellSettings.customBellFile
0062 
0063             KCM.SettingStateBinding {
0064                 configObject: kcm.bellSettings
0065                 settingName: "CustomBellFile"
0066                 extraEnabledConditions: kcm.bellSettings.customBell
0067             }
0068 
0069             onEditingFinished: kcm.bellSettings.customBellFile = textEdit.text
0070         }
0071         QQC2.Button {
0072             icon.name: "folder"
0073             QQC2.ToolTip.visible: down
0074             QQC2.ToolTip.text: i18n("Search audio file for the system bell")
0075             Accessible.name: i18n("Button search audio file")
0076             KCM.SettingStateBinding {
0077                 configObject: kcm.bellSettings
0078                 settingName: "CustomBellFile"
0079                 extraEnabledConditions: kcm.bellSettings.customBell
0080             }
0081 
0082             onClicked: fileDialog.open()
0083         }
0084     }
0085     Item {
0086         Kirigami.FormData.isSection: true
0087     }
0088     QQC2.CheckBox {
0089         id: visibleBell
0090 
0091         Kirigami.FormData.label: i18n("Visual bell:")
0092         text: i18nc("Enable visual bell", "Enable")
0093 
0094         KCM.SettingStateBinding {
0095             configObject: kcm.bellSettings
0096             settingName: "VisibleBell"
0097         }
0098 
0099         checked: kcm.bellSettings.visibleBell
0100         onToggled: kcm.bellSettings.visibleBell = checked
0101     }
0102 
0103     QQC2.RadioButton {
0104         id: invertScreen
0105 
0106         text: i18nc("Invert screen on a system bell", "Invert Screen")
0107 
0108         KCM.SettingStateBinding {
0109             configObject: kcm.bellSettings
0110             settingName: "InvertScreen"
0111             extraEnabledConditions: kcm.bellSettings.visibleBell
0112         }
0113 
0114         checked: kcm.bellSettings.invertScreen
0115         onToggled: kcm.bellSettings.invertScreen = checked
0116     }
0117     RowLayout {
0118         enabled: kcm.bellSettings.visibleBell
0119 
0120         QQC2.RadioButton {
0121             id: flashScreen
0122 
0123             text: i18nc("Flash screen on a system bell", "Flash")
0124 
0125             KCM.SettingStateBinding {
0126                 configObject: kcm.bellSettings
0127                 settingName: "InvertScreen"
0128             }
0129 
0130             checked: !kcm.bellSettings.invertScreen
0131             onToggled: kcm.bellSettings.invertScreen = !checked
0132         }
0133         KQuickAddons.ColorButton {
0134             text: i18nc("Color of the system bell","Color")
0135             // avoid to show text outside button
0136             display: QQC2.AbstractButton.IconOnly
0137 
0138             KCM.SettingStateBinding {
0139                 configObject: kcm.bellSettings
0140                 settingName: "VisibleBellColor"
0141             }
0142 
0143             color: kcm.bellSettings.visibleBellColor
0144             onAccepted: color => kcm.bellSettings.visibleBellColor = color
0145         }
0146     }
0147     QQC2.SpinBox {
0148         Kirigami.FormData.label: i18nc("Duration of the system bell", "Duration:")
0149 
0150         KCM.SettingStateBinding {
0151             configObject: kcm.bellSettings
0152             settingName: "VisibleBellPause"
0153             extraEnabledConditions: kcm.bellSettings.visibleBell
0154         }
0155 
0156         value: kcm.bellSettings.visibleBellPause
0157         onValueModified: kcm.bellSettings.visibleBellPause = value
0158     }
0159 }