Warning, /plasma/plasma-desktop/kcms/touchpad/kcm/libinput/touchpad.qml is written in an unsupported language. File is not indexed.
0001 /*
0002 SPDX-FileCopyrightText: 2017 Roman Gilg <subdiff@gmail.com>
0003 SPDX-FileCopyrightText: 2018 Furkan Tokac <furkantokac34@gmail.com>
0004
0005 SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007
0008 import QtQuick
0009 import QtQuick.Controls as QQC2
0010 import QtQuick.Layouts
0011
0012 import org.kde.kcmutils as KCM
0013 import org.kde.kirigami as Kirigami
0014
0015 import org.kde.touchpad.kcm
0016
0017 KCM.SimpleKCM {
0018 id: root
0019
0020 spacing: Kirigami.Units.smallSpacing
0021
0022 property alias deviceIndex: deviceSelector.currentIndex
0023 signal changeSignal()
0024
0025 property QtObject touchpad
0026 property int touchpadCount: backend.touchpadCount
0027
0028 property bool loading: false
0029
0030 function resetModel(index) {
0031 touchpadCount = backend.touchpadCount
0032 formLayout.enabled = touchpadCount
0033 deviceSelector.enabled = touchpadCount > 1
0034
0035 loading = true
0036 if (touchpadCount) {
0037 touchpad = deviceModel[index]
0038 deviceSelector.model = deviceModel
0039 deviceSelector.currentIndex = index
0040 } else {
0041 deviceSelector.model = [""]
0042 }
0043 loading = false
0044 }
0045
0046 function syncValuesFromBackend() {
0047 loading = true
0048
0049 deviceEnabled.load()
0050 dwt.load()
0051 leftHanded.load()
0052 middleEmulation.load()
0053 accelSpeedSpinbox.load()
0054 accelSpeedSlider.load()
0055 accelProfile.load()
0056 tapToClick.load()
0057 tapAndDrag.load()
0058 tapAndDragLock.load()
0059 multiTap.load()
0060 scrollMethod.load()
0061 naturalScroll.load()
0062 scrollFactor.load()
0063 rightClickMethod.load()
0064 middleClickMethod.load()
0065 disableHorizontalScrolling.load()
0066
0067 loading = false
0068 }
0069
0070 header: Kirigami.InlineMessage {
0071 id: inlineMessage
0072 }
0073
0074 Connections {
0075 target: TouchpadConfig
0076
0077 function onShowMessage(message, type) {
0078
0079 if (touchpadCount === 0) {
0080 return
0081 }
0082
0083 if (message.length !== 0) {
0084 inlineMessage.text = message
0085 inlineMessage.type = type
0086 inlineMessage.visible = true
0087 } else {
0088 inlineMessage.visible = false
0089 }
0090 }
0091 }
0092
0093 Kirigami.PlaceholderMessage {
0094 text: i18nd("kcm_touchpad", "No touchpad found")
0095 anchors.centerIn: parent
0096 visible: touchpadCount === 0
0097 width: parent.width - (Kirigami.Units.largeSpacing * 4)
0098 }
0099
0100
0101 Kirigami.FormLayout {
0102 id: formLayout
0103
0104 visible: touchpadCount > 0
0105
0106 // Device
0107 QQC2.ComboBox {
0108 Kirigami.FormData.label: i18nd("kcm_touchpad", "Device:")
0109 id: deviceSelector
0110
0111 visible: touchpadCount > 1
0112 Layout.fillWidth: true
0113 model: deviceModel
0114 textRole: "name"
0115
0116 onCurrentIndexChanged: {
0117 if (touchpadCount) {
0118 touchpad = deviceModel[currentIndex]
0119 if (!loading) {
0120 changeSignal()
0121 }
0122 }
0123 root.syncValuesFromBackend()
0124 }
0125 }
0126
0127 Item {
0128 Kirigami.FormData.isSection: false
0129 }
0130
0131 // General settings
0132 QQC2.CheckBox {
0133 id: deviceEnabled
0134 Kirigami.FormData.label: i18nd("kcm_touchpad", "General:")
0135 text: i18nd("kcm_touchpad", "Device enabled")
0136
0137 hoverEnabled: true
0138 QQC2.ToolTip {
0139 text: i18nd("kcm_touchpad", "Accept input through this device.")
0140 visible: parent.hovered
0141 delay: 1000
0142 }
0143
0144 function load() {
0145 if (!formLayout.enabled) {
0146 checked = false
0147 return
0148 }
0149 enabled = touchpad.supportsDisableEvents
0150 checked = enabled && touchpad.enabled
0151 }
0152
0153 onCheckedChanged: {
0154 if (enabled && !root.loading) {
0155 touchpad.enabled = checked
0156 root.changeSignal()
0157 }
0158 }
0159 }
0160
0161 QQC2.CheckBox {
0162 id: dwt
0163 text: i18nd("kcm_touchpad", "Disable while typing")
0164
0165 hoverEnabled: true
0166 QQC2.ToolTip {
0167 text: i18nd("kcm_touchpad", "Disable touchpad while typing to prevent accidental inputs.")
0168 visible: parent.hovered
0169 delay: 1000
0170 }
0171
0172 function load() {
0173 if (!formLayout.enabled) {
0174 checked = false
0175 return
0176 }
0177 enabled = touchpad.supportsDisableWhileTyping
0178 checked = enabled && touchpad.disableWhileTyping
0179 }
0180
0181 onCheckedChanged: {
0182 if (enabled && !root.loading) {
0183 touchpad.disableWhileTyping = checked
0184 root.changeSignal()
0185 }
0186 }
0187 }
0188
0189 QQC2.CheckBox {
0190 id: leftHanded
0191 text: i18nd("kcm_touchpad", "Left handed mode")
0192
0193 hoverEnabled: true
0194 QQC2.ToolTip {
0195 text: i18nd("kcm_touchpad", "Swap left and right buttons.")
0196 visible: parent.hovered
0197 delay: 1000
0198 }
0199
0200 function load() {
0201 if (!formLayout.enabled) {
0202 checked = false
0203 return
0204 }
0205 enabled = touchpad.supportsLeftHanded
0206 checked = enabled && touchpad.leftHanded
0207 }
0208
0209 onCheckedChanged: {
0210 if (enabled && !root.loading) {
0211 touchpad.leftHanded = checked
0212 root.changeSignal()
0213 }
0214 }
0215 }
0216
0217 QQC2.CheckBox {
0218 id: middleEmulation
0219 text: i18nd("kcm_touchpad", "Press left and right buttons for middle click")
0220
0221 hoverEnabled: true
0222 QQC2.ToolTip {
0223 text: i18nd("kcm_touchpad", "Clicking left and right button simultaneously sends middle button click.")
0224 visible: parent.hovered
0225 delay: 1000
0226 }
0227
0228 function load() {
0229 if (!formLayout.enabled) {
0230 checked = false
0231 return
0232 }
0233 enabled = touchpad.supportsMiddleEmulation
0234 checked = enabled && touchpad.middleEmulation
0235 }
0236
0237 onCheckedChanged: {
0238 if (enabled && !root.loading) {
0239 touchpad.middleEmulation = checked
0240 root.changeSignal()
0241 }
0242 loading = true
0243 middleClickMethod.load()
0244 loading = false
0245 }
0246 }
0247
0248 Item {
0249 Kirigami.FormData.isSection: false
0250 }
0251
0252 // Acceleration
0253 RowLayout {
0254 Kirigami.FormData.label: i18nd("kcm_touchpad", "Pointer speed:")
0255 id: accelSpeed
0256 Layout.fillWidth: true
0257
0258 function onAccelSpeedChanged(val) {
0259 // check slider
0260 if (val !== accelSpeedSlider.accelSpeedValue) {
0261 accelSpeedSlider.accelSpeedValue = val
0262 accelSpeedSlider.value = Math.round(6 + (val / 100) / 0.2)
0263 }
0264
0265 // check spinbox
0266 if (val !== accelSpeedSpinbox.value) {
0267 accelSpeedSpinbox.value = val
0268 }
0269
0270 // check libinput accelspeed
0271 if ((val / 100) !== touchpad.pointerAcceleration) {
0272 touchpad.pointerAcceleration = val / 100
0273 root.changeSignal()
0274 }
0275 }
0276
0277 QQC2.Slider {
0278 id: accelSpeedSlider
0279 Layout.fillWidth: true
0280
0281 from: 1
0282 to: 11
0283 stepSize: 1
0284 property int accelSpeedValue: 0 // [-100, 100]
0285
0286 function load() {
0287 enabled = touchpad.supportsPointerAcceleration
0288 if (!enabled) {
0289 return
0290 }
0291
0292 accelSpeedValue = Math.round(touchpad.pointerAcceleration * 100)
0293
0294 // convert libinput pointer acceleration range [-1, 1] to slider range [1, 11]
0295 value = Math.round(6 + touchpad.pointerAcceleration / 0.2)
0296 }
0297
0298 onValueChanged: {
0299 if (touchpad != undefined && enabled && !root.loading) {
0300 // convert slider range [1, 11] to accelSpeedValue range [-100, 100]
0301 accelSpeedValue = Math.round(((value - 6) * 0.2) * 100)
0302
0303 accelSpeed.onAccelSpeedChanged(accelSpeedValue)
0304 }
0305 }
0306 }
0307
0308 QQC2.SpinBox {
0309 id: accelSpeedSpinbox
0310
0311 Layout.minimumWidth: Kirigami.Units.gridUnit * 4
0312
0313 from: -100
0314 to: 100
0315 stepSize: 1
0316 editable: true
0317
0318 validator: DoubleValidator {
0319 bottom: accelSpeedSpinbox.from
0320 top: accelSpeedSpinbox.to
0321 }
0322
0323 function load() {
0324 enabled = touchpad.supportsPointerAcceleration
0325 if (!enabled) {
0326 return
0327 }
0328
0329 // if existing configuration or another application set a value with more than 2 decimals
0330 // we reduce the precision to 2
0331 value = Math.round(touchpad.pointerAcceleration * 100)
0332 }
0333
0334 onValueChanged: {
0335 if (touchpad != undefined && enabled && !root.loading) {
0336 accelSpeed.onAccelSpeedChanged(value)
0337 }
0338 }
0339
0340 textFromValue: function(val, locale) {
0341 return Number(val / 100).toLocaleString(locale, "f", 2)
0342 }
0343
0344 valueFromText: function(text, locale) {
0345 return Number.fromLocaleString(locale, text) * 100
0346 }
0347 }
0348 }
0349
0350 ColumnLayout {
0351 id: accelProfile
0352 Kirigami.FormData.label: i18nd("kcm_touchpad", "Pointer acceleration:")
0353 Kirigami.FormData.buddyFor: accelProfileFlat
0354 spacing: Kirigami.Units.smallSpacing
0355
0356 function load() {
0357 enabled = touchpad.supportsPointerAccelerationProfileAdaptive
0358
0359 if (!enabled) {
0360 accelProfile.visible = false
0361 accelProfileFlat.checked = false
0362 accelProfileAdaptive.checked = false
0363 return
0364 }
0365
0366 if(touchpad.pointerAccelerationProfileAdaptive) {
0367 accelProfileAdaptive.checked = true
0368 } else {
0369 accelProfileFlat.checked = true
0370 }
0371 }
0372
0373 function syncCurrent() {
0374 if (enabled && !root.loading) {
0375 touchpad.pointerAccelerationProfileFlat = accelProfileFlat.checked
0376 touchpad.pointerAccelerationProfileAdaptive = accelProfileAdaptive.checked
0377 root.changeSignal()
0378 }
0379 }
0380
0381 QQC2.RadioButton {
0382 id: accelProfileFlat
0383 text: i18nd("kcm_touchpad", "None")
0384
0385 hoverEnabled: true
0386 QQC2.ToolTip {
0387 text: i18nd("kcm_touchpad", "Cursor moves the same distance as finger.")
0388 visible: parent.hovered
0389 delay: 1000
0390 }
0391 onCheckedChanged: accelProfile.syncCurrent()
0392 }
0393
0394 QQC2.RadioButton {
0395 id: accelProfileAdaptive
0396 text: i18nd("kcm_touchpad", "Standard")
0397
0398 hoverEnabled: true
0399 QQC2.ToolTip {
0400 text: i18nd("kcm_touchpad", "Cursor travel distance depends on movement speed of finger.")
0401 visible: parent.hovered
0402 delay: 1000
0403 }
0404 onCheckedChanged: accelProfile.syncCurrent()
0405 }
0406 }
0407
0408 Item {
0409 Kirigami.FormData.isSection: false
0410 }
0411
0412 // Tapping
0413 QQC2.CheckBox {
0414 id: tapToClick
0415 Kirigami.FormData.label: i18nd("kcm_touchpad", "Tapping:")
0416 text: i18nd("kcm_touchpad", "Tap-to-click")
0417
0418 hoverEnabled: true
0419 QQC2.ToolTip {
0420 text: i18nd("kcm_touchpad", "Single tap is left button click.")
0421 visible: parent.hovered
0422 delay: 1000
0423 }
0424
0425 function load() {
0426 enabled = touchpad.tapFingerCount > 0
0427 checked = enabled && touchpad.tapToClick
0428 }
0429
0430 function updateDependents() {
0431 loading = true
0432 tapAndDrag.load()
0433 tapAndDragLock.load()
0434 multiTap.load()
0435 loading = false
0436 }
0437
0438 onCheckedChanged: {
0439 if (enabled && !root.loading) {
0440 touchpad.tapToClick = checked
0441 updateDependents()
0442 root.changeSignal()
0443 }
0444 }
0445 }
0446
0447 QQC2.CheckBox {
0448 id: tapAndDrag
0449 text: i18nd("kcm_touchpad", "Tap-and-drag")
0450
0451 hoverEnabled: true
0452 QQC2.ToolTip {
0453 text: i18nd("kcm_touchpad", "Sliding over touchpad directly after tap drags.")
0454 visible: parent.hovered
0455 delay: 1000
0456 }
0457
0458 function load() {
0459 enabled = touchpad.tapFingerCount > 0 && tapToClick.checked
0460 checked = enabled && touchpad.tapAndDrag
0461 }
0462
0463 function updateDependents() {
0464 loading = true
0465 tapAndDragLock.load()
0466 loading = false
0467 }
0468
0469 onCheckedChanged: {
0470 if (enabled && !root.loading) {
0471 touchpad.tapAndDrag = checked
0472 updateDependents()
0473 root.changeSignal()
0474 }
0475 }
0476 }
0477
0478 QQC2.CheckBox {
0479 id: tapAndDragLock
0480 text: i18nd("kcm_touchpad", "Tap-and-drag lock")
0481
0482 hoverEnabled: true
0483 QQC2.ToolTip {
0484 text: i18nd("kcm_touchpad", "Dragging continues after a short finger lift.")
0485 visible: parent.hovered
0486 delay: 1000
0487 }
0488
0489 function load() {
0490 enabled = touchpad.tapFingerCount > 0 && tapAndDrag.checked
0491 checked = enabled && touchpad.tapDragLock
0492 }
0493
0494 onCheckedChanged: {
0495 if (enabled && !root.loading) {
0496 touchpad.tapDragLock = checked
0497 root.changeSignal()
0498 }
0499 }
0500 }
0501
0502 ColumnLayout {
0503 id: multiTap
0504 Kirigami.FormData.label: i18nd("kcm_touchpad", "Two-finger tap:")
0505 Kirigami.FormData.buddyFor: multiTapRightClick
0506
0507 spacing: Kirigami.Units.smallSpacing
0508 // hide initially
0509 visible: false
0510
0511 function load() {
0512 visible = touchpad.supportsLmrTapButtonMap
0513 enabled = touchpad.supportsLmrTapButtonMap && tapToClick.checked
0514 if (touchpad.tapFingerCount > 2) {
0515 multiTapRightClick.text = i18nd("kcm_touchpad", "Right-click (three-finger tap to middle-click)")
0516 multiTapRightClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to right-click, tap with three fingers to middle-click.")
0517
0518 multiTapMiddleClick.text = i18nd("kcm_touchpad", "Middle-click (three-finger tap right-click)")
0519 multiTapMiddleClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to middle-click, tap with three fingers to right-click.")
0520 } else {
0521 multiTapRightClick.text = i18nd("kcm_touchpad", "Right-click")
0522 multiTapRightClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to right-click.")
0523
0524 multiTapMiddleClick.text = i18nd("kcm_touchpad", "Middle-click")
0525 multiTapMiddleClickToolTip.text = i18nd("kcm_touchpad", "Tap with two fingers to middle-click.")
0526 }
0527
0528 if (!enabled) {
0529 multiTapRightClick.checked = false
0530 multiTapMiddleClick.checked = false
0531 return
0532 }
0533
0534 if (touchpad.lmrTapButtonMap) {
0535 multiTapMiddleClick.checked = true
0536 } else {
0537 multiTapRightClick.checked = true
0538 }
0539 }
0540
0541 function syncCurrent() {
0542 if (enabled && !root.loading) {
0543 touchpad.lmrTapButtonMap = multiTapMiddleClick.checked
0544 root.changeSignal()
0545 }
0546 }
0547
0548 QQC2.RadioButton {
0549 id: multiTapRightClick
0550 // text: is handled dynamically on load.
0551
0552 hoverEnabled: true
0553 QQC2.ToolTip {
0554 id: multiTapRightClickToolTip
0555 visible: parent.hovered
0556 delay: 1000
0557 // text: is handled dynamically on load.
0558 }
0559 onCheckedChanged: multiTap.syncCurrent()
0560 }
0561
0562 QQC2.RadioButton {
0563 id: multiTapMiddleClick
0564 // text: is handled dynamically on load.
0565
0566 hoverEnabled: true
0567 QQC2.ToolTip {
0568 id: multiTapMiddleClickToolTip
0569 visible: parent.hovered
0570 delay: 1000
0571 // text: is handled dynamically on load.
0572 }
0573 onCheckedChanged: multiTap.syncCurrent()
0574 }
0575 }
0576
0577 Item {
0578 Kirigami.FormData.isSection: false
0579 }
0580
0581 // Scrolling
0582 ColumnLayout {
0583 id: scrollMethod
0584 Kirigami.FormData.label: i18nd("kcm_touchpad", "Scrolling:")
0585 Kirigami.FormData.buddyFor: scrollMethodTwoFingers
0586
0587 spacing: Kirigami.Units.smallSpacing
0588
0589 function load() {
0590 scrollMethodTwoFingers.enabled = touchpad.supportsScrollTwoFinger
0591 scrollMethodTouchpadEdges.enabled = touchpad.supportsScrollEdge
0592
0593 if(scrollMethodTouchpadEdges.enabled && touchpad.scrollEdge) {
0594 scrollMethodTouchpadEdges.checked = formLayout.enabled
0595 } else {
0596 scrollMethodTwoFingers.checked = formLayout.enabled
0597 }
0598 }
0599
0600 function syncCurrent() {
0601 if (enabled && !root.loading) {
0602 touchpad.scrollTwoFinger = scrollMethodTwoFingers.checked
0603 touchpad.scrollEdge = scrollMethodTouchpadEdges.checked
0604 root.changeSignal()
0605 }
0606 loading = true
0607 naturalScroll.load()
0608 loading = false
0609 }
0610
0611 QQC2.RadioButton {
0612 id: scrollMethodTwoFingers
0613 text: i18nd("kcm_touchpad", "Two fingers")
0614
0615 hoverEnabled: true
0616 QQC2.ToolTip {
0617 text: i18nd("kcm_touchpad", "Slide with two fingers scrolls.")
0618 visible: parent.hovered
0619 delay: 1000
0620 }
0621 }
0622
0623 QQC2.RadioButton {
0624 id: scrollMethodTouchpadEdges
0625 text: i18nd("kcm_touchpad", "Touchpad edges")
0626
0627 hoverEnabled: true
0628 QQC2.ToolTip {
0629 text: i18nd("kcm_touchpad", "Slide on the touchpad edges scrolls.")
0630 visible: parent.hovered
0631 delay: 1000
0632 }
0633 onCheckedChanged: scrollMethod.syncCurrent()
0634 }
0635 }
0636
0637 QQC2.CheckBox {
0638 id: naturalScroll
0639 text: i18nd("kcm_touchpad", "Invert scroll direction (Natural scrolling)")
0640
0641 function load() {
0642 enabled = touchpad.supportsNaturalScroll
0643 checked = enabled && touchpad.naturalScroll
0644 }
0645
0646 onCheckedChanged: {
0647 if (enabled && !root.loading) {
0648 touchpad.naturalScroll = checked
0649 root.changeSignal()
0650 }
0651 }
0652
0653 hoverEnabled: true
0654 QQC2.ToolTip {
0655 text: i18nd("kcm_touchpad", "Touchscreen like scrolling.")
0656 visible: parent.hovered
0657 delay: 1000
0658 }
0659 }
0660
0661 QQC2.CheckBox {
0662 id: disableHorizontalScrolling
0663 text: i18nd("kcm_touchpad", "Disable horizontal scrolling")
0664
0665 function load() {
0666 visible = touchpad.supportsHorizontalScrolling
0667 enabled = touchpad.supportsHorizontalScrolling
0668 checked = enabled && !touchpad.horizontalScrolling
0669 }
0670
0671 onCheckedChanged: {
0672 if (enabled && !root.loading) {
0673 touchpad.horizontalScrolling = !checked
0674 root.changeSignal()
0675 }
0676 }
0677
0678 hoverEnabled: true
0679 QQC2.ToolTip {
0680 text: i18nd("kcm_touchpad", "Disable horizontal scrolling")
0681 visible: parent.hovered
0682 delay: 1000
0683 }
0684 }
0685
0686 // Scroll Speed aka scroll Factor
0687 GridLayout {
0688 Kirigami.FormData.label: i18nd("kcm_touchpad", "Scrolling speed:")
0689 Kirigami.FormData.buddyFor: scrollFactor
0690 Layout.fillWidth: true
0691 visible: touchpad.supportsScrollFactor
0692
0693 columns: 3
0694
0695 QQC2.Slider {
0696 id: scrollFactor
0697 Layout.fillWidth: true
0698
0699 from: 0
0700 to: 14
0701 stepSize: 1
0702
0703 readonly property list<real> values: [
0704 0.1,
0705 0.3,
0706 0.5,
0707 0.75,
0708 1, // default
0709 1.5,
0710 2,
0711 3,
0712 4,
0713 5,
0714 7,
0715 9,
0716 12,
0717 15,
0718 20
0719 ]
0720
0721 Layout.columnSpan: 3
0722
0723 function load() {
0724 let index = values.indexOf(touchpad.scrollFactor)
0725 if (index === -1) {
0726 index = values.indexOf(1);
0727 }
0728 value = index
0729 }
0730
0731 onMoved: {
0732 touchpad.scrollFactor = values[value]
0733 root.changeSignal()
0734 }
0735 }
0736
0737 //row 2
0738 QQC2.Label {
0739 text: i18ndc("kcm_touchpad", "Slower Scroll", "Slower")
0740 textFormat: Text.PlainText
0741 }
0742 Item {
0743 Layout.fillWidth: true
0744 }
0745 QQC2.Label {
0746 text: i18ndc("kcm_touchpad", "Faster Scroll Speed", "Faster")
0747 textFormat: Text.PlainText
0748 }
0749 }
0750
0751 Item {
0752 Kirigami.FormData.isSection: false
0753 }
0754
0755 ColumnLayout {
0756 id: rightClickMethod
0757 Kirigami.FormData.label: i18nd("kcm_touchpad", "Right-click:")
0758 Kirigami.FormData.buddyFor: rightClickMethodAreas
0759
0760 spacing: Kirigami.Units.smallSpacing
0761 // hide initially
0762 visible: false
0763
0764 function load() {
0765 enabled = touchpad.supportsClickMethodAreas && touchpad.supportsClickMethodClickfinger
0766 visible = touchpad.supportsClickMethodAreas || touchpad.supportsClickMethodClickfinger
0767
0768 rightClickMethodAreas.enabled = touchpad.supportsClickMethodAreas
0769 rightClickMethodClickfinger.enabled = touchpad.supportsClickMethodClickfinger
0770
0771 if (rightClickMethodAreas.enabled && touchpad.clickMethodAreas) {
0772 rightClickMethodAreas.checked = true
0773 } else if (rightClickMethodClickfinger.enabled && touchpad.clickMethodClickfinger) {
0774 rightClickMethodClickfinger.checked = true
0775 }
0776 }
0777
0778 function syncCurrent() {
0779 if (enabled && !root.loading) {
0780 touchpad.clickMethodAreas = rightClickMethodAreas.checked && rightClickMethodAreas.visible
0781 touchpad.clickMethodClickfinger = rightClickMethodClickfinger.checked && rightClickMethodClickfinger.visible
0782 root.changeSignal()
0783 }
0784 loading = true
0785 middleClickMethod.load()
0786 loading = false
0787 }
0788
0789 QQC2.RadioButton {
0790 id: rightClickMethodAreas
0791 text: i18nd("kcm_touchpad", "Press bottom-right corner")
0792
0793 hoverEnabled: true
0794 QQC2.ToolTip {
0795 text: i18nd("kcm_touchpad", "Software enabled buttons will be added to bottom portion of your touchpad.")
0796 visible: parent.hovered
0797 delay: 1000
0798 }
0799 }
0800
0801 QQC2.RadioButton {
0802 id: rightClickMethodClickfinger
0803 text: i18nd("kcm_touchpad", "Press anywhere with two fingers")
0804
0805 hoverEnabled: true
0806 QQC2.ToolTip {
0807 text: i18nd("kcm_touchpad", "Tap with two finger to enable right click.")
0808 visible: parent.hovered
0809 delay: 1000
0810 }
0811 onCheckedChanged: rightClickMethod.syncCurrent()
0812 }
0813 }
0814
0815 Item {
0816 Kirigami.FormData.isSection: false
0817 }
0818
0819 ColumnLayout {
0820 id: middleClickMethod
0821 Kirigami.FormData.label: i18nd("kcm_touchpad", "Middle-click: ")
0822 Kirigami.FormData.buddyFor: middleSoftwareEmulation
0823
0824 spacing: Kirigami.Units.smallSpacing
0825 visible: noMiddleSoftwareEmulation.visible ||
0826 middleSoftwareEmulation.visible ||
0827 clickfingerMiddleInfoBox.visible
0828
0829 function load() {
0830 enabled = touchpad.supportsMiddleEmulation
0831 if (enabled && touchpad.middleEmulation) {
0832 middleSoftwareEmulation.checked = true
0833 } else {
0834 noMiddleSoftwareEmulation.checked = true
0835 }
0836 }
0837
0838 function syncCurrent() {
0839 if (enabled && !root.loading) {
0840 touchpad.middleEmulation = middleSoftwareEmulation.checked && middleSoftwareEmulation.visible
0841 root.changeSignal()
0842 }
0843 loading = true
0844 middleEmulation.load()
0845 loading = false
0846 }
0847
0848 QQC2.RadioButton {
0849 id: noMiddleSoftwareEmulation
0850 text: i18nd("kcm_touchpad", "Press bottom-middle")
0851 visible: rightClickMethodAreas.checked
0852 hoverEnabled: true
0853 QQC2.ToolTip {
0854 text: i18nd("kcm_touchpad", "Software enabled middle-button will be added to bottom portion of your touchpad.")
0855 visible: parent.hovered
0856 delay: 1000
0857 }
0858 }
0859
0860 QQC2.RadioButton {
0861 id: middleSoftwareEmulation
0862 text: i18nd("kcm_touchpad", "Press bottom left and bottom right corners simultaneously")
0863 visible: rightClickMethodAreas.checked
0864 hoverEnabled: true
0865 QQC2.ToolTip {
0866 text: i18nd("kcm_touchpad", "Clicking left and right button simultaneously sends middle button click.")
0867 visible: parent.hovered
0868 delay: 1000
0869 }
0870 onCheckedChanged: middleClickMethod.syncCurrent()
0871 }
0872
0873 QQC2.CheckBox {
0874 id: clickfingerMiddleInfoBox
0875 text: i18nd("kcm_touchpad", "Press anywhere with three fingers")
0876 checked: true
0877 enabled: false
0878 visible: rightClickMethodClickfinger.checked
0879 hoverEnabled: true
0880 QQC2.ToolTip {
0881 text: i18nd("kcm_touchpad", "Press anywhere with three fingers.")
0882 visible: parent.hovered
0883 delay: 1000
0884 }
0885 }
0886 }
0887 }
0888 }