Verified Commit b55521b8 authored by Fushan Wen's avatar Fushan Wen 💬
Browse files

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.
parent 2ae4b9e2
......@@ -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()
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment