fix positioning of edit menu, add a button to select

don't show edit menu for passwords
This commit is contained in:
Marco Martin 2015-11-18 16:59:42 +01:00
parent 69f9460139
commit 8e0c244482
2 changed files with 14 additions and 4 deletions

View File

@ -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);

View File

@ -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