mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[feat] CloudStorage/WebDAV: show 'file size' property in WebDAV (#13371)
This commit is contained in:
@@ -19,6 +19,7 @@ local logger = require("logger")
|
||||
local _ = require("gettext")
|
||||
local N_ = _.ngettext
|
||||
local T = require("ffi/util").template
|
||||
local util = require("util")
|
||||
|
||||
local CloudStorage = Menu:extend{
|
||||
no_title = false,
|
||||
@@ -227,15 +228,18 @@ function CloudStorage:downloadFile(item)
|
||||
})
|
||||
end
|
||||
|
||||
local function createTitle(filename_orig, filename, path) -- title for ButtonDialog
|
||||
return T(_("Filename:\n%1\n\nDownload filename:\n%2\n\nDownload folder:\n%3"),
|
||||
filename_orig, filename, BD.dirpath(path))
|
||||
local function createTitle(filename_orig, filesize, filename, path) -- title for ButtonDialog
|
||||
local filesize_str = filesize and util.getFriendlySize(filesize) or _("N/A")
|
||||
|
||||
return T(_("Filename:\n%1\n\nFile size:\n%2\n\nDownload filename:\n%3\n\nDownload folder:\n%4"),
|
||||
filename_orig, filesize_str, filename, BD.dirpath(path))
|
||||
end
|
||||
|
||||
local cs_settings = self:readSettings()
|
||||
local download_dir = cs_settings:readSetting("download_dir") or G_reader_settings:readSetting("lastdir")
|
||||
local filename_orig = item.text
|
||||
local filename = filename_orig
|
||||
local filesize = item.filesize
|
||||
|
||||
local buttons = {
|
||||
{
|
||||
@@ -247,7 +251,7 @@ function CloudStorage:downloadFile(item)
|
||||
self.cs_settings:saveSetting("download_dir", path)
|
||||
self.cs_settings:flush()
|
||||
download_dir = path
|
||||
self.download_dialog:setTitle(createTitle(filename_orig, filename, download_dir))
|
||||
self.download_dialog:setTitle(createTitle(filename_orig, filesize, filename, download_dir))
|
||||
end,
|
||||
}:chooseDir(download_dir)
|
||||
end,
|
||||
@@ -278,7 +282,7 @@ function CloudStorage:downloadFile(item)
|
||||
filename = filename_orig
|
||||
end
|
||||
UIManager:close(input_dialog)
|
||||
self.download_dialog:setTitle(createTitle(filename_orig, filename, download_dir))
|
||||
self.download_dialog:setTitle(createTitle(filename_orig, filesize, filename, download_dir))
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -318,7 +322,7 @@ function CloudStorage:downloadFile(item)
|
||||
}
|
||||
|
||||
self.download_dialog = ButtonDialog:new{
|
||||
title = createTitle(filename_orig, filename, download_dir),
|
||||
title = createTitle(filename_orig, filesize, filename, download_dir),
|
||||
buttons = buttons,
|
||||
}
|
||||
UIManager:show(self.download_dialog)
|
||||
@@ -388,7 +392,6 @@ function CloudStorage:onMenuHold(item)
|
||||
callback = function()
|
||||
UIManager:close(cs_server_dialog)
|
||||
self:editCloudServer(item)
|
||||
|
||||
end
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user