/*SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>SPDX-FileCopyrightText: 2018 Furkan Tokac <furkantokac34@gmail.com>SPDX-License-Identifier: GPL-2.0-or-later*/import QtQuickimport QtQuick.Controls as QQC2import QtQuick.Layoutsimport org.kde.kcmutils as KCMimport org.kde.kirigami as Kirigamiimport org.kde.touchpad.kcmimport org.kde.plasma.private.kcm_touchpad as TouchpadKCM.SimpleKCM {id: rootspacing: Kirigami.Units.smallSpacingproperty alias deviceIndex: deviceSelector.currentIndexsignal changeSignal()property Touchpad.InputDevice touchpadproperty int touchpadCount: backend.deviceCountproperty bool loading: falsefunction resetModel(index) {touchpadCount = backend.deviceCountformLayout.enabled = touchpadCountdeviceSelector.enabled = touchpadCount > 1loading = trueif (touchpadCount) {touchpad = deviceModel[index]deviceSelector.model = deviceModeldeviceSelector.currentIndex = index} else {deviceSelector.model = [""]}loading = false}function syncValuesFromBackend() {loading = truedeviceEnabled.load()disableEventsOnExternalMouse.load()dwt.load()leftHanded.load()middleEmulation.load()accelSpeedSpinbox.load()accelSpeedSlider.load()accelProfile.load()tapToClick.load()tapAndDrag.load()tapAndDragLock.load()multiTap.load()scrollMethod.load()naturalScroll.load()scrollFactor.load()rightClickMethod.load()middleClickMethod.load()disableHorizontalScrolling.load()loading = false}LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeftLayoutMirroring.childrenInherit: trueheaderPaddingEnabled: false // Let the InlineMessage touch the edgesheader: Kirigami.InlineMessage {id: inlineMessageposition: Kirigami.InlineMessage.Position.Header}Connections {target: KCMTouchpadfunction onShowMessage(message, type) {if (touchpadCount === 0) {return}if (message.length !== 0) {inlineMessage.text = messageinlineMessage.type = typeinlineMessage.visible = true} else {inlineMessage.visible = false}}}Kirigami.PlaceholderMessage {icon.name: "input-touchpad"text: i18nd("kcm_touchpad", "No touchpad found")explanation: i18nd("kcm_touchpad", "Connect an external touchpad");anchors.centerIn: parentvisible: touchpadCount === 0width: parent.width - (Kirigami.Units.largeSpacing * 4)}Kirigami.FormLayout {id: formLayoutvisible: touchpadCount > 0// DeviceQQC2.ComboBox {Kirigami.FormData.label: i18nd("kcm_touchpad", "Device:")id: deviceSelectorvisible: touchpadCount > 1Layout.fillWidth: truemodel: deviceModeltextRole: "name"onCurrentIndexChanged: {if (touchpadCount) {touchpad = deviceModel[currentIndex]if (!loading) {changeSignal()}}root.syncValuesFromBackend()}}Item {Kirigami.FormData.isSection: false}// General settingsQQC2.CheckBox {id: deviceEnabledKirigami.FormData.label: i18nd("kcm_touchpad", "General:")text: i18nd("kcm_touchpad", "Device enabled")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Accept input through this device.")visible: parent.hovereddelay: 1000}function load() {if (!formLayout.enabled) {checked = falsereturn}enabled = touchpad.supportsDisableEventschecked = enabled && touchpad.enabled}onCheckedChanged: {if (enabled && !root.loading) {touchpad.enabled = checkedroot.changeSignal()}}}QQC2.CheckBox {id: disableEventsOnExternalMousetext: i18ndc("kcm_touchpad", "@option:check", "Disable while mouse is connected")leftPadding: Application.layoutDirection === Qt.LeftToRight ?deviceEnabled.contentItem.leftPadding : disableEventsOnExternalMouse.paddingrightPadding: Application.layoutDirection === Qt.RightToLeft ?deviceEnabled.contentItem.rightPadding : disableEventsOnExternalMouse.paddingfunction load() {if (!formLayout.enabled) {checked = falsereturn}enabled = touchpad.supportsDisableEventsOnExternalMousechecked = enabled && touchpad.disableEventsOnExternalMouse}onCheckedChanged: {if (enabled && !root.loading) {touchpad.disableEventsOnExternalMouse = checkedroot.changeSignal()}}}ColumnLayout {Kirigami.FormData.buddyFor: dwtspacing: 0QQC2.CheckBox {id: dwttext: i18nd("kcm_touchpad", "Disable while typing")leftPadding: Application.layoutDirection === Qt.LeftToRight ?deviceEnabled.contentItem.leftPadding : disableEventsOnExternalMouse.paddingrightPadding: Application.layoutDirection === Qt.RightToLeft ?deviceEnabled.contentItem.rightPadding : disableEventsOnExternalMouse.paddinghoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Disable touchpad while typing to prevent accidental inputs.")visible: parent.hovereddelay: 1000}function load() {if (!formLayout.enabled) {checked = falsereturn}enabled = touchpad.supportsDisableWhileTypingchecked = enabled && touchpad.disableWhileTyping}onCheckedChanged: {if (enabled && !root.loading) {touchpad.disableWhileTyping = checkedroot.changeSignal()}}}QQC2.Label {Layout.fillWidth: trueleftPadding: Application.layoutDirection === Qt.LeftToRight ?dwt.leftPadding + dwt.contentItem.leftPadding : dwt.paddingrightPadding: Application.layoutDirection === Qt.RightToLeft ?dwt.rightPadding + dwt.contentItem.rightPadding : dwt.paddingtext: i18ndc("kcm_touchpad", "@label 'this' refers to the 'disable touchpad while typing' feature", "This can interfere with video games.")textFormat: Text.PlainTextelide: Text.ElideRightfont: Kirigami.Theme.smallFont}}QQC2.CheckBox {id: leftHandedtext: i18nd("kcm_touchpad", "Left-handed mode")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Swap left and right buttons.")visible: parent.hovereddelay: 1000}function load() {if (!formLayout.enabled) {checked = falsereturn}enabled = touchpad.supportsLeftHandedchecked = enabled && touchpad.leftHanded}onCheckedChanged: {if (enabled && !root.loading) {touchpad.leftHanded = checkedroot.changeSignal()}}}RowLayout {spacing: Kirigami.Units.smallSpacingQQC2.CheckBox {id: middleEmulationtext: i18ndc("kcm_touchpad", "@option:check", "Press left and right buttons to middle-click")hoverEnabled: trueQQC2.ToolTip {text: i18ndc("kcm_touchpad", "@info:tooltip for checkbox", "Pressing the left and right button simultaneously acts as middle-click.")visible: parent.hovereddelay: 1000}function load() {if (!formLayout.enabled) {checked = falsereturn}enabled = touchpad.supportsMiddleEmulationchecked = enabled && touchpad.middleEmulation}onCheckedChanged: {if (enabled && !root.loading) {touchpad.middleEmulation = checkedroot.changeSignal()}loading = truemiddleClickMethod.load()loading = false}}Kirigami.ContextualHelpButton {toolTipText: i18ndc("kcm_touchpad", "@info:tooltip from ContextualHelpButton", "Activating this setting increases click latency by 50ms. The extra delay is needed to correctly detect simultaneous left and right button presses.")}}Item {Kirigami.FormData.isSection: false}// AccelerationRowLayout {Kirigami.FormData.label: i18nd("kcm_touchpad", "Pointer speed:")id: accelSpeedLayout.fillWidth: truefunction onAccelSpeedChanged(val) {// check sliderif (val !== accelSpeedSlider.accelSpeedValue) {accelSpeedSlider.accelSpeedValue = valaccelSpeedSlider.value = Math.round(6 + (val / 100) / 0.2)}// check spinboxif (val !== accelSpeedSpinbox.value) {accelSpeedSpinbox.value = val}// check libinput accelspeedif ((val / 100) !== touchpad.pointerAcceleration) {touchpad.pointerAcceleration = val / 100root.changeSignal()}}QQC2.Slider {id: accelSpeedSliderLayout.fillWidth: truefrom: 1to: 11stepSize: 1property int accelSpeedValue: 0 // [-100, 100]function load() {enabled = touchpad.supportsPointerAccelerationif (!enabled) {return}accelSpeedValue = Math.round(touchpad.pointerAcceleration * 100)// convert libinput pointer acceleration range [-1, 1] to slider range [1, 11]value = Math.round(6 + touchpad.pointerAcceleration / 0.2)}onValueChanged: {if (touchpad != undefined && enabled && !root.loading) {// convert slider range [1, 11] to accelSpeedValue range [-100, 100]accelSpeedValue = Math.round(((value - 6) * 0.2) * 100)accelSpeed.onAccelSpeedChanged(accelSpeedValue)}}}QQC2.SpinBox {id: accelSpeedSpinboxLayout.minimumWidth: Kirigami.Units.gridUnit * 4from: -100to: 100stepSize: 1editable: truevalidator: DoubleValidator {bottom: accelSpeedSpinbox.fromtop: accelSpeedSpinbox.to}function load() {enabled = touchpad.supportsPointerAccelerationif (!enabled) {return}// if existing configuration or another application set a value with more than 2 decimals// we reduce the precision to 2value = Math.round(touchpad.pointerAcceleration * 100)}onValueChanged: {if (touchpad != undefined && enabled && !root.loading) {accelSpeed.onAccelSpeedChanged(value)}}textFromValue: function(val, locale) {return Number(val / 100).toLocaleString(locale, "f", 2)}valueFromText: function(text, locale) {return Number.fromLocaleString(locale, text) * 100}}}ColumnLayout {id: accelProfileKirigami.FormData.label: i18nd("kcm_touchpad", "Pointer acceleration:")Kirigami.FormData.buddyFor: accelProfileFlatspacing: Kirigami.Units.smallSpacingfunction load() {enabled = touchpad.supportsPointerAccelerationProfileAdaptiveif (!enabled) {accelProfile.visible = falseaccelProfileFlat.checked = falseaccelProfileAdaptive.checked = falsereturn}if(touchpad.pointerAccelerationProfileAdaptive) {accelProfileAdaptive.checked = true} else {accelProfileFlat.checked = true}}function syncCurrent() {if (enabled && !root.loading) {touchpad.pointerAccelerationProfileFlat = accelProfileFlat.checkedtouchpad.pointerAccelerationProfileAdaptive = accelProfileAdaptive.checkedroot.changeSignal()}}QQC2.RadioButton {id: accelProfileFlattext: i18nd("kcm_touchpad", "None")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Cursor moves the same distance as finger.")visible: parent.hovereddelay: 1000}onCheckedChanged: accelProfile.syncCurrent()}QQC2.RadioButton {id: accelProfileAdaptivetext: i18nd("kcm_touchpad", "Standard")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Cursor travel distance depends on movement speed of finger.")visible: parent.hovereddelay: 1000}onCheckedChanged: accelProfile.syncCurrent()}}Item {Kirigami.FormData.isSection: false}// Scroll Speed aka scroll FactorGridLayout {Kirigami.FormData.label: i18nd("kcm_touchpad", "Scrolling speed:")Kirigami.FormData.buddyFor: scrollFactorLayout.fillWidth: truevisible: touchpad.supportsScrollFactorcolumns: 3QQC2.Slider {id: scrollFactorLayout.fillWidth: truefrom: 0to: 14stepSize: 1readonly property list<real> values: [0.1,0.3,0.5,0.75,1, // default1.5,2,3,4,5,7,9,12,15,20]Layout.columnSpan: 3function load() {let index = values.indexOf(touchpad.scrollFactor)if (index === -1) {index = values.indexOf(1);}value = index}onMoved: {touchpad.scrollFactor = values[value]root.changeSignal()}}//row 2QQC2.Label {text: i18ndc("kcm_touchpad", "Slower Scroll", "Slower")textFormat: Text.PlainText}Item {Layout.fillWidth: true}QQC2.Label {text: i18ndc("kcm_touchpad", "Faster Scroll Speed", "Faster")textFormat: Text.PlainText}}// ScrollingColumnLayout {id: scrollMethodKirigami.FormData.label: i18nd("kcm_touchpad", "Scrolling:")Kirigami.FormData.buddyFor: scrollMethodTwoFingersspacing: Kirigami.Units.smallSpacingfunction load() {scrollMethodTwoFingers.enabled = touchpad.supportsScrollTwoFingerscrollMethodTouchpadEdges.enabled = touchpad.supportsScrollEdgeif(scrollMethodTouchpadEdges.enabled && touchpad.scrollEdge) {scrollMethodTouchpadEdges.checked = formLayout.enabled} else {scrollMethodTwoFingers.checked = formLayout.enabled}}function syncCurrent() {if (enabled && !root.loading) {touchpad.scrollTwoFinger = scrollMethodTwoFingers.checkedtouchpad.scrollEdge = scrollMethodTouchpadEdges.checkedroot.changeSignal()}loading = truenaturalScroll.load()loading = false}QQC2.RadioButton {id: scrollMethodTwoFingerstext: i18nd("kcm_touchpad", "Two fingers")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Slide with two fingers scrolls.")visible: parent.hovereddelay: 1000}}QQC2.RadioButton {id: scrollMethodTouchpadEdgestext: i18nd("kcm_touchpad", "Touchpad edges")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Slide on the touchpad edges scrolls.")visible: parent.hovereddelay: 1000}onCheckedChanged: scrollMethod.syncCurrent()}}QQC2.CheckBox {id: naturalScrolltext: i18nd("kcm_touchpad", "Invert scroll direction (Natural scrolling)")function load() {enabled = touchpad.supportsNaturalScrollchecked = enabled && touchpad.naturalScroll}onCheckedChanged: {if (enabled && !root.loading) {touchpad.naturalScroll = checkedroot.changeSignal()}}hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Touchscreen like scrolling.")visible: parent.hovereddelay: 1000}}QQC2.CheckBox {id: disableHorizontalScrollingtext: i18nd("kcm_touchpad", "Disable horizontal scrolling")function load() {visible = touchpad.supportsHorizontalScrollingenabled = touchpad.supportsHorizontalScrollingchecked = enabled && !touchpad.horizontalScrolling}onCheckedChanged: {if (enabled && !root.loading) {touchpad.horizontalScrolling = !checkedroot.changeSignal()}}hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Disable horizontal scrolling.")visible: parent.hovereddelay: 1000}}Item {Kirigami.FormData.isSection: false}// TappingQQC2.CheckBox {id: tapToClickKirigami.FormData.label: i18ndc("kcm_touchpad", "@label for checkbox, tap-to-click", "Tapping:")text: i18ndc("kcm_touchpad", "@option:check", "Tap-to-click")hoverEnabled: trueQQC2.ToolTip {text: i18ndc("kcm_touchpad", "@info:tooltip", "Single tap to left-click.")visible: parent.hovereddelay: 1000}function load() {enabled = touchpad.tapFingerCount > 0checked = enabled && touchpad.tapToClick}function updateDependents() {loading = truetapAndDrag.load()tapAndDragLock.load()multiTap.load()loading = false}onCheckedChanged: {if (enabled && !root.loading) {touchpad.tapToClick = checkedupdateDependents()root.changeSignal()}}}QQC2.CheckBox {id: tapAndDragtext: i18nd("kcm_touchpad", "Tap-and-drag")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Sliding over touchpad directly after tap drags.")visible: parent.hovereddelay: 1000}function load() {enabled = touchpad.tapFingerCount > 0 && tapToClick.checkedchecked = enabled && touchpad.tapAndDrag}function updateDependents() {loading = truetapAndDragLock.load()loading = false}onCheckedChanged: {if (enabled && !root.loading) {touchpad.tapAndDrag = checkedupdateDependents()root.changeSignal()}}}QQC2.CheckBox {id: tapAndDragLocktext: i18nd("kcm_touchpad", "Tap-and-drag lock")hoverEnabled: trueQQC2.ToolTip {text: i18nd("kcm_touchpad", "Dragging continues after a short finger lift.")visible: parent.hovereddelay: 1000}function load() {enabled = touchpad.tapFingerCount > 0 && tapAndDrag.checkedchecked = enabled && touchpad.tapDragLock}onCheckedChanged: {if (enabled && !root.loading) {touchpad.tapDragLock = checkedroot.changeSignal()}}}ColumnLayout {id: multiTapKirigami.FormData.label: i18nd("kcm_touchpad", "Two-finger tap:")Kirigami.FormData.buddyFor: multiTapRightClickspacing: Kirigami.Units.smallSpacing// hide initiallyvisible: falsefunction load() {visible = touchpad.supportsLmrTapButtonMapenabled = touchpad.supportsLmrTapButtonMap && tapToClick.checkedif (touchpad.tapFingerCount > 2) {multiTapRightClick.text = i18nd("kcm_touchpad", "Right-click (three-finger tap to middle-click)")multiTapRightClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to right-click, tap with three fingers to middle-click.")multiTapMiddleClick.text = i18nd("kcm_touchpad", "Middle-click (three-finger tap to right-click)")multiTapMiddleClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to middle-click, tap with three fingers to right-click.")} else {multiTapRightClick.text = i18nd("kcm_touchpad", "Right-click")multiTapRightClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to right-click.")multiTapMiddleClick.text = i18nd("kcm_touchpad", "Middle-click")multiTapMiddleClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to middle-click.")}if (!enabled) {multiTapRightClick.checked = falsemultiTapMiddleClick.checked = falsereturn}if (touchpad.lmrTapButtonMap) {multiTapMiddleClick.checked = true} else {multiTapRightClick.checked = true}}function syncCurrent() {if (enabled && !root.loading) {touchpad.lmrTapButtonMap = multiTapMiddleClick.checkedroot.changeSignal()}}QQC2.RadioButton {id: multiTapRightClick// text: is handled dynamically on load.hoverEnabled: trueQQC2.ToolTip {id: multiTapRightClickToolTipvisible: parent.hovereddelay: 1000// text: is handled dynamically on load.}onCheckedChanged: multiTap.syncCurrent()}QQC2.RadioButton {id: multiTapMiddleClick// text: is handled dynamically on load.hoverEnabled: trueQQC2.ToolTip {id: multiTapMiddleClickToolTipvisible: parent.hovereddelay: 1000// text: is handled dynamically on load.}onCheckedChanged: multiTap.syncCurrent()}}Item {Kirigami.FormData.isSection: false}ColumnLayout {id: rightClickMethodKirigami.FormData.label: i18ndc("kcm_touchpad", "@label for radiobutton group, configure right-click with touch-pad integrated button (pressing into the touchpad)", "Integrated right-click:")Kirigami.FormData.buddyFor: rightClickMethodAreas// spacing only on top of radio buttons, not between radio and help text labelspacing: 0// hide initiallyvisible: falsefunction load() {enabled = touchpad.supportsClickMethodAreas && touchpad.supportsClickMethodClickfingervisible = touchpad.supportsClickMethodAreas || touchpad.supportsClickMethodClickfingerrightClickMethodAreas.enabled = touchpad.supportsClickMethodAreasrightClickMethodClickfinger.enabled = touchpad.supportsClickMethodClickfingerif (rightClickMethodAreas.enabled && touchpad.clickMethodAreas) {rightClickMethodAreas.checked = true} else if (rightClickMethodClickfinger.enabled && touchpad.clickMethodClickfinger) {rightClickMethodClickfinger.checked = true}}function syncCurrent() {if (enabled && !root.loading) {touchpad.clickMethodAreas = rightClickMethodAreas.checked && rightClickMethodAreas.visibletouchpad.clickMethodClickfinger = rightClickMethodClickfinger.checked && rightClickMethodClickfinger.visibleroot.changeSignal()}loading = truemiddleClickMethod.load()loading = false}QQC2.RadioButton {id: rightClickMethodAreastext: i18ndc("kcm_touchpad", "@option:radio touchpad integrated right-click", "Press bottom-right corner")hoverEnabled: trueproperty string toolTipText:middleEmulation.checked? i18ndc("kcm_touchpad", "@info:tooltip", "Pressing the bottom right corner of your touchpad acts as right-click. Middle-click by simultaneously pressing the bottom left and bottom right corners."): i18ndc("kcm_touchpad", "@info:tooltip", "Pressing the bottom right corner of your touchpad acts as right-click. Middle-click by pressing the bottom central area.")QQC2.ToolTip.text: toolTipTextQQC2.ToolTip.visible: hoveredQQC2.ToolTip.delay: 1000}QQC2.Label {Layout.fillWidth: truevisible: !middleClickMethod.visibleleftPadding: Application.layoutDirection === Qt.LeftToRight ?rightClickMethodAreas.contentItem.leftPadding : rightClickMethodAreas.paddingrightPadding: Application.layoutDirection === Qt.RightToLeft ?rightClickMethodAreas.contentItem.rightPadding : rightClickMethodAreas.paddingtext: middleEmulation.checked? i18ndc("kcm_touchpad", "@info shown below radio button", "Middle-click by pressing both bottom corners."): i18ndc("kcm_touchpad", "@info shown below radio button", "Middle-click by pressing bottom center.")textFormat: Text.PlainTextelide: Text.ElideRightfont: Kirigami.Theme.smallFontQQC2.ToolTip.text: rightClickMethodAreas.toolTipTextQQC2.ToolTip.visible: labelRightAreasMouseArea.containsMouseQQC2.ToolTip.delay: 1000MouseArea {id: labelRightAreasMouseAreaanchors.fill: parenthoverEnabled: true}}QQC2.RadioButton {id: rightClickMethodClickfingertext: i18ndc("kcm_touchpad", "@option:radio touchpad integrated right-click", "Press touchpad with two fingers")topPadding: Kirigami.Units.smallSpacing // in lieu of rightClickMethod.spacinghoverEnabled: trueproperty string toolTipText: i18ndc("kcm_touchpad", "@info:tooltip for radiobutton", "Pressing the touchpad anywhere with two fingers acts as right-click.")QQC2.ToolTip.text: toolTipTextQQC2.ToolTip.visible: hoveredQQC2.ToolTip.delay: 1000onCheckedChanged: rightClickMethod.syncCurrent()}QQC2.Label {Layout.fillWidth: truevisible: !middleClickMethod.visibleleftPadding: Application.layoutDirection === Qt.LeftToRight ?rightClickMethodClickfinger.contentItem.leftPadding : rightClickMethodClickfinger.paddingrightPadding: Application.layoutDirection === Qt.RightToLeft ?rightClickMethodClickfinger.contentItem.rightPadding : rightClickMethodClickfinger.paddingtext: i18ndc("kcm_touchpad", "@info shown below radio button", "Middle-click by pressing with three fingers.")textFormat: Text.PlainTextelide: Text.ElideRightfont: Kirigami.Theme.smallFontQQC2.ToolTip.text: rightClickMethodClickfinger.toolTipTextQQC2.ToolTip.visible: labelRightClickfingerMouseArea.containsMouseQQC2.ToolTip.delay: 1000MouseArea {id: labelRightClickfingerMouseAreaanchors.fill: parenthoverEnabled: true}}}ColumnLayout {id: middleClickMethodKirigami.FormData.label: i18ndc("kcm_touchpad", "@label for radiobutton group, configure middle-click with touch-pad integrated button (pressing into the touchpad)", "Integrated middle-click:")Kirigami.FormData.buddyFor: middleSoftwareEmulationspacing: Kirigami.Units.smallSpacingvisible: noMiddleSoftwareEmulation.visible ||middleSoftwareEmulation.visible ||clickfingerMiddleInfoBox.visiblefunction load() {enabled = touchpad.supportsMiddleEmulationif (enabled && touchpad.middleEmulation) {middleSoftwareEmulation.checked = true} else {noMiddleSoftwareEmulation.checked = true}}function syncCurrent() {if (enabled && !root.loading) {touchpad.middleEmulation = middleSoftwareEmulation.checked && middleSoftwareEmulation.visibleroot.changeSignal()}loading = truemiddleEmulation.load()loading = false}QQC2.RadioButton {id: noMiddleSoftwareEmulationtext: i18ndc("kcm_touchpad", "@option:radio touchpad integrated middle-click", "Press bottom middle edge")visible: rightClickMethodAreas.checkedhoverEnabled: trueQQC2.ToolTip {text: i18ndc("kcm_touchpad", "@info:tooltip for radiobutton", "Pressing the bottom right corner of your touchpad acts as right-click.")visible: parent.hovereddelay: 1000}}QQC2.RadioButton {id: middleSoftwareEmulationtext: i18ndc("kcm_touchpad", "@option:radio touchpad integrated middle-click", "Press bottom left and bottom right corners")visible: rightClickMethodAreas.checkedhoverEnabled: trueQQC2.ToolTip {text: i18ndc("kcm_touchpad", "@info:tooltip for radiobutton", "Pressing the bottom left and bottom right corners simultaneously acts as middle-click.")visible: parent.hovereddelay: 1000}onCheckedChanged: middleClickMethod.syncCurrent()}QQC2.CheckBox {id: clickfingerMiddleInfoBoxtext: i18ndc("kcm_touchpad", "@option:check touchpad integrated middle-click", "Press touchpad with three fingers")checked: trueenabled: falsevisible: rightClickMethodClickfinger.checkedhoverEnabled: trueQQC2.ToolTip {text: i18ndc("kcm_touchpad", "@info:tooltip for radiobutton", "Pressing the touchpad anywhere with three fingers acts as middle-click.")visible: parent.hovereddelay: 1000}}}}}