Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: chrome/browser/resources/file_manager/js/file_manager.js

Issue 9349015: [filebrowser] Save sorting field/order for modal dialogs, show spinner when scanning directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Spinner itself Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/file_manager/js/file_manager.js
===================================================================
--- chrome/browser/resources/file_manager/js/file_manager.js (revision 120559)
+++ chrome/browser/resources/file_manager/js/file_manager.js (working copy)
@@ -496,6 +496,10 @@
this.directoryModel_.addEventListener('directory-changed',
this.onDirectoryChanged_.bind(this));
+ this.directoryModel_.addEventListener('scan-started',
+ this.showSpinner_.bind(this, true));
+ this.directoryModel_.addEventListener('scan-completed',
+ this.showSpinner_.bind(this, false));
this.addEventListener('selection-summarized',
this.onSelectionSummarized_.bind(this));
@@ -519,7 +523,17 @@
this.summarizeSelection_();
- this.directoryModel_.fileList.sort('cachedMtime_', 'desc');
+ var sortField = 'cachedMtime_';
+ var sortDirection = 'desc';
+ if (FileManager.DialogType.isModal(this.dialogType_)) {
+ sortField =
+ window.localStorage['sort-field-' + this.dialogType_] ||
+ sortField;
+ sortDirection =
+ window.localStorage['sort-direction-' + this.dialogType_] ||
+ sortDirection;
+ }
+ this.directoryModel_.fileList.sort(sortField, sortDirection);
this.refocus();
@@ -580,6 +594,8 @@
this.deleteButton_ = this.dialogDom_.querySelector('.delete-button');
this.table_ = this.dialogDom_.querySelector('.detail-table');
this.grid_ = this.dialogDom_.querySelector('.thumbnail-grid');
+ this.spinner_ = this.dialogDom_.querySelector('.spinner');
+ this.showSpinner_(false);
cr.ui.Table.decorate(this.table_);
cr.ui.Grid.decorate(this.grid_);
@@ -673,6 +689,8 @@
dataModel.addEventListener('splice',
this.onDataModelSplice_.bind(this));
+ dataModel.addEventListener('permuted',
+ this.onDataModelPermuted_.bind(this));
this.directoryModel_.fileListSelection.addEventListener(
'change', this.onSelectionChanged_.bind(this));
@@ -797,6 +815,15 @@
this.updateSelectAllCheckboxState_(checkbox);
};
+ FileManager.prototype.onDataModelPermuted_ = function(event) {
+ if (FileManager.DialogType.isModal(this.dialogType_)) {
+ var sortStatus = this.directoryModel_.fileList.sortStatus;
+ window.localStorage['sort-field-' + this.dialogType_] = sortStatus.field;
+ window.localStorage['sort-direction-' + this.dialogType_] =
+ sortStatus.direction;
+ }
+ };
+
/**
* Get the file type of the entry, caching the result.
*
@@ -3137,6 +3164,10 @@
setTimeout(this.onResize_.bind(this), 300);
};
+ FileManager.prototype.showSpinner_ = function(on) {
+ this.spinner_.style.display = on ? '' : 'none';
+ };
+
FileManager.prototype.onNewFolderCommand_ = function(event) {
var self = this;
« no previous file with comments | « chrome/browser/resources/file_manager/js/directory_model.js ('k') | chrome/browser/resources/file_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698