diff --git a/plugins/cloudstorage.koplugin/cloudstorage.lua b/plugins/cloudstorage.koplugin/cloudstorage.lua index 9cffe4477..36a2a5489 100644 --- a/plugins/cloudstorage.koplugin/cloudstorage.lua +++ b/plugins/cloudstorage.koplugin/cloudstorage.lua @@ -15,6 +15,7 @@ local UIManager = require("ui/uimanager") local ffiUtil = require("ffi/util") local filemanagerutil = require("apps/filemanager/filemanagerutil") local lfs = require("libs/libkoreader-lfs") +local sort = require("sort") local util = require("util") local _ = require("gettext") local N_ = _.ngettext @@ -28,6 +29,13 @@ local CloudStorage = BookList:extend{ return ffiUtil.strcoll(a.text, b.text) end, }, + natural = { + text = _("name (natural sorting)"), + sort_func = function(a, b) + local natsort = sort.natsort_cmp() + return natsort(a.text, b.text) + end, + }, type = { text = _("type"), sort_func = function(a, b) @@ -633,9 +641,11 @@ function CloudStorage:showPlusCloudDialog() text = T(_("Sort by: %1"), self.collates[self.collate].text), callback = function() UIManager:show(ButtonSelector:new{ + width_factor = 0.5, current_value = self.collate, values = { { self.collates["strcoll"].text, "strcoll" }, + { self.collates["natural"].text, "natural" }, { self.collates["type"].text, "type" }, { self.collates["size"].text, "size" }, { self.collates["date"].text, "date" },