applets/clipboard: Don't delete any item when the search field has focus

The behavior may cause unexpected results when the user spam press Del
in order to delete all characters in the search field, and find that
all items in the list are deleted.

It also causes pressing Del in the search field not deleting the fully
selected text.

BUG: 448738
BUG: 448739
wilder-5.25
Fushan Wen 4 years ago
parent 63b8aa0681
commit 79344a3b26
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 12
      applets/clipboard/contents/ui/ClipboardPage.qml

@ -118,18 +118,6 @@ Menu {
inputMethodHints: Qt.ImhNoPredictiveText
// Only override delete key behavior to delete list items if
// it would do nothing
Keys.enabled: filter.text.length == 0 || filter.cursorPosition == filter.length
Keys.onDeletePressed: {
let clipboardItemIndex = clipboardMenu.view.currentIndex
if (clipboardItemIndex != -1) {
let uuid = clipboardMenu.model.get(clipboardItemIndex).UuidRole
if (uuid) {
clipboardMenu.view.currentItem.remove(uuid);
}
}
}
Connections {
target: main

Loading…
Cancel
Save