Folder shortcuts: standard folders (#15323)
This commit is contained in:
1 parent
e083b09aad
commit
76330cae5d
11 files changed
+507
-97
No files matched your search
@@ -574,6 +574,7 @@ function CloudStorage:showFileDownloadDialog(item)
|
||||
select_file = false,
|
||||
path = download_dir,
|
||||
onConfirm = function(path)
|
||||
self._manager.ui.folder_shortcuts:updateShortcut("cloudstorage", path)
|
||||
self.settings:saveSetting("download_dir", path)
|
||||
self._manager.updated = true
|
||||
download_dir = path
|
||||
|
||||
@@ -24,6 +24,18 @@ function Cloud:init()
|
||||
self:getProviders()
|
||||
self:onDispatcherRegisterActions() -- will call loadSettings()
|
||||
self.ui.menu:registerToMainMenu(self)
|
||||
self.ui.folder_shortcuts.registerShortcut({
|
||||
provider = Cloud.name,
|
||||
name = _("Cloud storage download folder"),
|
||||
get = function()
|
||||
self:loadSettings()
|
||||
return self.settings:readSetting("download_dir") or G_reader_settings:readSetting("lastdir")
|
||||
end,
|
||||
set = function(path)
|
||||
self.settings:saveSetting("download_dir", path)
|
||||
self.updated = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function Cloud:getProviders()
|
||||
|
||||
@@ -121,6 +121,16 @@ function Exporter:init()
|
||||
self.targets = genExportersTable(self.path)
|
||||
self.ui.menu:registerToMainMenu(self)
|
||||
self:onDispatcherRegisterActions()
|
||||
self.ui.folder_shortcuts.registerShortcut({
|
||||
provider = Exporter.name,
|
||||
name = _("Export highlights folder"),
|
||||
get = function()
|
||||
return self.settings.clipping_dir or self.default_clipping_dir
|
||||
end,
|
||||
set = function(path)
|
||||
self.settings.clipping_dir = path
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function Exporter:onDispatcherRegisterActions()
|
||||
@@ -484,7 +494,10 @@ function Exporter:chooseFolder()
|
||||
local current_path = self.settings.clipping_dir
|
||||
local default_path = self.default_clipping_dir
|
||||
local caller_callback = function(path)
|
||||
self.settings.clipping_dir = path
|
||||
if current_path ~= path then
|
||||
self.ui.folder_shortcuts:updateShortcut(Exporter.name, path)
|
||||
self.settings.clipping_dir = path
|
||||
end
|
||||
end
|
||||
filemanagerutil.showChooseDialog(title_header, caller_callback, current_path, default_path)
|
||||
end
|
||||
|
||||
@@ -24,6 +24,18 @@ local MoveToArchive = WidgetContainer:extend{
|
||||
function MoveToArchive:init()
|
||||
self:onDispatcherRegisterActions()
|
||||
self.ui.menu:registerToMainMenu(self)
|
||||
self.ui.folder_shortcuts.registerShortcut({
|
||||
provider = MoveToArchive.name,
|
||||
name = _("Move to archive folder"),
|
||||
get = function()
|
||||
self:loadSettings()
|
||||
return self.data.archive_dir_path
|
||||
end,
|
||||
set = function(path)
|
||||
self.data.archive_dir_path = path
|
||||
self.updated = true
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
function MoveToArchive:loadSettings()
|
||||
@@ -92,12 +104,17 @@ function MoveToArchive:getSubMenuItems()
|
||||
end,
|
||||
keep_menu_open = true,
|
||||
callback = function(touchmenu_instance)
|
||||
local curr_path = self.data.archive_dir_path
|
||||
local caller_callback = function(path)
|
||||
self.data.archive_dir_path = path .. "/"
|
||||
self.updated = true
|
||||
touchmenu_instance:updateItems()
|
||||
path = path .. "/" -- trailing slash on purpose
|
||||
if curr_path ~= path then
|
||||
self.ui.folder_shortcuts:updateShortcut(MoveToArchive.name, path)
|
||||
self.data.archive_dir_path = path
|
||||
self.updated = true
|
||||
touchmenu_instance:updateItems()
|
||||
end
|
||||
end
|
||||
filemanagerutil.showChooseDialog(_("Archive folder:"), caller_callback, self.data.archive_dir_path)
|
||||
filemanagerutil.showChooseDialog(_("Archive folder:"), caller_callback, curr_path)
|
||||
end,
|
||||
},
|
||||
}
|
||||
@@ -114,7 +131,7 @@ function MoveToArchive:onMoveToArchive(do_copy)
|
||||
local document_full_path = self.document.file
|
||||
local last_copied_from_dir, filename = util.splitFilePathName(document_full_path)
|
||||
if self.data.last_copied_from_dir ~= last_copied_from_dir then
|
||||
self.data.last_copied_from_dir = last_copied_from_dir
|
||||
self.data.last_copied_from_dir = last_copied_from_dir -- trailing slash on purpose
|
||||
self.updated = true
|
||||
end
|
||||
local dest_file = string.format("%s%s", archive_dir_path, filename)
|
||||
|
||||
@@ -900,6 +900,7 @@ function OPDSBrowser:showDownloads(item)
|
||||
require("ui/downloadmgr"):new{
|
||||
onConfirm = function(path)
|
||||
logger.dbg("Download folder set to", path)
|
||||
self._manager.ui.folder_shortcuts:updateShortcut("download_dir", path)
|
||||
G_reader_settings:saveSetting("download_dir", path)
|
||||
self.download_dialog:setTitle(createTitle(path, filename))
|
||||
end,
|
||||
|
||||
Reference in new issue
Block a user