summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2017-04-05 12:27:14 +0200
committerKai Uwe Broulik <[email protected]>2017-04-05 12:27:14 +0200
commit45bea58f9bfeedcc06ec8ed086215287c2737155 (patch)
treedb6b0ce849618c48be20717fe8d23b531fd3453e
parentfa6c8ba5c0404ad6e9f6b03b70853394c8919d36 (diff)
[Folder View] Rename on clicking outside
When renaming a file and clicking elsewhere, actually rename instead of canceling. This is what Dolphin and other file managers do. When pressing Escape, closing the popup, or starting to scroll, the rename operation is cancelled as before. BUG: 378447 Differential Revision: https://phabricator.kde.org/D5305
-rw-r--r--containments/desktop/package/contents/ui/FolderView.qml13
1 files changed, 9 insertions, 4 deletions
diff --git a/containments/desktop/package/contents/ui/FolderView.qml b/containments/desktop/package/contents/ui/FolderView.qml
index ab060ab..4a729ce 100644
--- a/containments/desktop/package/contents/ui/FolderView.qml
+++ b/containments/desktop/package/contents/ui/FolderView.qml
@@ -241,7 +241,7 @@ Item {
}
if (childAt(mouse.x, mouse.y) != editor) {
- editor.targetItem = null;
+ editor.commit();
}
pressX = mouse.x;
@@ -1136,8 +1136,7 @@ Item {
switch(event.key) {
case Qt.Key_Return:
case Qt.Key_Enter:
- dir.rename(positioner.map(targetItem.index), text);
- targetItem = null;
+ commit();
break;
case Qt.Key_Escape:
targetItem = null;
@@ -1227,7 +1226,13 @@ Item {
x = xy[0];
y = xy[1];
}
-
+
+ function commit() {
+ if (targetItem) {
+ dir.rename(positioner.map(targetItem.index), text);
+ targetItem = null;
+ }
+ }
}
Component.onCompleted: {