From e7f4af10654e24580c767db897bf2a1db2465534 Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Fri, 5 May 2017 16:04:50 +0200 Subject: [PATCH] DevDocs: ui.downloadmgr --- frontend/ui/downloadmgr.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/frontend/ui/downloadmgr.lua b/frontend/ui/downloadmgr.lua index 685053299..1a6c8945a 100644 --- a/frontend/ui/downloadmgr.lua +++ b/frontend/ui/downloadmgr.lua @@ -1,3 +1,22 @@ +--[[-- +This module displays a PathChooser widget to choose a download directory. + +It can be used as a callback on a button or menu item. + +Example: + callback = function() + require("ui/downloadmgr"):new{ + title = _("Choose download directory"), + onConfirm = function(path) + logger.dbg("set download directory to", path) + G_reader_settings:saveSetting("download_dir", path) + UIManager:nextTick(function() + -- reinitialize dialog + end) + end, + }:chooseDir() +]] + local PathChooser = require("ui/widget/pathchooser") local UIManager = require("ui/uimanager") local Screen = require("device").screen @@ -16,6 +35,8 @@ function DownloadMgr:new(from_o) return o end +--- Displays a PathChooser widget for picking a (download) directory. +-- @treturn string path chosen by the user function DownloadMgr:chooseDir() local lastdir = G_reader_settings:readSetting("lastdir") local download_dir = G_reader_settings:readSetting("download_dir")