/*SPDX-FileCopyrightText: 2013 Eike Hein <hein@kde.org>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Controls as QQC2import QtQuick.Layoutsimport org.kde.kcmutils as KCMUtilsimport org.kde.kirigami as Kirigamiimport org.kde.plasma.core as PlasmaCoreimport org.kde.plasma.plasmoidimport org.kde.plasma.workspace.dbus as DBusimport org.kde.taskmanager as TaskManagerKCMUtils.SimpleKCM {id: rootproperty alias cfg_groupingStrategy: groupingStrategy.currentIndexproperty alias cfg_groupedTaskVisualization: groupedTaskVisualization.currentIndexproperty alias cfg_groupPopups: groupPopups.checkedproperty alias cfg_onlyGroupWhenFull: onlyGroupWhenFull.checkedproperty int cfg_sortingStrategyproperty alias cfg_separateLaunchers: separateLaunchers.checkedproperty alias cfg_hideLauncherOnStart: hideLauncherOnStart.checkedproperty alias cfg_middleClickAction: middleClickAction.currentIndexproperty alias cfg_wheelEnabled: wheelEnabled.currentIndexproperty alias cfg_wheelSkipMinimized: wheelSkipMinimized.checkedproperty alias cfg_showOnlyCurrentScreen: showOnlyCurrentScreen.checkedproperty alias cfg_showOnlyCurrentDesktop: showOnlyCurrentDesktop.checkedproperty alias cfg_showOnlyCurrentActivity: showOnlyCurrentActivity.checkedproperty alias cfg_showOnlyMinimized: showOnlyMinimized.checkedproperty alias cfg_minimizeActiveTaskOnClick: minimizeActive.checkedproperty alias cfg_unhideOnAttention: unhideOnAttention.checkedproperty alias cfg_reverseMode: reverseMode.checkedheaderPaddingEnabled: falseheader: ColumnLayout {spacing: Kirigami.Units.smallSpacingKirigami.InlineMessage {id: annoyingAppWorkaroundMessageLayout.fillWidth: trueposition: Kirigami.InlineMessage.Position.Headertext: i18nc("@info", "If you're using this setting to work around an application that demands attention too often, first look for a setting in the app to disable that behavior. If you don't find one, consider reporting this as a bug to the app's developer.")}}DBus.DBusServiceWatcher {id: effectWatcherbusType: DBus.BusType.SessionwatchedService: "org.kde.KWin.Effect.WindowView1"}Kirigami.FormLayout {anchors.left: parent.leftanchors.right: parent.rightQQC2.ComboBox {id: groupingStrategyKirigami.FormData.label: i18nc("@label:listbox how to group tasks", "Group:")Layout.fillWidth: trueLayout.minimumWidth: Kirigami.Units.gridUnit * 14model: [i18nc("@item:inlistbox how to group tasks", "Do not group"),i18nc("@item:inlistbox how to group tasks", "By program name")]}QQC2.ComboBox {id: groupedTaskVisualizationKirigami.FormData.label: i18nc("@label:listbox completes sentence like: β¦ cycles through tasks", "Clicking grouped task:")Layout.fillWidth: trueLayout.minimumWidth: Kirigami.Units.gridUnit * 14enabled: groupingStrategy.currentIndex !== 0model: [i18nc("@item:inlistbox Completes the sentence 'Clicking grouped task cycles through tasks' ", "Cycles through tasks"),i18nc("@item:inlistbox Completes the sentence 'Clicking grouped task shows small window previews' ", "Shows small window previews"),i18nc("@item:inlistbox Completes the sentence 'Clicking grouped task shows large window previews' ", "Shows large window previews"),i18nc("@item:inlistbox Completes the sentence 'Clicking grouped task shows textual list' ", "Shows textual list"),]Accessible.name: currentTextAccessible.onPressAction: currentIndex = currentIndex === count - 1 ? 0 : (currentIndex + 1)}// "You asked for Window View but Window View is not available" messageKirigami.InlineMessage {Layout.fillWidth: truevisible: groupedTaskVisualization.currentIndex === 2 && !effectWatcher.registeredtype: Kirigami.MessageType.Warningtext: i18nc("@info displayed as InlineMessage", "The compositor does not support displaying windows side by side, so a textual list will be displayed instead.")}Item {Kirigami.FormData.isSection: true}QQC2.CheckBox {id: groupPopupsvisible: (Plasmoid.pluginName !== "org.kde.plasma.icontasks")text: i18nc("@option:check grouped task", "Combine into single button")enabled: groupingStrategy.currentIndex > 0}QQC2.CheckBox {id: onlyGroupWhenFullvisible: (Plasmoid.pluginName !== "org.kde.plasma.icontasks")text: i18nc("@option:check grouped task","Group only when the Task Manager is full")enabled: groupingStrategy.currentIndex > 0 && groupPopups.checkedAccessible.onPressAction: toggle()}Item {Kirigami.FormData.isSection: truevisible: (Plasmoid.pluginName !== "org.kde.plasma.icontasks")}QQC2.ComboBox {id: sortingStrategyKirigami.FormData.label: i18nc("@label:listbox sort tasks in grouped task", "Sort:")Layout.fillWidth: trueLayout.minimumWidth: Kirigami.Units.gridUnit * 14textRole: "text"valueRole: "value"model: [{"text": i18nc("@item:inlistbox sort tasks in grouped task", "Do not sort"),"value": TaskManager.TasksModel.SortDisabled,},{"text": i18nc("@item:inlistbox sort tasks in grouped task", "Manually"),"value": TaskManager.TasksModel.SortManual,},{"text": i18nc("@item:inlistbox sort tasks in grouped task", "Alphabetically"),"value": TaskManager.TasksModel.SortAlpha,},{"text": i18nc("@item:inlistbox sort tasks in grouped task", "By desktop"),"value": TaskManager.TasksModel.SortVirtualDesktop,},{"text": i18nc("@item:inlistbox sort tasks in grouped task", "By activity"),"value": TaskManager.TasksModel.SortActivity,},{"text": i18nc("@item:inlistbox sort tasks in grouped task", "By horizontal window position"),"value": TaskManager.TasksModel.SortWindowPositionHorizontal,},]onActivated: root.cfg_sortingStrategy = currentValueComponent.onCompleted: currentIndex = indexOfValue(root.cfg_sortingStrategy)}QQC2.CheckBox {id: separateLaunchersvisible: (Plasmoid.pluginName !== "org.kde.plasma.icontasks")text: i18nc("@option:check configure task sorting", "Keep launchers separate")enabled: sortingStrategy.currentValue === TaskManager.TasksModel.SortManual}QQC2.CheckBox {id: hideLauncherOnStartvisible: (Plasmoid.pluginName !== "org.kde.plasma.icontasks")text: i18nc("@option:check for icons-and-text task manager", "Hide launchers after application startup")}Item {Kirigami.FormData.isSection: truevisible: (Plasmoid.pluginName !== "org.kde.plasma.icontasks")}QQC2.CheckBox {id: minimizeActiveKirigami.FormData.label: i18nc("@label for checkbox Part of a sentence: 'Clicking active task minimizes the task'", "Clicking active task:")text: i18nc("@option:check Part of a sentence: 'Clicking active task minimizes the task'", "Minimizes the task")}QQC2.ComboBox {id: middleClickActionKirigami.FormData.label: i18nc("@label:listbox completes sentence like: β¦ does nothing", "Middle-clicking any task:")Layout.fillWidth: trueLayout.minimumWidth: Kirigami.Units.gridUnit * 14model: [i18nc("@item:inlistbox Part of a sentence: 'Middle-clicking any task does nothing'", "Does nothing"),i18nc("@item:inlistbox Part of a sentence: 'Middle-clicking any task closes window or group'", "Closes window or group"),i18nc("@item:inlistbox Part of a sentence: 'Middle-clicking any task opens a new window'", "Opens a new window"),i18nc("@item:inlistbox Part of a sentence: 'Middle-clicking any task minimizes/restores window or group'", "Minimizes/Restores window or group"),i18nc("@item:inlistbox Part of a sentence: 'Middle-clicking any task toggles grouping'", "Toggles grouping"),i18nc("@item:inlistbox Part of a sentence: 'Middle-clicking any task brings it to the current virtual desktop'", "Brings it to the current virtual desktop")]}Item {Kirigami.FormData.isSection: true}QQC2.ComboBox {id: wheelEnabledKirigami.FormData.label: i18nc("@label:listbox Part of a sentence: 'Scrolling behavior does nothing/cycles through tasks/cycles through the selected task's windows/adjusts the hovered taskβs volume''", "Scrolling behavior:")Layout.fillWidth: trueLayout.minimumWidth: Kirigami.Units.gridUnit * 14model: [i18nc("@item:inlistbox Part of a sentence: 'Scrolling behavior does nothing'", "Does nothing"),i18nc("@item:inlistbox Part of a sentence: 'Scrolling behavior cycles through all tasks'", "Cycles through all tasks"),i18nc("@item:inlistbox Part of a sentence: 'Scrolling behavior cycles through the hovered task's windows'", "Cycles through the hovered taskβs windows"),i18nc("@item:inlistbox Part of a sentence: 'Scrolling behavior adjusts the hovered taskβs volume'", "Adjusts the hovered taskβs volume"),]}QQC2.CheckBox {id: wheelSkipMinimizedleftPadding: mirrored ? 0 : (wheelEnabled.indicator.width + wheelEnabled.spacing)rightPadding: mirrored ? (wheelEnabled.indicator.width + wheelEnabled.spacing) : 0text: i18nc("@option:check mouse wheel task cycling", "Skip minimized tasks")enabled: wheelEnabled.currentIndex !== 0 // None}Item {Kirigami.FormData.isSection: true}QQC2.CheckBox {id: showOnlyCurrentDesktopKirigami.FormData.label: i18nc("@label for checkbox group, completes sentence like: β¦ from current screen", "Show only tasks:")text: i18nc("@option:check completes sentence: show only tasks", "From the current desktop")}QQC2.CheckBox {id: showOnlyCurrentActivitytext: i18nc("@option:check completes sentence: show only tasks", "From the current activity")}QQC2.CheckBox {id: showOnlyCurrentScreentext: i18nc("@option:check completes sentence: show only tasks", "From the current screen")}QQC2.CheckBox {id: showOnlyMinimizedtext: i18nc("@option:check completes sentence: show only tasks", "That are minimized")}Item {Kirigami.FormData.isSection: true}QQC2.CheckBox {id: unhideOnAttentionKirigami.FormData.label: i18nc("@label for checkbox, completes sentence: β¦ unhide if window wants attention", "When panel is hidden:")text: i18nc("@option:check completes sentence: When panel is hidden", "Unhide when a window wants attention")onToggled: {annoyingAppWorkaroundMessage.visible = !unhideOnAttention.checked;}}Item {Kirigami.FormData.isSection: true}QQC2.ButtonGroup {id: reverseModeRadioButtonGroup}QQC2.RadioButton {Kirigami.FormData.label: i18nc("@label for radiobutton group completes sentence like: β¦ on the bottom", "New tasks appear:")checked: !reverseMode.checkedtext: {if (Plasmoid.formFactor === PlasmaCore.Types.Vertical) {return i18nc("@option:check completes sentence: New tasks appear", "On the bottom")}// horizontalif (Application.layoutDirection === Qt.LeftToRight) {return i18nc("@option:check completes sentence: New tasks appear", "To the right");} else {return i18nc("@option:check completes sentence: New tasks appear", "To the left")}}QQC2.ButtonGroup.group: reverseModeRadioButtonGroup}QQC2.RadioButton {id: reverseModechecked: Plasmoid.configuration.reverseMode === truetext: {if (Plasmoid.formFactor === PlasmaCore.Types.Vertical) {return i18nc("@option:check completes sentence: New tasks appear", "On the top")}// horizontalif (Application.layoutDirection === Qt.LeftToRight) {return i18nc("@option:check completes sentence: New tasks appear", "To the left");} else {return i18nc("@option:check completes sentence: New tasks appear", "To the right");}}QQC2.ButtonGroup.group: reverseModeRadioButtonGroup}}}