From 8e0c244482307157e45accde6d85ee60b60c6d80 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Wed, 18 Nov 2015 16:59:42 +0100 Subject: [PATCH] fix positioning of edit menu, add a button to select don't show edit menu for passwords --- .../plasmastyle/EditMenuTouch.qml | 16 +++++++++++++--- .../plasmastyle/TextAreaStyle.qml | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/declarativeimports/plasmastyle/EditMenuTouch.qml b/src/declarativeimports/plasmastyle/EditMenuTouch.qml index 4c818ffc5..4c4b42cda 100644 --- a/src/declarativeimports/plasmastyle/EditMenuTouch.qml +++ b/src/declarativeimports/plasmastyle/EditMenuTouch.qml @@ -57,6 +57,15 @@ Item { x: parent.margins.left y: parent.margins.top property Item checkedButton + PlasmaComponents.ToolButton { + iconSource: "text-field" + flat: false + visible: input.selectedText == "" + onClicked: { + selectWord(); + popupTimer.restart(); + } + } PlasmaComponents.ToolButton { iconSource: "edit-cut" flat: false @@ -77,7 +86,7 @@ Item { } PlasmaComponents.ToolButton { iconSource: "edit-paste" - enabled: input.canPaste + visible: input.canPaste flat: false onClicked: { control.paste(); @@ -127,11 +136,12 @@ Item { id: popupTimer interval: 1 onTriggered: { - if ((input.canPaste || selectionStart !== selectionEnd) && control.activeFocus) { + if (control.echoMode != TextInput.Password && control.activeFocus) { var startRect = input.positionToRectangle(input.selectionStart); var endRect = input.positionToRectangle(input.selectionEnd); - var pos = getMenuInstance().parent.mapFromItem(input, startRect.x, startRect.y + units.gridUnit); + var pos = getMenuInstance().parent.mapFromItem(input, (startRect.x + endRect.x)/2 - getMenuInstance().width/2, endRect.y); + pos.y += (pos.y + getMenuInstance().height + units.gridUnit) > getMenuInstance().parent.height ? -units.smallSpacing - getMenuInstance().height : units.gridUnit*2; getMenuInstance().dismiss(); getMenuInstance().popup(pos); diff --git a/src/declarativeimports/plasmastyle/TextAreaStyle.qml b/src/declarativeimports/plasmastyle/TextAreaStyle.qml index 0beb0c002..f5be27ca0 100644 --- a/src/declarativeimports/plasmastyle/TextAreaStyle.qml +++ b/src/declarativeimports/plasmastyle/TextAreaStyle.qml @@ -39,7 +39,7 @@ QtQuickControlStyle.TextAreaStyle { backgroundColor: "transparent" textColor: control.backgroundVisible ? theme.viewTextColor : PlasmaCore.ColorScope.textColor selectionColor: control.backgroundVisible ? theme.viewFocusColor : PlasmaCore.ColorScope.highlightColor - selectedTextColor: control.backgroundVisible ? theme.viewFocusColor : PlasmaCore.ColorScope.backgroundColor + selectedTextColor: control.backgroundVisible ? theme.viewBackgroundColor : PlasmaCore.ColorScope.backgroundColor renderType: Text.NativeRendering