Warning, /plasma/plasma-workspace/kcms/style/ui/EffectSettingsPopup.qml is written in an unsupported language. File is not indexed.

0001 /*
0002     SPDX-FileCopyrightText: 2018 Kai Uwe Broulik <kde@privat.broulik.de>
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.7
0008 import QtQuick.Layouts 1.1
0009 import QtQuick.Controls 2.3 as QtControls
0010 import org.kde.kirigami 2.4 as Kirigami
0011 import org.kde.kcmutils as KCM
0012 import org.kde.private.kcms.style 1.0 as Private
0013 
0014 Kirigami.OverlaySheet {
0015     id: effectSettingsPopup
0016 
0017     readonly property int paddings: Kirigami.Units.largeSpacing * 2
0018 
0019     title: i18nc("@title:window", "Configure Icon and Toolbars")
0020 
0021     implicitWidth: Math.max((formLayout.implicitWidth + paddings), Kirigami.Units.gridUnit * 20)
0022     implicitHeight: Math.max((formLayout.implicitHeight + paddings), Kirigami.Units.gridUnit * 11)
0023 
0024     onOpened: {
0025         // can we do this automatically with "focus: true" somewhere?
0026         iconsOnButtonsCheckBox.forceActiveFocus();
0027     }
0028 
0029     Kirigami.FormLayout {
0030         id: formLayout
0031         // Popup's autosizing causes FormLayout to collapse when opening it a second time :(
0032         wideMode: true
0033 
0034         QtControls.CheckBox {
0035             id: iconsOnButtonsCheckBox
0036             Kirigami.FormData.label: i18n("Show icons:")
0037             text: i18n("On buttons")
0038             checked: kcm.styleSettings.iconsOnButtons
0039             onClicked: kcm.styleSettings.iconsOnButtons = checked
0040 
0041             KCM.SettingStateBinding {
0042                 configObject: kcm.styleSettings
0043                 settingName: "iconsOnButtons"
0044             }
0045         }
0046 
0047         QtControls.CheckBox {
0048             text: i18n("In menus")
0049             checked: kcm.styleSettings.iconsInMenus
0050             onClicked: kcm.styleSettings.iconsInMenus = checked
0051 
0052             KCM.SettingStateBinding {
0053                 configObject: kcm.styleSettings
0054                 settingName: "iconsInMenus"
0055             }
0056         }
0057 
0058         QtControls.ComboBox {
0059             id: mainToolBarStyleCombo
0060             Kirigami.FormData.label: i18n("Main toolbar label:")
0061             model: [
0062                 {text: i18n("None"), value: Private.KCM.NoText},
0063                 {text: i18n("Text only"), value: Private.KCM.TextOnly},
0064                 {text: i18n("Beside icons"), value: Private.KCM.TextBesideIcon},
0065                 {text: i18n("Below icon"), value: Private.KCM.TextUnderIcon}
0066             ]
0067             textRole: "text"
0068             currentIndex: model.findIndex(function (item) {
0069                 return item.value === kcm.mainToolBarStyle
0070             })
0071             onActivated: kcm.mainToolBarStyle = model[currentIndex].value
0072 
0073             KCM.SettingStateBinding {
0074                 configObject: kcm.styleSettings
0075                 settingName: "toolButtonStyle"
0076             }
0077         }
0078 
0079         QtControls.ComboBox {
0080             Kirigami.FormData.label: i18n("Secondary toolbar label:")
0081             model: mainToolBarStyleCombo.model
0082             textRole: "text"
0083             currentIndex: model.findIndex(function (item) {
0084                 return item.value === kcm.otherToolBarStyle
0085             })
0086             onActivated: kcm.otherToolBarStyle = model[currentIndex].value
0087 
0088             KCM.SettingStateBinding {
0089                 configObject: kcm.styleSettings
0090                 settingName: "toolButtonStyleOtherToolbars"
0091             }
0092         }
0093     }
0094 }