Index: chrome/browser/resources/file_manager/js/file_manager.js |
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js |
index 835f5f0ccd353ba6ce1585c2e1a11818547d882e..552cb4191aac2935a43cbbb05eeab0834d722ac5 100644 |
--- a/chrome/browser/resources/file_manager/js/file_manager.js |
+++ b/chrome/browser/resources/file_manager/js/file_manager.js |
@@ -1725,6 +1725,9 @@ FileManager.prototype = { |
reader.readEntries(onReadSome); |
}; |
+ // Updated when a user clicks on the label of a file, used to detect |
+ // when a click is eligible to trigger a rename. Can be null, or |
+ // an object with 'path' and 'date' properties. |
this.lastLabelClick_ = null; |
// Clear the table first. |
@@ -1825,21 +1828,21 @@ FileManager.prototype = { |
} |
var now = new Date(); |
+ var path = event.srcElement.entry.fullPath; |
- this.lastLabelClick_ = this.lastLabelClick_ || now; |
- var delay = now - this.lastLabelClick_; |
- if (!row.selected || delay < 500) |
- return false; |
+ if (this.lastLabelClick_ && this.lastLabelClick_.path == path) { |
+ var delay = now - this.lastLabelClick_.date; |
+ if (delay > 500 && delay < 2000) |
+ return true; |
+ } |
- this.lastLabelClick_ = now; |
- return true; |
+ this.lastLabelClick_ = {path: path, date: now}; |
+ return false; |
}; |
FileManager.prototype.initiateRename_= function(label) { |
var input = this.renameInput_; |
- window.label = label; |
rginda
2011/06/07 22:58:14
This is some debugging code that slipped in in a p
|
- |
input.value = label.textContent; |
input.style.top = label.offsetTop + 'px'; |
input.style.left = label.offsetLeft + 'px'; |