applets/clipboard: Fix highlight after exiting edit mode

1. Don't change the current item when not saving it.
2. Use Qt.callLater as the item will be moved to the top after saving
   it, and we would like to hightlight the real first item.
wilder-5.25
Fushan Wen 4 years ago
parent 0a3c947fa2
commit 94a8edcb9d
No known key found for this signature in database
GPG Key ID: 2E48D1487C91DCAA
  1. 7
      applets/clipboard/contents/ui/EditPage.qml

@ -21,7 +21,6 @@ ColumnLayout {
Keys.onPressed: {
if (event.key === Qt.Key_Escape) {
stack.pop()
done();
event.accepted = true;
}
}
@ -38,8 +37,8 @@ ColumnLayout {
}
function done() {
stack.initialItem.view.currentIndex = 0;
stack.initialItem.view.currentItem.forceActiveFocus();
// The modified item will be pushed to the top, and we would like to highlight the real first item
Qt.callLater(() => {stack.initialItem.view.currentIndex = 0;});
}
PlasmaComponents3.ScrollView {
@ -79,7 +78,7 @@ ColumnLayout {
PlasmaComponents3.Button {
text: i18nc("@action:button", "Cancel")
icon.name: "dialog-cancel"
onClicked: { stack.pop(); done() }
onClicked: stack.pop()
}
}
}

Loading…
Cancel
Save