Commit 73559a27 authored by serya@chromium.org's avatar serya@chromium.org

Moving checkboxes to a separate column.

In the File Manager list view icons are moved to the name column. Checkbox column made unsortable.

+bugfixes.

BUG=chromium-os:20156
TEST=None


Review URL: http://codereview.chromium.org/8585027

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110501 0039d316-1c4b-4281-b951-d872f2087c98
parent e0c849dc
...@@ -286,12 +286,17 @@ div.img-container > img { ...@@ -286,12 +286,17 @@ div.img-container > img {
-webkit-transform: translate(0, 0); -webkit-transform: translate(0, 0);
} }
.preview-panel[hidden] { .preview-panel[visibility=hiding] {
-webkit-transition: all 220ms ease; -webkit-transition: all 220ms ease;
-webkit-transform: translate(0, 5px); -webkit-transform: translate(0, 5px);
opacity: 0; opacity: 0;
} }
.preview-panel[visibility=hidden] {
display: none;
opacity: 0;
}
.preview-thumbnails { .preview-thumbnails {
display: -webkit-box; display: -webkit-box;
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
...@@ -398,7 +403,6 @@ li.thumbnail-item[selected] .file-checkbox { ...@@ -398,7 +403,6 @@ li.thumbnail-item[selected] .file-checkbox {
.detail-icon-container { .detail-icon-container {
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-webkit-box-flex: 1;
-webkit-box-pack: end; -webkit-box-pack: end;
display: -webkit-box; display: -webkit-box;
} }
...@@ -499,13 +503,6 @@ li.thumbnail-item[selected] .file-checkbox { ...@@ -499,13 +503,6 @@ li.thumbnail-item[selected] .file-checkbox {
-webkit-box-shadow: 5px 5px 0 #aaa; -webkit-box-shadow: 5px 5px 0 #aaa;
} }
.preview-metadata {
-webkit-box-orient: vertical;
-webkit-box-flex: 1;
display: -webkit-box;
color: #666;
}
.metadata-item { .metadata-item {
-webkit-box-orient: horizontal; -webkit-box-orient: horizontal;
-webkit-box-flex: 1; -webkit-box-flex: 1;
...@@ -579,25 +576,6 @@ li.thumbnail-item[selected] .file-checkbox { ...@@ -579,25 +576,6 @@ li.thumbnail-item[selected] .file-checkbox {
display: -webkit-box; display: -webkit-box;
} }
.preview-metadata {
text-align:center;
}
.preview-metadata-table tbody tr th {
text-align: right;
color: #666;
font-size: 12px;
font-weight: normal;
padding-left:10px;
}
.preview-metadata-table tbody tr td {
text-align: left;
color:#000;
font-size: 12px;
font-weight: normal;
}
/* Overlay pane covering the entire file manager window (e.g. image editor)*/ /* Overlay pane covering the entire file manager window (e.g. image editor)*/
.overlay-pane { .overlay-pane {
position: absolute; position: absolute;
......
...@@ -477,6 +477,18 @@ FileManager.prototype = { ...@@ -477,6 +477,18 @@ FileManager.prototype = {
metrics.startInterval('RequestLocalFileSystem'); metrics.startInterval('RequestLocalFileSystem');
var self = this; var self = this;
// The list of active mount points to distinct them from other directories.
chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) {
self.mountPoints_ = mountPoints;
onDone();
});
function onDone() {
if (self.mountPoints_ && self.rootEntries_)
self.init_();
}
chrome.fileBrowserPrivate.requestLocalFileSystem(function(filesystem) { chrome.fileBrowserPrivate.requestLocalFileSystem(function(filesystem) {
self.filesystem_ = filesystem; self.filesystem_ = filesystem;
util.installFileErrorToString(); util.installFileErrorToString();
...@@ -488,7 +500,7 @@ FileManager.prototype = { ...@@ -488,7 +500,7 @@ FileManager.prototype = {
function onAllRootsFound() { function onAllRootsFound() {
self.rootEntries_ = rootEntries; self.rootEntries_ = rootEntries;
self.init_(); onDone();
} }
function onPathError(path, err) { function onPathError(path, err) {
...@@ -520,8 +532,6 @@ FileManager.prototype = { ...@@ -520,8 +532,6 @@ FileManager.prototype = {
*/ */
FileManager.prototype.init_ = function() { FileManager.prototype.init_ = function() {
metrics.startInterval('InitFileManager'); metrics.startInterval('InitFileManager');
this.initFileList_();
this.initDialogs_();
// TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is // TODO(rginda): 6/22/11: Remove this test when createDateTimeFormat is
// available in all chrome trunk builds. // available in all chrome trunk builds.
...@@ -558,6 +568,9 @@ FileManager.prototype = { ...@@ -558,6 +568,9 @@ FileManager.prototype = {
(this.dialogType_ == FileManager.DialogType.FULL_PAGE || (this.dialogType_ == FileManager.DialogType.FULL_PAGE ||
this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE); this.dialogType_ == FileManager.DialogType.SELECT_OPEN_MULTI_FILE);
this.initFileList_();
this.initDialogs_();
// DirectoryEntry representing the current directory of the dialog. // DirectoryEntry representing the current directory of the dialog.
this.currentDirEntry_ = null; this.currentDirEntry_ = null;
...@@ -588,11 +601,6 @@ FileManager.prototype = { ...@@ -588,11 +601,6 @@ FileManager.prototype = {
// all paste tasks are complete. // all paste tasks are complete.
this.pasteSuccessCallbacks_ = []; this.pasteSuccessCallbacks_ = [];
// The list of active mount points to distinct them from other directories.
chrome.fileBrowserPrivate.getMountPoints(function(mountPoints) {
self.mountPoints_ = mountPoints;
});
this.initCommands_(); this.initCommands_();
this.setupCurrentDirectory_(); this.setupCurrentDirectory_();
...@@ -648,7 +656,6 @@ FileManager.prototype = { ...@@ -648,7 +656,6 @@ FileManager.prototype = {
this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel'); this.previewPanel_ = this.dialogDom_.querySelector('.preview-panel');
this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename'); this.previewFilename_ = this.dialogDom_.querySelector('.preview-filename');
this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary'); this.previewSummary_ = this.dialogDom_.querySelector('.preview-summary');
this.previewMetadata_ = this.dialogDom_.querySelector('.preview-metadata');
this.filenameInput_ = this.dialogDom_.querySelector('.filename-input'); this.filenameInput_ = this.dialogDom_.querySelector('.filename-input');
this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons'); this.taskButtons_ = this.dialogDom_.querySelector('.task-buttons');
this.okButton_ = this.dialogDom_.querySelector('.ok'); this.okButton_ = this.dialogDom_.querySelector('.ok');
...@@ -1133,13 +1140,9 @@ FileManager.prototype = { ...@@ -1133,13 +1140,9 @@ FileManager.prototype = {
* Initialize the file list table. * Initialize the file list table.
*/ */
FileManager.prototype.initTable_ = function() { FileManager.prototype.initTable_ = function() {
var checkWidth = this.showCheckboxes_ ? 5 : 0;
var columns = [ var columns = [
new cr.ui.table.TableColumn('cachedIconType_', '',
5.4 + checkWidth),
new cr.ui.table.TableColumn('name', str('NAME_COLUMN_LABEL'), new cr.ui.table.TableColumn('name', str('NAME_COLUMN_LABEL'),
64 - checkWidth), 64),
new cr.ui.table.TableColumn('cachedSize_', new cr.ui.table.TableColumn('cachedSize_',
str('SIZE_COLUMN_LABEL'), 15.5), str('SIZE_COLUMN_LABEL'), 15.5),
new cr.ui.table.TableColumn('type', new cr.ui.table.TableColumn('type',
...@@ -1148,11 +1151,15 @@ FileManager.prototype = { ...@@ -1148,11 +1151,15 @@ FileManager.prototype = {
str('DATE_COLUMN_LABEL'), 21) str('DATE_COLUMN_LABEL'), 21)
]; ];
columns[0].renderFunction = this.renderIconType_.bind(this); columns[0].renderFunction = this.renderName_.bind(this);
columns[1].renderFunction = this.renderName_.bind(this); columns[1].renderFunction = this.renderSize_.bind(this);
columns[2].renderFunction = this.renderSize_.bind(this); columns[2].renderFunction = this.renderType_.bind(this);
columns[3].renderFunction = this.renderType_.bind(this); columns[3].renderFunction = this.renderDate_.bind(this);
columns[4].renderFunction = this.renderDate_.bind(this);
if (this.showCheckboxes_) {
columns.unshift(new cr.ui.table.TableColumn('checkbox_', '', 3));
columns[0].renderFunction = this.renderCheckbox_.bind(this);
}
this.table_ = this.dialogDom_.querySelector('.detail-table'); this.table_ = this.dialogDom_.querySelector('.detail-table');
cr.ui.Table.decorate(this.table_); cr.ui.Table.decorate(this.table_);
...@@ -1635,9 +1642,6 @@ FileManager.prototype = { ...@@ -1635,9 +1642,6 @@ FileManager.prototype = {
var div = this.document_.createElement('div'); var div = this.document_.createElement('div');
div.className = 'detail-icon-container'; div.className = 'detail-icon-container';
if (this.showCheckboxes_)
div.appendChild(this.renderCheckbox_(entry));
var icon = this.document_.createElement('div'); var icon = this.document_.createElement('div');
icon.className = 'detail-icon'; icon.className = 'detail-icon';
this.getIconType(entry); this.getIconType(entry);
...@@ -1672,12 +1676,14 @@ FileManager.prototype = { ...@@ -1672,12 +1676,14 @@ FileManager.prototype = {
*/ */
FileManager.prototype.renderName_ = function(entry, columnId, table) { FileManager.prototype.renderName_ = function(entry, columnId, table) {
var label = this.document_.createElement('div'); var label = this.document_.createElement('div');
label.appendChild(this.renderIconType_(entry, columnId, table));
label.entry = entry; label.entry = entry;
label.className = 'detail-name filename-label'; label.className = 'detail-name filename-label';
if (this.currentDirEntry_.name == '') { if (this.currentDirEntry_.name == '') {
label.textContent = this.getLabelForRootPath_(entry.name); label.appendChild(this.document_.createTextNode(
this.getLabelForRootPath_(entry.name)));
} else { } else {
label.textContent = entry.name; label.appendChild(this.document_.createTextNode(entry.name));
} }
return label; return label;
...@@ -1877,32 +1883,49 @@ FileManager.prototype = { ...@@ -1877,32 +1883,49 @@ FileManager.prototype = {
}; };
FileManager.prototype.updatePreviewPanelVisibility_ = function() { FileManager.prototype.updatePreviewPanelVisibility_ = function() {
var wasHidden = this.previewPanel_.hasAttribute('hidden'); var panel = this.previewPanel_;
var hide = (this.selection.totalCount == 0); var state = panel.getAttribute('visibility');
var mustBeVisible = (this.selection.totalCount > 0);
var self = this;
if (hide == wasHidden) switch (state) {
return; case 'visible':
if (!mustBeVisible)
startHiding();
break;
if (this.hidingTimeout_) { case 'hiding':
// Hiding is not complete. display == block. if (mustBeVisible)
clearTimeout(this.hidingTimeout_); stopHidingAndShow();
this.hidingTimeout_ = 0; break;
} else if (wasHidden) {
// Hiding complete. display == none. case 'hidden':
this.previewPanel_.style.display = ''; if (mustBeVisible)
this.onResize_(); show();
} }
var self = this; function stopHidingAndShow() {
if (hide) { clearTimeout(self.hidingTimeout_);
this.previewPanel_.setAttribute('hidden', ''); self.hidingTimeout_ = 0;
this.hidingTimeout_ = setTimeout(function() { setVisibility('visible');
}
function startHiding() {
setVisibility('hiding');
self.hidingTimeout_ = setTimeout(function() {
self.hidingTimeout_ = 0; self.hidingTimeout_ = 0;
self.previewPanel_.style.display = 'none'; setVisibility('hidden');
self.onResize_(); self.onResize_();
}, 250); }, 250);
} else { }
this.previewPanel_.removeAttribute('hidden');
function show() {
setVisibility('visible');
self.onResize_();
}
function setVisibility(visibility) {
panel.setAttribute('visibility', visibility);
} }
}; };
...@@ -2329,39 +2352,6 @@ FileManager.prototype = { ...@@ -2329,39 +2352,6 @@ FileManager.prototype = {
} }
}; };
FileManager.prototype.setPreviewMetadata = function(metadata) {
this.previewMetadata_.textContent = '';
if (!(metadata && metadata.ifd))
return;
var self = this;
function addProperty(id, v) {
var dom = self.document_.createElement('div');
dom.className = 'metadata-item';
var label = self.document_.createElement('div');
label.className = 'metadata-label';
label.textContent = str(id) || id;
dom.appendChild(label);
var value = self.document_.createElement('div');
value.className = 'metadata-value';
value.textContent = v;
dom.appendChild(value);
self.previewMetadata_.appendChild(dom);
}
// TODO(rginda): Split this function into metadata specific routines when
// we add new metadata types.
// TODO(rginda): Add const names for these numerics.
var exifDir = metadata.ifd.exif;
if (0xa002 in exifDir && 0xa003 in exifDir) {
addProperty('DIMENSIONS_LABEL',
strf('DIMENSIONS_FORMAT', exifDir[0xa002].value,
exifDir[0xa003].value));
}
};
FileManager.prototype.getThumbnailURL = function(entry, callback) { FileManager.prototype.getThumbnailURL = function(entry, callback) {
if (!entry) if (!entry)
return; return;
...@@ -3201,7 +3191,7 @@ FileManager.prototype = { ...@@ -3201,7 +3191,7 @@ FileManager.prototype = {
*/ */
FileManager.prototype.allowRenameClick_ = function(event, row) { FileManager.prototype.allowRenameClick_ = function(event, row) {
if (this.dialogType_ != FileManager.DialogType.FULL_PAGE || if (this.dialogType_ != FileManager.DialogType.FULL_PAGE ||
this.currentDirEntry_.name == '' || this.currentDirEntry_ == null || this.currentDirEntry_.name == '' ||
isSystemDirEntry(this.currentDirEntry_)) { isSystemDirEntry(this.currentDirEntry_)) {
// Renaming only enabled for full-page mode, outside of the root // Renaming only enabled for full-page mode, outside of the root
// directory. // directory.
......
...@@ -13,7 +13,8 @@ function MetadataProvider(opt_workerPath) { ...@@ -13,7 +13,8 @@ function MetadataProvider(opt_workerPath) {
if (!opt_workerPath) { if (!opt_workerPath) {
var path = document.location.pathname; var path = document.location.pathname;
opt_workerPath = path.substring(0, path.lastIndexOf('/') + 1) + opt_workerPath = document.location.origin +
path.substring(0, path.lastIndexOf('/') + 1) +
'js/metadata_dispatcher.js'; 'js/metadata_dispatcher.js';
} }
......
...@@ -6,9 +6,6 @@ ...@@ -6,9 +6,6 @@
--> -->
<html> <html>
<head> <head>
<!-- metrics.js initiates load performance tracking
so we want to parse it as early as possible -->
<script src="js/metrics.js"></script>
<if expr="0"> <if expr="0">
<!-- <if ... /if> is removed while flattening HTML. --> <!-- <if ... /if> is removed while flattening HTML. -->
<script> <script>
...@@ -22,11 +19,11 @@ ...@@ -22,11 +19,11 @@
// 2. Build and run the Chromium OS. // 2. Build and run the Chromium OS.
// //
// 3. Make source files available via the HTTP protocol: // 3. Make source files available via the HTTP protocol:
// twistd web --path chrome/browser/resources/file_manager --port 1080 // twistd web --path chrome/browser/resources/ --port 1080
// //
// 4. Open the File Manager. Execute the following JS code in its context // 4. Open the File Manager. Execute the following JS code in its context
// using DevTools: // using DevTools:
// localStorage['base'] = 'http://youmachine:1080/' // localStorage['base'] = 'http://youmachine:1080/file_manager/'
// //
// This will make the File Manager use fresh JS and CSS files from the // This will make the File Manager use fresh JS and CSS files from the
// development machine. HTML files and JS files for WebWorkers would still // development machine. HTML files and JS files for WebWorkers would still
...@@ -39,6 +36,9 @@ ...@@ -39,6 +36,9 @@
} }
</script> </script>
</if> </if>
<!-- metrics.js initiates load performance tracking
so we want to parse it as early as possible -->
<script src="js/metrics.js"></script>
<script> <script>
(function() { (function() {
// Switch to 'test harness' mode when loading from a file or http url. // Switch to 'test harness' mode when loading from a file or http url.
...@@ -153,7 +153,7 @@ ...@@ -153,7 +153,7 @@
<div></div> <div></div>
</div> </div>
</div> </div>
<div class=preview-panel hidden> <div class=preview-panel visibility=hidden>
<div><div class=preview-thumbnails></div></div> <div><div class=preview-thumbnails></div></div>
<div><div class=preview-summary></div></div> <div><div class=preview-summary></div></div>
<div class=task-buttons></div> <div class=task-buttons></div>
......
...@@ -72,6 +72,10 @@ cr.define('cr.ui', function() { ...@@ -72,6 +72,10 @@ cr.define('cr.ui', function() {
this.compareFunctions_[field] = compareFunction; this.compareFunctions_[field] = compareFunction;
}, },
isSortable: function(field) {
return this.compareFunctions_ && field in this.compareFunctions_;
},
/** /**
* Returns current sort status. * Returns current sort status.
* @return {!Object} Current sort status. * @return {!Object} Current sort status.
......
...@@ -80,7 +80,9 @@ cr.define('cr.ui.table', function() { ...@@ -80,7 +80,9 @@ cr.define('cr.ui.table', function() {
var cell = this.ownerDocument.createElement('div'); var cell = this.ownerDocument.createElement('div');
cell.style.width = cm.getWidth(i) + '%'; cell.style.width = cm.getWidth(i) + '%';
cell.className = 'table-header-cell'; cell.className = 'table-header-cell';
cell.addEventListener('click', this.createSortFunction_(i).bind(this)); if (dm.isSortable(cm.getId(i)))
cell.addEventListener('click',
this.createSortFunction_(i).bind(this));
cell.appendChild(this.createHeaderLabel_(i)); cell.appendChild(this.createHeaderLabel_(i));
this.headerInner_.appendChild(cell); this.headerInner_.appendChild(cell);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment