diff --git a/apps/fileman/ChangeLog b/apps/fileman/ChangeLog index cc1456b311..ad2f4c4fe6 100644 --- a/apps/fileman/ChangeLog +++ b/apps/fileman/ChangeLog @@ -1,4 +1,5 @@ 0.01: New app! 0.02: Improve handling of large amounts of files (fix #579) 0.03: Update RegExp use (Was using backreference instead of character code) +0.04: Add submenu to display free space and to allow quick navigation with many files diff --git a/apps/fileman/fileman.app.js b/apps/fileman/fileman.app.js index 5baae298be..bb0f00e40e 100644 --- a/apps/fileman/fileman.app.js +++ b/apps/fileman/fileman.app.js @@ -15,7 +15,7 @@ function delete_file(fn) { } else STOR.erase(fn); } - }).then(function() { filed=[];files=get_pruned_file_list(); }).then(drawMenu); + }).then(function() { files=get_pruned_file_list(); }).then(drawMenu); } function get_length(fn) { @@ -65,6 +65,30 @@ function visit_file(fn) { E.showMenu(menu); } +function showFree() { + var free = (require("Storage").getFree() / (1024*1024)).toFixed(2) + " MB\n"; + E.showAlert(free).then( function() { drawMenu(); } ); +} + +function jumpTo(v) { + nstart = Math.round((v/100)*files.length); + if (nstart >= files.length) { nstart = 0; } + drawMenu(); +} + +function drawUtilMenu() { + var menu = { + '' : {'title' : "Utils"} + }; + menu['Show free'] = showFree; + for (let i=0; i<10; i++) { + let v = i*10; + menu['Jump to '+v+'%'] = function() { jumpTo(v); }; + } + menu['< Back'] = drawMenu; + E.showMenu(menu); +} + function drawMenu() { nend = (nstart+n0 ? files.length-n : 0; menu = {}; drawMenu(); - } - for (var i=nstart; i next"] = function() { if (nstart+n