summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-04-24 15:36:05 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-04-24 15:36:05 +0300
commit90717c77b29c4a8ca0c3f49e9b4670b6fcbbe9d9 (patch)
treeba6ff38e9f86e6eb9a9f9a0ce741f2f98ac3aec4 /src/ui/documentwidget.c
parent02603e398ac7a450230349d68130d6da46ec7772 (diff)
Added "Show Downloads" and "Open Downloaded File"
Contents of the Downloads folder can now be viewed as a directory index page.
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 1960d9b7..9b414b63 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1615,7 +1615,7 @@ static iBool handleMediaCommand_DocumentWidget_(iDocumentWidget *d, const char *
1615 } 1615 }
1616 else { 1616 else {
1617 const iGmError *err = get_GmError(code); 1617 const iGmError *err = get_GmError(code);
1618 makeMessage_Widget(format_CStr(uiTextCaution_ColorEscape "%s", err->title), err->info); 1618 makeSimpleMessage_Widget(format_CStr(uiTextCaution_ColorEscape "%s", err->title), err->info);
1619 removeMediaRequest_DocumentWidget_(d, req->linkId); 1619 removeMediaRequest_DocumentWidget_(d, req->linkId);
1620 } 1620 }
1621 return iTrue; 1621 return iTrue;
@@ -1665,15 +1665,21 @@ static void saveToDownloads_(const iString *url, const iString *mime, const iBlo
1665#if defined (iPlatformAppleMobile) 1665#if defined (iPlatformAppleMobile)
1666 exportDownloadedFile_iOS(savePath); 1666 exportDownloadedFile_iOS(savePath);
1667#else 1667#else
1668 const iMenuItem items[2] = {
1669 { "Open Downloaded File", 0, 0,
1670 format_CStr("!open url:%s", cstrCollect_String(makeFileUrl_String(savePath))) },
1671 { "${dlg.message.ok}", 0, 0, "message.ok" },
1672 };
1668 makeMessage_Widget(uiHeading_ColorEscape "${heading.save}", 1673 makeMessage_Widget(uiHeading_ColorEscape "${heading.save}",
1669 format_CStr("%s\n${dlg.save.size} %.3f %s", cstr_String(path_File(f)), 1674 format_CStr("%s\n${dlg.save.size} %.3f %s", cstr_String(path_File(f)),
1670 isMega ? size / 1.0e6f : (size / 1.0e3f), 1675 isMega ? size / 1.0e6f : (size / 1.0e3f),
1671 isMega ? "${mb}" : "${kb}")); 1676 isMega ? "${mb}" : "${kb}"),
1677 items, iElemCount(items));
1672#endif 1678#endif
1673 } 1679 }
1674 else { 1680 else {
1675 makeMessage_Widget(uiTextCaution_ColorEscape "${heading.save.error}", 1681 makeSimpleMessage_Widget(uiTextCaution_ColorEscape "${heading.save.error}",
1676 strerror(errno)); 1682 strerror(errno));
1677 } 1683 }
1678 iRelease(f); 1684 iRelease(f);
1679 } 1685 }
@@ -2141,8 +2147,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2141 } 2147 }
2142 else if (equal_Command(cmd, "document.save") && document_App() == d) { 2148 else if (equal_Command(cmd, "document.save") && document_App() == d) {
2143 if (d->request) { 2149 if (d->request) {
2144 makeMessage_Widget(uiTextCaution_ColorEscape "${heading.save.incomplete}", 2150 makeSimpleMessage_Widget(uiTextCaution_ColorEscape "${heading.save.incomplete}",
2145 "${dlg.save.incomplete}"); 2151 "${dlg.save.incomplete}");
2146 } 2152 }
2147 else if (!isEmpty_Block(&d->sourceContent)) { 2153 else if (!isEmpty_Block(&d->sourceContent)) {
2148 saveToDownloads_(d->mod.url, &d->sourceMime, &d->sourceContent); 2154 saveToDownloads_(d->mod.url, &d->sourceMime, &d->sourceContent);
@@ -2375,8 +2381,8 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2375 } 2381 }
2376 } 2382 }
2377 else { 2383 else {
2378 makeMessage_Widget(uiHeading_ColorEscape "${heading.import.bookmarks}", 2384 makeSimpleMessage_Widget(uiHeading_ColorEscape "${heading.import.bookmarks}",
2379 "${dlg.import.notnew}"); 2385 "${dlg.import.notnew}");
2380 } 2386 }
2381 return iTrue; 2387 return iTrue;
2382 } 2388 }