Warning, /frameworks/qqc2-desktop-style/org.kde.desktop/private/MobileTextActionsToolBarImpl.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 SPDX-FileCopyrightText: 2018 Marco Martin <mart@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 import QtQuick 0008 import QtQuick.Controls as QQC2 0009 import QtQuick.Layouts 0010 import org.kde.kirigami as Kirigami 0011 0012 QQC2.Popup { 0013 id: root 0014 0015 Kirigami.OverlayZStacking.layer: Kirigami.OverlayZStacking.Menu 0016 z: Kirigami.OverlayZStacking.z 0017 0018 parent: controlRoot.Window.window.contentItem 0019 modal: false 0020 focus: false 0021 closePolicy: QQC2.Popup.NoAutoClose 0022 0023 x: !parent ? 0 : Math.min(Math.max(0, controlRoot.mapToItem(root.parent, controlRoot.positionToRectangle(controlRoot.selectionStart).x, 0).x - root.width / 2), root.parent.width - root.width) 0024 0025 y: { 0026 if (!parent) { 0027 return 0; 0028 } 0029 var desiredY = controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionStart).y).y - root.height; 0030 0031 if (desiredY >= 0) { 0032 return Math.min(desiredY, root.parent.height - root.height); 0033 } else { 0034 return Math.min(Math.max(0, controlRoot.mapToItem(root.parent, 0, controlRoot.positionToRectangle(controlRoot.selectionEnd).y + Math.round(Kirigami.Units.gridUnit*1.5)).y), root.parent.height - root.height); 0035 } 0036 } 0037 0038 width: contentItem.implicitWidth + leftPadding + rightPadding 0039 visible: true 0040 0041 contentItem: RowLayout { 0042 QQC2.ToolButton { 0043 focusPolicy: Qt.NoFocus 0044 icon.name: "edit-cut" 0045 visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) 0046 onClicked: { 0047 controlRoot.cut(); 0048 } 0049 } 0050 QQC2.ToolButton { 0051 focusPolicy: Qt.NoFocus 0052 icon.name: "edit-copy" 0053 visible: controlRoot.selectedText.length > 0 && (!controlRoot.hasOwnProperty("echoMode") || controlRoot.echoMode === TextInput.Normal) 0054 onClicked: { 0055 controlRoot.copy(); 0056 } 0057 } 0058 QQC2.ToolButton { 0059 focusPolicy: Qt.NoFocus 0060 icon.name: "edit-paste" 0061 visible: controlRoot.canPaste 0062 onClicked: { 0063 controlRoot.paste(); 0064 } 0065 } 0066 } 0067 }