1
0
mirror of https://codeberg.org/cage/tinmop/ synced 2025-02-26 09:27:36 +01:00

- [kamid] instructed program to download the element if the url's path points to a file.

This commit is contained in:
cage 2022-01-23 14:21:12 +01:00
parent 1cf9be1863
commit 7f6e079b51

View File

@ -2429,10 +2429,17 @@ printed, on the main window."
(tui:with-notify-errors (tui:with-notify-errors
(let ((handlers (kami:iri->filesystem-window-handlers url))) (let ((handlers (kami:iri->filesystem-window-handlers url)))
(if handlers (if handlers
(progn (let* ((path (uri:path (iri:iri-parse url)))
(filesystem-tree-window:init (uri:path (iri:iri-parse url)) (path-to-dir-p (fs:path-referencing-dir-p path))
handlers) (init-path (if path-to-dir-p
(focus-to-filesystem-explorer-window)) path
(fs:parent-dir-path path))))
(filesystem-tree-window:init init-path handlers)
(if path-to-dir-p
(focus-to-filesystem-explorer-window)
(progn
(%file-explorer-download-path path)
(file-explorer-close-path))))
(error-message (format nil (error-message (format nil
(_ "~s is not a valid kami address") (_ "~s is not a valid kami address")
url)))))))) url))))))))
@ -2481,11 +2488,9 @@ printed, on the main window."
:prompt :prompt
(format nil (_ "Rename ~a to: ") path))))) (format nil (_ "Rename ~a to: ") path)))))
(defun file-explorer-download-path () (defun %file-explorer-download-path (path)
"Download a file" "Download a file"
(when-let* ((win *filesystem-explorer-window*) (when-let* ((win *filesystem-explorer-window*)
(fields (line-oriented-window:selected-row-fields win))
(path (fstree:tree-path fields))
(output-file (fs:temporary-file))) (output-file (fs:temporary-file)))
(flet ((on-input-complete (destination-file) (flet ((on-input-complete (destination-file)
(when (string-not-empty-p destination-file) (when (string-not-empty-p destination-file)
@ -2499,6 +2504,13 @@ printed, on the main window."
:prompt (format nil (_ "Download ~a to: ") path) :prompt (format nil (_ "Download ~a to: ") path)
:initial-value output-file)))) :initial-value output-file))))
(defun file-explorer-download-path ()
"Download a file"
(when-let* ((win *filesystem-explorer-window*)
(fields (line-oriented-window:selected-row-fields win))
(path (fstree:tree-path fields)))
(%file-explorer-download-path path)))
(defun file-explorer-upload-path () (defun file-explorer-upload-path ()
"Upload a file" "Upload a file"
(when-let* ((win *filesystem-explorer-window*) (when-let* ((win *filesystem-explorer-window*)