OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * FileManager constructor. | 6 * FileManager constructor. |
7 * | 7 * |
8 * FileManager objects encapsulate the functionality of the file selector | 8 * FileManager objects encapsulate the functionality of the file selector |
9 * dialogs, as well as the full screen file manager application (though the | 9 * dialogs, as well as the full screen file manager application (though the |
10 * latter is not yet implemented). | 10 * latter is not yet implemented). |
(...skipping 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3740 */ | 3740 */ |
3741 FileManager.prototype.onKeyDown_ = function(event) { | 3741 FileManager.prototype.onKeyDown_ = function(event) { |
3742 if (event.srcElement === this.renameInput_) { | 3742 if (event.srcElement === this.renameInput_) { |
3743 // Ignore keydown handler in the rename input box. | 3743 // Ignore keydown handler in the rename input box. |
3744 return; | 3744 return; |
3745 } | 3745 } |
3746 | 3746 |
3747 switch (util.getKeyModifiers(event) + event.keyCode) { | 3747 switch (util.getKeyModifiers(event) + event.keyCode) { |
3748 case 'Ctrl-190': // Ctrl-. => Toggle filter files. | 3748 case 'Ctrl-190': // Ctrl-. => Toggle filter files. |
3749 var dm = this.directoryModel_; | 3749 var dm = this.directoryModel_; |
3750 dm.setFilterHidden(!dm.getFilterHidden()); | 3750 dm.setFilterHidden(!dm.isFilterHiddenOn()); |
3751 event.preventDefault(); | 3751 event.preventDefault(); |
3752 return; | 3752 return; |
3753 | 3753 |
3754 case '27': // Escape => Cancel dialog. | 3754 case '27': // Escape => Cancel dialog. |
3755 if (this.copyManager_ && | 3755 if (this.copyManager_ && |
3756 this.copyManager_.getStatus().totalFiles != 0) { | 3756 this.copyManager_.getStatus().totalFiles != 0) { |
3757 // If there is a copy in progress, ESC will cancel it. | 3757 // If there is a copy in progress, ESC will cancel it. |
3758 event.preventDefault(); | 3758 event.preventDefault(); |
3759 this.copyManager_.requestCancel(); | 3759 this.copyManager_.requestCancel(); |
3760 return; | 3760 return; |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4201 FileManager.prototype.validateFileName_ = function(name, opt_onDone) { | 4201 FileManager.prototype.validateFileName_ = function(name, opt_onDone) { |
4202 var onDone = opt_onDone || function() {}; | 4202 var onDone = opt_onDone || function() {}; |
4203 var msg; | 4203 var msg; |
4204 var testResult = /[\/\\\<\>\:\?\*\"\|]/.exec(name); | 4204 var testResult = /[\/\\\<\>\:\?\*\"\|]/.exec(name); |
4205 if (testResult) { | 4205 if (testResult) { |
4206 msg = strf('ERROR_INVALID_CHARACTER', testResult[0]); | 4206 msg = strf('ERROR_INVALID_CHARACTER', testResult[0]); |
4207 } else if (/^\s*$/i.test(name)) { | 4207 } else if (/^\s*$/i.test(name)) { |
4208 msg = str('ERROR_WHITESPACE_NAME'); | 4208 msg = str('ERROR_WHITESPACE_NAME'); |
4209 } else if (/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(name)) { | 4209 } else if (/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])$/i.test(name)) { |
4210 msg = str('ERROR_RESERVED_NAME'); | 4210 msg = str('ERROR_RESERVED_NAME'); |
4211 } else if (this.directoryModel_.getFilterHidden() && name[0] == '.') { | 4211 } else if (this.directoryModel_.isFilterHiddenOn() && name[0] == '.') { |
4212 msg = str('ERROR_HIDDEN_NAME'); | 4212 msg = str('ERROR_HIDDEN_NAME'); |
4213 } | 4213 } |
4214 | 4214 |
4215 if (msg) { | 4215 if (msg) { |
4216 this.alert.show(msg, onDone); | 4216 this.alert.show(msg, onDone); |
4217 return false; | 4217 return false; |
4218 } | 4218 } |
4219 | 4219 |
4220 onDone(); | 4220 onDone(); |
4221 return true; | 4221 return true; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4329 | 4329 |
4330 handleSplitterDragEnd: function(e) { | 4330 handleSplitterDragEnd: function(e) { |
4331 Splitter.prototype.handleSplitterDragEnd.apply(this, arguments); | 4331 Splitter.prototype.handleSplitterDragEnd.apply(this, arguments); |
4332 this.ownerDocument.documentElement.classList.remove('col-resize'); | 4332 this.ownerDocument.documentElement.classList.remove('col-resize'); |
4333 } | 4333 } |
4334 }; | 4334 }; |
4335 | 4335 |
4336 customSplitter.decorate(splitterElement); | 4336 customSplitter.decorate(splitterElement); |
4337 }; | 4337 }; |
4338 })(); | 4338 })(); |
OLD | NEW |