added option to hide dod files in the fs browser...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2019-01-05 19:47:26 +03:00
parent 62a9b43fe5
commit f7cc2ba306
3 changed files with 81 additions and 38 deletions

View File

@ -78,14 +78,21 @@ function(attr, states, a, b){
: states instanceof Function ? states.call(this)
: states
// get attr path...
var a = attr.split(/\./g)
var cfg = a.slice(0, -1)
.reduce(function(res, cur){
return res[cur] }, this.config)
if(action == null){
var cfg = this.config[attr]
return cfg == null ?
var val = cfg[a.pop()]
return val == null ?
(lst[lst.indexOf('none')] || lst[0])
: cfg
: val
} else {
this.config[attr] = action
cfg[a[a.length-1]] = action
this.config[a[0]] = this.config[a[0]]
}
},
states, pre, post)

View File

@ -874,6 +874,9 @@ var FileSystemLoaderUIActions = actions.Actions({
showNonTraversable: true,
showDisabled: true,
disableDotFiles: 'on',
//disableHiddenFiles: false,
//actionButton: '&ctdot;', // "..."
//actionButton: '&#11168;', // down then left arrow (long)
//actionButton: '&#9657;', // right-pointing white triangle
@ -896,6 +899,8 @@ var FileSystemLoaderUIActions = actions.Actions({
var cfg = Object.create(this.config['file-browser-settings'])
cfg.cls = 'file-browser'
// normalize...
cfg.disableDotFiles = cfg.disableDotFiles == 'on'
base = base || this.location.path || '/'
base = util.normalizePath(base)
@ -936,12 +941,15 @@ var FileSystemLoaderUIActions = actions.Actions({
})
// we closed the browser -- save settings to .config...
.on('close', function(){
var config = that.config['file-browser-settings']
var config =
that.config['file-browser-settings'] =
that.config['file-browser-settings'] || {}
config.disableFiles = o.options.disableFiles
config.showDisabled = o.options.showDisabled
config.showNonTraversable = o.options.showNonTraversable
// normalize...
config.disableDotFiles = o.options.disableDotFiles ? 'on' : 'off'
})
return o
@ -1005,6 +1013,11 @@ var FileSystemLoaderUIActions = actions.Actions({
return o
})],
toggleDotFileDrawing: ['Interface/File browser/Hide dot files',
core.makeConfigToggler(
'file-browser-settings.disableDotFiles',
['on', 'off'])],
})

View File

@ -196,16 +196,20 @@ function(path, make){
}
var dir = res.isDirectory()
var elem = res && make(fullpath
? path +'/'+ file
: file + (dir ? '/' : ''),
null,
that.options.disableFiles && !dir)
var elem = res
&& !(that.options.disableDotFiles
&& file.startsWith('.'))
&& make(fullpath
? path +'/'+ file
: file + (dir ? '/' : ''),
null,
that.options.disableFiles
&& !dir)
// count the number of files...
// NOTE: we do not care how long it will take
// so we'll not wait...
res && dir && _countDirFiles(path, file, elem)
res && dir && elem && _countDirFiles(path, file, elem)
})
// NOTE: we are not using promise.all(..) here because it
// triggers BEFORE the first make(..) is called...
@ -285,41 +289,60 @@ var listDir = module.listDir = listDirfs
// XXX for some reason pop does not focus the container dir correctly...
// ...this is potentially due to the list not being ready yet...
// XXX this should be smarter and support other URL schemes...
var WalkPrototype = Object.create(browse.Browser.prototype)
WalkPrototype.options = {
// XXX this should be smarter and support other URL schemes...
pathPrefix: os.type() == 'Windows_NT' ? '' : '/',
var WalkPrototype = {
__proto__: browse.Browser.prototype,
fullPathEdit: true,
traversable: true,
flat: false,
options: {
__proto__: browse.Browser.prototype.options,
sortTraversable: 'first',
// XXX this should be smarter and support other URL schemes...
pathPrefix: os.type() == 'Windows_NT' ? '' : '/',
//actionButton: '&ctdot;', // "..."
//actionButton: '&odot;', // circle with dot
actionButton: '&#11168;', // down then left arrow (long)
//actionButton: '&#9657;', // right-pointing white triangle
//actionButton: '&#9721;', // ne white triangle
//actionButton: '&#8599;', // ne arrow
//actionButton: '&#11171;', // up then right arrow
//actionButton: '&#187;', // right-pointing double angle
// quotation mark
// XXX not sure about this...
//actionButton: '&#128194;', // folder icon (color)
fullPathEdit: true,
traversable: true,
flat: false,
pushButton: false,
sortTraversable: 'first',
list: listDir,
//actionButton: '&ctdot;', // "..."
//actionButton: '&odot;', // circle with dot
actionButton: '&#11168;', // down then left arrow (long)
//actionButton: '&#9657;', // right-pointing white triangle
//actionButton: '&#9721;', // ne white triangle
//actionButton: '&#8599;', // ne arrow
//actionButton: '&#11171;', // up then right arrow
//actionButton: '&#187;', // right-pointing double angle
// quotation mark
// XXX not sure about this...
//actionButton: '&#128194;', // folder icon (color)
fileCountPattern: '*',
pushButton: false,
disableFiles: false,
list: listDir,
// enable '.' and '..' dirs...
dotDirs: true,
fileCountPattern: '*',
disableFiles: false,
disableDotFiles: true,
//disableHiddenFiles: false,
// enable '.' and '..' dirs...
dotDirs: true,
},
toggleDotFileDrawing: function(){
var cur = this.selected
if(this.options.toggleDisabledDrawing == false){
return this
}
this.options.disableDotFiles = !this.options.disableDotFiles
this.update()
cur && this.select(cur)
return this
},
}
WalkPrototype.options.__proto__ = browse.Browser.prototype.options
var Walk =