diff --git a/frontend/ui/widget/pathchooser.lua b/frontend/ui/widget/pathchooser.lua index c6bedfa9b..12f673a4e 100644 --- a/frontend/ui/widget/pathchooser.lua +++ b/frontend/ui/widget/pathchooser.lua @@ -1,20 +1,19 @@ local BD = require("ui/bidi") local ButtonDialog = require("ui/widget/buttondialog") local Device = require("device") -local Event = require("ui/event") local FileChooser = require("ui/widget/filechooser") local UIManager = require("ui/uimanager") local ffiutil = require("ffi/util") local lfs = require("libs/libkoreader-lfs") local util = require("util") local _ = require("gettext") +local N_ = _.ngettext local T = ffiutil.template local PathChooser = FileChooser:extend{ title = true, -- or a string -- if let to true, a generic title will be set in init() no_title = false, - show_path = true, is_popout = false, covers_fullscreen = true, -- set it to false if you set is_popout = true is_borderless = true, @@ -114,18 +113,17 @@ function PathChooser:onMenuHold(item) end local title if attr.mode == "file" then + title = _("Choose this file?") .. "\n\n" .. BD.filepath(path) .. "\n" if self.detailed_file_info then local filesize = util.getFormattedSize(attr.size) local lastmod = os.date("%Y-%m-%d %H:%M", attr.modification) - title = T(_("Choose this file?\n\n%1\n\nFile size: %2 bytes\nLast modified: %3"), - BD.filepath(path), filesize, lastmod) - else - title = T(_("Choose this file?\n\n%1"), BD.filepath(path)) + title = title .. "\n" .. T(N_("File size: 1 byte", "File size: %1 bytes", attr.size), filesize) .. + "\n" .. T(_("Last modified: %1"), lastmod) .. "\n" end elseif attr.mode == "directory" then - title = T(_("Choose this folder?\n\n%1"), BD.dirpath(path)) + title = _("Choose this folder?") .. "\n\n" .. BD.dirpath(path) .. "\n" else -- just in case we get something else - title = T(_("Choose this path?\n\n%1"), BD.path(path)) + title = _("Choose this path?") .. "\n\n" .. BD.path(path) .. "\n" end local onConfirm = self.onConfirm self.button_dialog = ButtonDialog:new{ @@ -164,8 +162,11 @@ function PathChooser:showPlusMenu() text = _("Folder shortcuts"), callback = function() UIManager:close(button_dialog) - UIManager:broadcastEvent(Event:new("ShowFolderShortcutsDialog", - function(path) self:changeToPath(path) end)) + local FileManagerShortcuts = require("apps/filemanager/filemanagershortcuts") + local select_callback = function(path) + self:changeToPath(path) + end + FileManagerShortcuts:onShowFolderShortcutsDialog(select_callback) end, }, },