feat(qt): edit context menu on the header search input

QML TextInput has no system edit menu; a RightButton overlay opens a
CardMenu with Cut / Copy / Paste / Select all. Menu cut/paste are
programmatic edits that never emit textEdited, so the live-query hook is
factored out and re-run after them. New scissors/clipboard glyphs baked
across the six tints; Cut and Paste msgids added to the seven non-English
locales.

cc
This commit is contained in:
vicrodh committed 2026-08-31 11:26:12 -06:00
1 parent 712a0d1903
commit 7f702f118d
21 files changed
+94 -1

No files matched your search

@@ -4794,6 +4794,12 @@ msgstr "Optional — externe Laufwerke & NAS"
msgid "Copy"
msgstr "Kopieren"
msgid "Cut"
msgstr "Ausschneiden"
msgid "Paste"
msgstr "Einfügen"
msgid "Copied!"
msgstr "Kopiert!"
@@ -4830,6 +4830,12 @@ msgstr "Opcional — discos externos y NAS"
msgid "Copy"
msgstr "Copiar"
msgid "Cut"
msgstr "Cortar"
msgid "Paste"
msgstr "Pegar"
msgid "Copied!"
msgstr "¡Copiado!"
@@ -4794,6 +4794,12 @@ msgstr "Optionnel — disques externes et NAS"
msgid "Copy"
msgstr "Copier"
msgid "Cut"
msgstr "Couper"
msgid "Paste"
msgstr "Coller"
msgid "Copied!"
msgstr "Copié !"
@@ -4783,6 +4783,12 @@ msgstr "任意 — 外部ドライブと NAS"
msgid "Copy"
msgstr "コピー"
msgid "Cut"
msgstr "切り取り"
msgid "Paste"
msgstr "貼り付け"
msgid "Copied!"
msgstr "コピーしました!"
@@ -4806,6 +4806,12 @@ msgstr "Optioneel — externe schijven & NAS"
msgid "Copy"
msgstr "Kopiëren"
msgid "Cut"
msgstr "Knippen"
msgid "Paste"
msgstr "Plakken"
msgid "Copied!"
msgstr "Gekopieerd!"
@@ -4794,6 +4794,12 @@ msgstr "Opcional — discos externos e NAS"
msgid "Copy"
msgstr "Copiar"
msgid "Cut"
msgstr "Recortar"
msgid "Paste"
msgstr "Colar"
msgid "Copied!"
msgstr "Copiado!"
@@ -4810,6 +4810,12 @@ msgstr "Опционально — внешние диски и NAS"
msgid "Copy"
msgstr "Копировать"
msgid "Cut"
msgstr "Вырезать"
msgid "Paste"
msgstr "Вставить"
msgid "Copied!"
msgstr "Скопировано!"
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#4285f4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>

After

Width:  |  Height:  |  Size: 321 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#4285f4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>

After

Width:  |  Height:  |  Size: 326 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>

After

Width:  |  Height:  |  Size: 321 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#000000" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>

After

Width:  |  Height:  |  Size: 326 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#888888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>

After

Width:  |  Height:  |  Size: 321 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#888888" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>

After

Width:  |  Height:  |  Size: 326 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>

After

Width:  |  Height:  |  Size: 321 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>

After

Width:  |  Height:  |  Size: 326 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#cccccc" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>

After

Width:  |  Height:  |  Size: 321 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#cccccc" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>

After

Width:  |  Height:  |  Size: 326 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fbbf24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect width="8" height="4" x="8" y="2" rx="1" ry="1"/><path d="M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2"/></svg>

After

Width:  |  Height:  |  Size: 321 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#fbbf24" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="6" cy="6" r="3"/><path d="M8.12 8.12 12 12"/><path d="M20 4 8.12 15.88"/><circle cx="6" cy="18" r="3"/><path d="M14.8 14.8 20 20"/></svg>

After

Width:  |  Height:  |  Size: 326 B

+38 -1
View File
@@ -832,13 +832,50 @@ Rectangle {
// the reference opens on the FIRST keystroke >= 2 chars and
// debounces only the LOAD. Rust's version guard is what discards
// the superseded loads.
onTextEdited: {
// Shared by keyboard edits (onTextEdited) and the edit menu's
// cut/paste, which are PROGRAMMATIC changes — TextInput only
// emits textEdited for user input, so a menu paste would
// otherwise change the text without ever driving the cortinilla.
function applyLiveQuery() {
if (text.trim().length < 2) {
QbzSearch.cortinillaDismiss()
} else {
QbzSearch.searchLive(text)
}
}
onTextEdited: applyLiveQuery()
// QoL round: clipboard access by pointer, not only Ctrl+C/X/V —
// QML TextInput has no system edit menu of its own. RightButton
// only, so left clicks keep placing the cursor.
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: function (mouse) {
searchEditMenu.openAtCursor(searchInput, mouse.x, mouse.y)
}
}
CardMenu {
id: searchEditMenu
menuWidth: 160
entries: {
var t = QbzSession.tr
var r = QbzSession.trRev
var hasSel = searchInput.selectedText !== ""
return [
{ "label": t("Cut", r), "icon": "scissors", "action": "cut", "enabled": hasSel },
{ "label": t("Copy", r), "icon": "copy", "action": "copy", "enabled": hasSel },
{ "label": t("Paste", r), "icon": "clipboard", "action": "paste", "enabled": searchInput.canPaste },
{ "label": t("Select all", r), "icon": "square-check-big", "action": "select-all", "enabled": searchInput.text !== "" },
]
}
onPicked: function (a) {
if (a === "cut") { searchInput.cut(); searchInput.applyLiveQuery() }
else if (a === "copy") searchInput.copy()
else if (a === "paste") { searchInput.paste(); searchInput.applyLiveQuery() }
else if (a === "select-all") searchInput.selectAll()
}
}
// The Enter rule (HeaderBar.slint on-enter): cortinilla open +
// a keyboard selection -> activate the row; open + none -> full
+2
View File
@@ -174,6 +174,7 @@ const MASTERS: &[(&str, &str)] = &[
("circle-alert", include_str!("../qml/assets/icons/primary/circle-alert.svg")),
("circle-check-big", include_str!("../qml/assets/icons/primary/circle-check-big.svg")),
("circle-stop", include_str!("../qml/assets/icons/primary/circle-stop.svg")),
("clipboard", include_str!("../qml/assets/icons/primary/clipboard.svg")),
("clock", include_str!("../qml/assets/icons/primary/clock.svg")),
("cloud-download", include_str!("../qml/assets/icons/primary/cloud-download.svg")),
("cloud-off", include_str!("../qml/assets/icons/primary/cloud-off.svg")),
@@ -266,6 +267,7 @@ const MASTERS: &[(&str, &str)] = &[
("repeat", include_str!("../qml/assets/icons/primary/repeat.svg")),
("rotate-ccw", include_str!("../qml/assets/icons/primary/rotate-ccw.svg")),
("rows-3", include_str!("../qml/assets/icons/primary/rows-3.svg")),
("scissors", include_str!("../qml/assets/icons/primary/scissors.svg")),
("search", include_str!("../qml/assets/icons/primary/search.svg")),
// The GEAR. Distinct from settings-2 (two sliders) — the kiosk NavRail's
// seventh tile uses this one (`shell/NavRail.slint:185`).