Warning, /plasma/plasma-desktop/applets/kickoff/package/contents/ui/ConfigGeneral.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2013 David Edmundson <davidedmundson@kde.org> 0003 SPDX-FileCopyrightText: 2021 Mikel Johnson <mikel5764@gmail.com> 0004 SPDX-FileCopyrightText: 2022 Nate Graham <nate@kde.org> 0005 SPDX-FileCopyrightText: 2022 ivan tkachenko <me@ratijas.tk> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 import QtQuick 2.15 0011 import QtQuick.Layouts 1.1 0012 import QtQuick.Controls 2.5 0013 0014 import org.kde.plasma.core as PlasmaCore 0015 import org.kde.ksvg 1.0 as KSvg 0016 import org.kde.iconthemes as KIconThemes 0017 import org.kde.kirigami 2.20 as Kirigami 0018 import org.kde.kcmutils as KCM 0019 import org.kde.config as KConfig 0020 import org.kde.plasma.plasmoid 2.0 0021 import org.kde.kcmutils as KCM 0022 0023 import "code/tools.js" as Tools 0024 0025 KCM.SimpleKCM { 0026 property string cfg_menuLabel: menuLabel.text 0027 property string cfg_icon: Plasmoid.configuration.icon 0028 property bool cfg_paneSwap: Plasmoid.configuration.paneSwap 0029 property int cfg_favoritesDisplay: Plasmoid.configuration.favoritesDisplay 0030 property int cfg_applicationsDisplay: Plasmoid.configuration.applicationsDisplay 0031 property alias cfg_alphaSort: alphaSort.checked 0032 property var cfg_systemFavorites: String(Plasmoid.configuration.systemFavorites) 0033 property int cfg_primaryActions: Plasmoid.configuration.primaryActions 0034 property alias cfg_showActionButtonCaptions: showActionButtonCaptions.checked 0035 property alias cfg_compactMode: compactModeCheckbox.checked 0036 0037 Kirigami.FormLayout { 0038 Button { 0039 id: iconButton 0040 0041 Kirigami.FormData.label: i18n("Icon:") 0042 0043 implicitWidth: previewFrame.width + Kirigami.Units.smallSpacing * 2 0044 implicitHeight: previewFrame.height + Kirigami.Units.smallSpacing * 2 0045 hoverEnabled: true 0046 0047 Accessible.name: i18nc("@action:button", "Change Application Launcher's icon") 0048 Accessible.description: i18nc("@info:whatsthis", "Current icon is %1. Click to open menu to change the current icon or reset to the default icon.", cfg_icon) 0049 Accessible.role: Accessible.ButtonMenu 0050 0051 ToolTip.delay: Kirigami.Units.toolTipDelay 0052 ToolTip.text: i18nc("@info:tooltip", "Icon name is \"%1\"", cfg_icon) 0053 ToolTip.visible: iconButton.hovered && cfg_icon.length > 0 0054 0055 KIconThemes.IconDialog { 0056 id: iconDialog 0057 onIconNameChanged: cfg_icon = iconName || Tools.defaultIconName 0058 } 0059 0060 onPressed: iconMenu.opened ? iconMenu.close() : iconMenu.open() 0061 0062 KSvg.FrameSvgItem { 0063 id: previewFrame 0064 anchors.centerIn: parent 0065 imagePath: Plasmoid.formFactor === PlasmaCore.Types.Vertical || Plasmoid.formFactor === PlasmaCore.Types.Horizontal 0066 ? "widgets/panel-background" : "widgets/background" 0067 width: Kirigami.Units.iconSizes.large + fixedMargins.left + fixedMargins.right 0068 height: Kirigami.Units.iconSizes.large + fixedMargins.top + fixedMargins.bottom 0069 0070 Kirigami.Icon { 0071 anchors.centerIn: parent 0072 width: Kirigami.Units.iconSizes.large 0073 height: width 0074 source: Tools.iconOrDefault(Plasmoid.formFactor, cfg_icon) 0075 } 0076 } 0077 0078 Menu { 0079 id: iconMenu 0080 0081 // Appear below the button 0082 y: +parent.height 0083 0084 MenuItem { 0085 text: i18nc("@item:inmenu Open icon chooser dialog", "Choose…") 0086 icon.name: "document-open-folder" 0087 Accessible.description: i18nc("@info:whatsthis", "Choose an icon for Application Launcher") 0088 onClicked: iconDialog.open() 0089 } 0090 MenuItem { 0091 text: i18nc("@item:inmenu Reset icon to default", "Reset to default icon") 0092 icon.name: "edit-clear" 0093 enabled: cfg_icon !== Tools.defaultIconName 0094 onClicked: cfg_icon = Tools.defaultIconName 0095 } 0096 MenuItem { 0097 text: i18nc("@action:inmenu", "Remove icon") 0098 icon.name: "delete" 0099 enabled: cfg_icon !== "" && menuLabel.text && Plasmoid.formFactor !== PlasmaCore.Types.Vertical 0100 onClicked: cfg_icon = "" 0101 } 0102 } 0103 } 0104 0105 Kirigami.ActionTextField { 0106 id: menuLabel 0107 enabled: Plasmoid.formFactor !== PlasmaCore.Types.Vertical 0108 Kirigami.FormData.label: i18nc("@label:textbox", "Text label:") 0109 text: Plasmoid.configuration.menuLabel 0110 placeholderText: i18nc("@info:placeholder", "Type here to add a text label") 0111 onTextEdited: { 0112 cfg_menuLabel = menuLabel.text 0113 0114 // This is to make sure that we always have a icon if there is no text. 0115 // If the user remove the icon and remove the text, without this, we'll have no icon and no text. 0116 // This is to force the icon to be there. 0117 if (!menuLabel.text) { 0118 cfg_icon = cfg_icon || Tools.defaultIconName 0119 } 0120 } 0121 rightActions: [ 0122 Action { 0123 icon.name: "edit-clear" 0124 enabled: menuLabel.text !== "" 0125 text: i18nc("@action:button", "Reset menu label") 0126 onTriggered: { 0127 menuLabel.clear() 0128 cfg_menuLabel = '' 0129 cfg_icon = cfg_icon || Tools.defaultIconName 0130 } 0131 } 0132 ] 0133 } 0134 0135 Label { 0136 Layout.fillWidth: true 0137 Layout.maximumWidth: Kirigami.Units.gridUnit * 25 0138 visible: Plasmoid.formFactor === PlasmaCore.Types.Vertical 0139 text: i18nc("@info", "A text label cannot be set when the Panel is vertical.") 0140 wrapMode: Text.Wrap 0141 font: Kirigami.Theme.smallFont 0142 } 0143 0144 Item { 0145 Kirigami.FormData.isSection: true 0146 } 0147 0148 CheckBox { 0149 id: alphaSort 0150 Kirigami.FormData.label: i18nc("General options", "General:") 0151 text: i18n("Always sort applications alphabetically") 0152 } 0153 0154 CheckBox { 0155 id: compactModeCheckbox 0156 text: i18n("Use compact list item style") 0157 checked: Kirigami.Settings.tabletMode ? true : Plasmoid.configuration.compactMode 0158 enabled: !Kirigami.Settings.tabletMode 0159 } 0160 Label { 0161 visible: Kirigami.Settings.tabletMode 0162 text: i18nc("@info:usagetip under a checkbox when Touch Mode is on", "Automatically disabled when in Touch Mode") 0163 Layout.fillWidth: true 0164 wrapMode: Text.Wrap 0165 font: Kirigami.Theme.smallFont 0166 } 0167 0168 Button { 0169 enabled: KConfig.KAuthorized.authorizeControlModule("kcm_plasmasearch") 0170 icon.name: "settings-configure" 0171 text: i18nc("@action:button", "Configure Enabled Search Plugins…") 0172 onClicked: KCM.KCMLauncher.openSystemSettings("kcm_plasmasearch") 0173 } 0174 0175 Item { 0176 Kirigami.FormData.isSection: true 0177 } 0178 0179 RadioButton { 0180 id: paneSwapOff 0181 Kirigami.FormData.label: i18n("Sidebar position:") 0182 text: Qt.application.layoutDirection == Qt.RightToLeft ? i18n("Right") : i18n("Left") 0183 ButtonGroup.group: paneSwapGroup 0184 property int index: 0 0185 checked: !Plasmoid.configuration.paneSwap 0186 } 0187 0188 RadioButton { 0189 id: paneSwapOn 0190 text: Qt.application.layoutDirection == Qt.RightToLeft ? i18n("Left") : i18n("Right") 0191 ButtonGroup.group: paneSwapGroup 0192 property int index: 1 0193 checked: Plasmoid.configuration.paneSwap 0194 } 0195 0196 RadioButton { 0197 id: showFavoritesInGrid 0198 Kirigami.FormData.label: i18n("Show favorites:") 0199 text: i18nc("Part of a sentence: 'Show favorites in a grid'", "In a grid") 0200 ButtonGroup.group: favoritesDisplayGroup 0201 property int index: 0 0202 checked: Plasmoid.configuration.favoritesDisplay === index 0203 } 0204 0205 RadioButton { 0206 id: showFavoritesInList 0207 text: i18nc("Part of a sentence: 'Show favorites in a list'", "In a list") 0208 ButtonGroup.group: favoritesDisplayGroup 0209 property int index: 1 0210 checked: Plasmoid.configuration.favoritesDisplay === index 0211 } 0212 0213 RadioButton { 0214 id: showAppsInGrid 0215 Kirigami.FormData.label: i18n("Show other applications:") 0216 text: i18nc("Part of a sentence: 'Show other applications in a grid'", "In a grid") 0217 ButtonGroup.group: applicationsDisplayGroup 0218 property int index: 0 0219 checked: Plasmoid.configuration.applicationsDisplay === index 0220 } 0221 0222 RadioButton { 0223 id: showAppsInList 0224 text: i18nc("Part of a sentence: 'Show other applications in a list'", "In a list") 0225 ButtonGroup.group: applicationsDisplayGroup 0226 property int index: 1 0227 checked: Plasmoid.configuration.applicationsDisplay === index 0228 } 0229 0230 Item { 0231 Kirigami.FormData.isSection: true 0232 } 0233 0234 RadioButton { 0235 id: powerActionsButton 0236 Kirigami.FormData.label: i18n("Show buttons for:") 0237 text: i18n("Power") 0238 ButtonGroup.group: radioGroup 0239 property string actions: "suspend,hibernate,reboot,shutdown" 0240 property int index: 0 0241 checked: Plasmoid.configuration.primaryActions === index 0242 } 0243 0244 RadioButton { 0245 id: sessionActionsButton 0246 text: i18n("Session") 0247 ButtonGroup.group: radioGroup 0248 property string actions: "lock-screen,logout,save-session,switch-user" 0249 property int index: 1 0250 checked: Plasmoid.configuration.primaryActions === index 0251 } 0252 0253 RadioButton { 0254 id: allActionsButton 0255 text: i18n("Power and session") 0256 ButtonGroup.group: radioGroup 0257 property string actions: "lock-screen,logout,save-session,switch-user,suspend,hibernate,reboot,shutdown" 0258 property int index: 3 0259 checked: Plasmoid.configuration.primaryActions === index 0260 } 0261 0262 CheckBox { 0263 id: showActionButtonCaptions 0264 text: i18n("Show action button captions") 0265 } 0266 } 0267 0268 ButtonGroup { 0269 id: paneSwapGroup 0270 onCheckedButtonChanged: { 0271 if (checkedButton) { 0272 cfg_paneSwap = checkedButton.index === 1 0273 } 0274 } 0275 } 0276 0277 ButtonGroup { 0278 id: favoritesDisplayGroup 0279 onCheckedButtonChanged: { 0280 if (checkedButton) { 0281 cfg_favoritesDisplay = checkedButton.index 0282 } 0283 } 0284 } 0285 0286 ButtonGroup { 0287 id: applicationsDisplayGroup 0288 onCheckedButtonChanged: { 0289 if (checkedButton) { 0290 cfg_applicationsDisplay = checkedButton.index 0291 } 0292 } 0293 } 0294 0295 ButtonGroup { 0296 id: radioGroup 0297 onCheckedButtonChanged: { 0298 if (checkedButton) { 0299 cfg_primaryActions = checkedButton.index 0300 cfg_systemFavorites = checkedButton.actions 0301 } 0302 } 0303 } 0304 }