| 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 2904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2915 if (selectAllCheckbox) | 2915 if (selectAllCheckbox) |
| 2916 this.updateSelectAllCheckboxState_(selectAllCheckbox); | 2916 this.updateSelectAllCheckboxState_(selectAllCheckbox); |
| 2917 }; | 2917 }; |
| 2918 | 2918 |
| 2919 FileManager.prototype.updateOkButton_ = function(event) { | 2919 FileManager.prototype.updateOkButton_ = function(event) { |
| 2920 var selectable; | 2920 var selectable; |
| 2921 | 2921 |
| 2922 if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER) { | 2922 if (this.dialogType_ == FileManager.DialogType.SELECT_FOLDER) { |
| 2923 // In SELECT_FOLDER mode, we allow to select current directory | 2923 // In SELECT_FOLDER mode, we allow to select current directory |
| 2924 // when nothing is selected. | 2924 // when nothing is selected. |
| 2925 selectable = this.selection.directoryCount <= 1 && | 2925 selectable = this.selection && |
| 2926 this.selection.fileCount == 0; | 2926 this.selection.directoryCount <= 1 && |
| 2927 this.selection.fileCount == 0; |
| 2927 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { | 2928 } else if (this.dialogType_ == FileManager.DialogType.SELECT_OPEN_FILE) { |
| 2928 selectable = (this.isSelectionAvailable() && | 2929 selectable = (this.selection && |
| 2930 this.isSelectionAvailable() && |
| 2929 this.selection.directoryCount == 0 && | 2931 this.selection.directoryCount == 0 && |
| 2930 this.selection.fileCount == 1); | 2932 this.selection.fileCount == 1); |
| 2931 } else if (this.dialogType_ == | 2933 } else if (this.dialogType_ == |
| 2932 FileManager.DialogType.SELECT_OPEN_MULTI_FILE) { | 2934 FileManager.DialogType.SELECT_OPEN_MULTI_FILE) { |
| 2933 selectable = (this.isSelectionAvailable() && | 2935 selectable = (this.selection && |
| 2936 this.isSelectionAvailable() && |
| 2934 this.selection.directoryCount == 0 && | 2937 this.selection.directoryCount == 0 && |
| 2935 this.selection.fileCount >= 1); | 2938 this.selection.fileCount >= 1); |
| 2936 } else if (this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE) { | 2939 } else if (this.dialogType_ == FileManager.DialogType.SELECT_SAVEAS_FILE) { |
| 2937 if (this.isOnReadonlyDirectory()) { | 2940 if (this.isOnReadonlyDirectory()) { |
| 2938 selectable = false; | 2941 selectable = false; |
| 2939 } else { | 2942 } else { |
| 2940 selectable = !!this.filenameInput_.value; | 2943 selectable = !!this.filenameInput_.value; |
| 2941 } | 2944 } |
| 2942 } else if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) { | 2945 } else if (this.dialogType_ == FileManager.DialogType.FULL_PAGE) { |
| 2943 // No "select" buttons on the full page UI. | 2946 // No "select" buttons on the full page UI. |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4130 this.defaultActionMenuItem_.taskId = taskItem.taskId; | 4133 this.defaultActionMenuItem_.taskId = taskItem.taskId; |
| 4131 } | 4134 } |
| 4132 | 4135 |
| 4133 var defaultActionSeparator = | 4136 var defaultActionSeparator = |
| 4134 this.dialogDom_.querySelector('#default-action-separator'); | 4137 this.dialogDom_.querySelector('#default-action-separator'); |
| 4135 | 4138 |
| 4136 this.defaultActionMenuItem_.hidden = !taskItem; | 4139 this.defaultActionMenuItem_.hidden = !taskItem; |
| 4137 defaultActionSeparator.hidden = !taskItem; | 4140 defaultActionSeparator.hidden = !taskItem; |
| 4138 } | 4141 } |
| 4139 })(); | 4142 })(); |
| OLD | NEW |