mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -524,14 +524,14 @@ function CloudStorage:synchronizeSettings(item)
|
||||
text = _("Choose Dropbox folder"),
|
||||
callback = function()
|
||||
UIManager:close(syn_dialog)
|
||||
require("ui/cloudmgr"):new{
|
||||
require("ui/downloadmgr"):new{
|
||||
item = item,
|
||||
onConfirm = function(path)
|
||||
self:updateSyncFolder(item, path)
|
||||
item.sync_source_folder = path
|
||||
self:synchronizeSettings(item)
|
||||
end,
|
||||
}:chooseDir()
|
||||
}:chooseCloudDir()
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local BD = require("ui/bidi")
|
||||
local CenterContainer = require("ui/widget/container/centercontainer")
|
||||
local CloudStorage = require("apps/cloudstorage/cloudstorage")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
local Device = require("device")
|
||||
local Event = require("ui/event")
|
||||
@@ -713,7 +712,7 @@ To:
|
||||
self.menu_items.cloud_storage = {
|
||||
text = _("Cloud storage"),
|
||||
callback = function()
|
||||
local cloud_storage = CloudStorage:new{}
|
||||
local cloud_storage = require("apps/cloudstorage/cloudstorage"):new{}
|
||||
UIManager:show(cloud_storage)
|
||||
local filemanagerRefresh = function() self.ui:onRefresh() end
|
||||
function cloud_storage:onClose()
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
local CloudStorage = require("apps/cloudstorage/cloudstorage")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local _ = require("gettext")
|
||||
|
||||
local CloudMgr = {
|
||||
onConfirm = function() end,
|
||||
}
|
||||
|
||||
function CloudMgr:new(from_o)
|
||||
local o = from_o or {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
--- Displays a PathChooser for cloud drive for picking a (source) directory.
|
||||
-- @treturn string path chosen by the user
|
||||
function CloudMgr:chooseDir()
|
||||
local cloud_storage = CloudStorage:new{
|
||||
title = _("Long-press to choose a folder"),
|
||||
item = self.item,
|
||||
onConfirm = function(dir_path)
|
||||
self.onConfirm(dir_path)
|
||||
end,
|
||||
}
|
||||
UIManager:show(cloud_storage)
|
||||
end
|
||||
|
||||
return CloudMgr
|
||||
@@ -20,12 +20,10 @@ Example:
|
||||
|
||||
local PathChooser = require("ui/widget/pathchooser")
|
||||
local UIManager = require("ui/uimanager")
|
||||
local Screen = require("device").screen
|
||||
local util = require("ffi/util")
|
||||
local _ = require("gettext")
|
||||
|
||||
local DownloadMgr = {
|
||||
-- title = _("Long press to choose download directory"),
|
||||
onConfirm = function() end,
|
||||
}
|
||||
|
||||
@@ -40,19 +38,16 @@ end
|
||||
-- @treturn string path chosen by the user
|
||||
function DownloadMgr:chooseDir(dir)
|
||||
local path
|
||||
if not dir then
|
||||
if dir then
|
||||
path = dir
|
||||
else
|
||||
local lastdir = G_reader_settings:readSetting("lastdir")
|
||||
local download_dir = G_reader_settings:readSetting("download_dir")
|
||||
path = download_dir and util.realpath(download_dir .. "/..") or lastdir
|
||||
else
|
||||
path = dir
|
||||
end
|
||||
local path_chooser = PathChooser:new{
|
||||
title = self.title or true, -- use default title if none provided
|
||||
select_directory = true,
|
||||
select_file = false,
|
||||
show_files = false,
|
||||
height = Screen:getHeight(),
|
||||
path = path,
|
||||
onConfirm = function(dir_path)
|
||||
self.onConfirm(dir_path)
|
||||
@@ -61,4 +56,14 @@ function DownloadMgr:chooseDir(dir)
|
||||
UIManager:show(path_chooser)
|
||||
end
|
||||
|
||||
function DownloadMgr:chooseCloudDir()
|
||||
local cloud_storage = require("apps/cloudstorage/cloudstorage"):new{
|
||||
item = self.item,
|
||||
onConfirm = function(dir_path)
|
||||
self.onConfirm(dir_path)
|
||||
end,
|
||||
}
|
||||
UIManager:show(cloud_storage)
|
||||
end
|
||||
|
||||
return DownloadMgr
|
||||
|
||||
Reference in New Issue
Block a user