gui: suppress RMB context menus in prompt and chat blocks
B3 (right-click) now only plumbs selection when available — no fallback context menu. Mouse chording (B1+B2 cut, B1+B3 paste) still works. Removed contextMenuComponent and promptContextMenu entirely.
This commit is contained in:
parent
fa58b0f033
commit
5add387cc8
|
|
@ -250,19 +250,12 @@ Column {
|
||||||
}
|
}
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
// B3: Plumb selection, or show context menu
|
// B3: Plumb selection (no context menu)
|
||||||
var sel = mainTextEdit.selectedText
|
var sel = mainTextEdit.selectedText
|
||||||
if (sel && sel.trim() !== "" && plumber.available()) {
|
if (sel && sel.trim() !== "" && plumber.available()) {
|
||||||
plumber.plumb(sel.trim())
|
plumber.plumb(sel.trim())
|
||||||
mouse.accepted = true
|
|
||||||
} else {
|
|
||||||
// Fall back to context menu
|
|
||||||
if (!mainTextEdit._menu) {
|
|
||||||
mainTextEdit._menu = contextMenuComponent.createObject(mainTextEdit)
|
|
||||||
}
|
|
||||||
mainTextEdit._menu.popup()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
}
|
||||||
|
mouse.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -270,7 +263,6 @@ Column {
|
||||||
leftHeld = false
|
leftHeld = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property var _menu: null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Diagram path: use Repeater for blocks that contain diagrams
|
// Diagram path: use Repeater for blocks that contain diagrams
|
||||||
|
|
@ -397,17 +389,12 @@ Column {
|
||||||
}
|
}
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
|
// B3: Plumb selection (no context menu)
|
||||||
var sel = textEdit.selectedText
|
var sel = textEdit.selectedText
|
||||||
if (sel && sel.trim() !== "" && plumber.available()) {
|
if (sel && sel.trim() !== "" && plumber.available()) {
|
||||||
plumber.plumb(sel.trim())
|
plumber.plumb(sel.trim())
|
||||||
mouse.accepted = true
|
|
||||||
} else {
|
|
||||||
if (!textEdit._menu) {
|
|
||||||
textEdit._menu = contextMenuComponent.createObject(textEdit)
|
|
||||||
}
|
|
||||||
textEdit._menu.popup()
|
|
||||||
mouse.accepted = true
|
|
||||||
}
|
}
|
||||||
|
mouse.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -415,51 +402,6 @@ Column {
|
||||||
leftHeld = false
|
leftHeld = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property Menu _menu: null
|
|
||||||
|
|
||||||
Component.onDestruction: {
|
|
||||||
if (_menu) _menu.destroy()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Shared context menu component (created on demand)
|
|
||||||
Component {
|
|
||||||
id: contextMenuComponent
|
|
||||||
Menu {
|
|
||||||
id: ctxMenu
|
|
||||||
property TextEdit target: parent
|
|
||||||
|
|
||||||
MenuItem {
|
|
||||||
text: "Execute (B2)"
|
|
||||||
enabled: ctxMenu.target ? ctxMenu.target.selectedText.length > 0 : false
|
|
||||||
onTriggered: if (ctxMenu.target) executeText(ctxMenu.target.selectedText)
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Plumb (B3)"
|
|
||||||
enabled: ctxMenu.target ? ctxMenu.target.selectedText.length > 0 && plumber.available() : false
|
|
||||||
onTriggered: if (ctxMenu.target) plumber.plumb(ctxMenu.target.selectedText.trim())
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem {
|
|
||||||
text: "Cut (B1+B2)"
|
|
||||||
enabled: ctxMenu.target ? ctxMenu.target.selectedText.length > 0 : false
|
|
||||||
onTriggered: if (ctxMenu.target) ctxMenu.target.cut()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Copy"
|
|
||||||
enabled: ctxMenu.target ? ctxMenu.target.selectedText.length > 0 : false
|
|
||||||
onTriggered: if (ctxMenu.target) ctxMenu.target.copy()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Paste (B1+B3)"
|
|
||||||
onTriggered: if (ctxMenu.target) ctxMenu.target.paste()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Select All"
|
|
||||||
onTriggered: if (ctxMenu.target) ctxMenu.target.selectAll()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -556,20 +498,15 @@ Column {
|
||||||
if (sel && sel.trim() !== "") executeText(sel)
|
if (sel && sel.trim() !== "") executeText(sel)
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
|
// B3: Plumb selection (no context menu)
|
||||||
var sel = sourceEdit.selectedText
|
var sel = sourceEdit.selectedText
|
||||||
if (sel && sel.trim() !== "" && plumber.available()) {
|
if (sel && sel.trim() !== "" && plumber.available()) {
|
||||||
plumber.plumb(sel.trim())
|
plumber.plumb(sel.trim())
|
||||||
} else {
|
|
||||||
if (!sourceEdit._menu) {
|
|
||||||
sourceEdit._menu = contextMenuComponent.createObject(sourceEdit)
|
|
||||||
}
|
|
||||||
sourceEdit._menu.popup()
|
|
||||||
}
|
}
|
||||||
mouse.accepted = true
|
mouse.accepted = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property Menu _menu: null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
|
|
|
||||||
|
|
@ -493,16 +493,13 @@ Item {
|
||||||
if (sel && sel.trim() !== "") {
|
if (sel && sel.trim() !== "") {
|
||||||
ollie.submit(sel.trim())
|
ollie.submit(sel.trim())
|
||||||
} else {
|
} else {
|
||||||
// No selection - paste from clipboard and execute?
|
// No selection - ignore
|
||||||
// Or just ignore. For now, ignore.
|
|
||||||
}
|
}
|
||||||
} else if (mouse.button === Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
// B3: Plumb selection or show context menu
|
// B3: Plumb selection (no context menu)
|
||||||
var sel = promptInput.selectedText
|
var sel = promptInput.selectedText
|
||||||
if (sel && sel.trim() !== "" && plumber.available()) {
|
if (sel && sel.trim() !== "" && plumber.available()) {
|
||||||
plumber.plumb(sel.trim())
|
plumber.plumb(sel.trim())
|
||||||
} else {
|
|
||||||
promptContextMenu.popup()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -511,47 +508,6 @@ Item {
|
||||||
leftHeld = false
|
leftHeld = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu {
|
|
||||||
id: promptContextMenu
|
|
||||||
MenuItem {
|
|
||||||
text: "Execute Selection (B2)"
|
|
||||||
enabled: promptInput.selectedText.length > 0
|
|
||||||
onTriggered: {
|
|
||||||
var sel = promptInput.selectedText
|
|
||||||
if (sel && sel.trim() !== "") ollie.submit(sel.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Plumb Selection (B3)"
|
|
||||||
enabled: promptInput.selectedText.length > 0 && plumber.available()
|
|
||||||
onTriggered: {
|
|
||||||
var sel = promptInput.selectedText
|
|
||||||
if (sel && sel.trim() !== "") plumber.plumb(sel.trim())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem {
|
|
||||||
text: "Cut (B1+B2)"
|
|
||||||
enabled: promptInput.selectedText.length > 0
|
|
||||||
onTriggered: promptInput.cut()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Copy"
|
|
||||||
enabled: promptInput.selectedText.length > 0
|
|
||||||
onTriggered: promptInput.copy()
|
|
||||||
}
|
|
||||||
MenuItem {
|
|
||||||
text: "Paste (B1+B3)"
|
|
||||||
enabled: promptInput.canPaste
|
|
||||||
onTriggered: promptInput.paste()
|
|
||||||
}
|
|
||||||
MenuSeparator {}
|
|
||||||
MenuItem {
|
|
||||||
text: "Select All"
|
|
||||||
onTriggered: promptInput.selectAll()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Paste button (mouse-first workflow)
|
// Paste button (mouse-first workflow)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue