Warning, /plasma/qqc2-breeze-style/style/qtquickcontrols/MobileTextActionsToolBar.qml is written in an unsupported language. File is not indexed.
0001 /* SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org>
0002 * SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
0003 * SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005
0006 import QtQuick
0007 import QtQuick.Layouts
0008 import QtQuick.Window
0009 import QtQuick.Controls
0010 import org.kde.kirigami as Kirigami
0011
0012 import org.kde.breeze.impl as Impl
0013
0014 Loader {
0015 id: root
0016 property Item target
0017 visible: Kirigami.Settings.tabletMode && target.selectByMouse && target.selectedText.length > 0
0018 active: visible
0019 sourceComponent: Popup {
0020 id: popup
0021
0022 property real xAlignHCenter: Math.round(Qt.inputMethod.anchorRectangle.x + (Qt.inputMethod.cursorRectangle.x - Qt.inputMethod.anchorRectangle.x - width)/2)
0023 property real yAlignOver: Math.round(Qt.inputMethod.anchorRectangle.y - height - fontMetrics.descent)
0024
0025 visible: false
0026 parent: Overlay.overlay
0027 modal: false
0028 focus: false
0029 margins: Impl.Units.verySmallSpacing
0030 padding: Kirigami.Units.smallSpacing
0031
0032 x: xAlignHCenter
0033 y: yAlignOver
0034
0035 // HACK: make it appear above most popups that show up in the
0036 // overlay in case any of them use TextField or TextArea
0037 z: 999
0038
0039 contentItem: RowLayout {
0040 spacing: Kirigami.Units.smallSpacing
0041
0042 ToolButton {
0043 focusPolicy: Qt.NoFocus
0044 icon.name: "edit-cut"
0045 text: i18nc("@action:inmenu Text editor action", "Cut")
0046 visible: target && target.selectedText.length > 0 && (!target.hasOwnProperty("echoMode") || target.echoMode === TextInput.Normal)
0047 onClicked: target.cut();
0048 }
0049
0050 ToolButton {
0051 focusPolicy: Qt.NoFocus
0052 icon.name: "edit-copy"
0053 text: i18nc("@action:inmenu Text editor action", "Copy")
0054 visible: target && target.selectedText.length > 0 && (!target.hasOwnProperty("echoMode") || target.echoMode === TextInput.Normal)
0055 onClicked: target.copy();
0056 }
0057
0058 ToolButton {
0059 focusPolicy: Qt.NoFocus
0060 icon.name: "edit-paste"
0061 text: i18nc("@action:inmenu Text editor action", "Paste")
0062 visible: target && target.canPaste
0063 onClicked: target.paste();
0064 }
0065 }
0066
0067 FontMetrics {
0068 id: fontMetrics
0069 font: target.font
0070 }
0071 }
0072 }
0073