diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-06-10 14:59:13 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-06-10 14:59:13 +0300 |
commit | 4e3ac08e66b54b416b6736d5b5195da87e17bec1 (patch) | |
tree | 7cdd78b9e7b4083cb45376528f758b9672e55e55 | |
parent | c4d6adb36cd4c28ff5c15b6692c1de46e9481b8c (diff) |
DocumentWidget: Deleting local files via link context menu
-rw-r--r-- | po/en.po | 12 | ||||
-rw-r--r-- | res/lang/de.bin | bin | 20798 -> 20949 bytes | |||
-rw-r--r-- | res/lang/en.bin | bin | 19503 -> 19654 bytes | |||
-rw-r--r-- | res/lang/es.bin | bin | 21877 -> 22028 bytes | |||
-rw-r--r-- | res/lang/fi.bin | bin | 22000 -> 22151 bytes | |||
-rw-r--r-- | res/lang/fr.bin | bin | 22410 -> 22561 bytes | |||
-rw-r--r-- | res/lang/ia.bin | bin | 21708 -> 21859 bytes | |||
-rw-r--r-- | res/lang/ie.bin | bin | 21266 -> 21417 bytes | |||
-rw-r--r-- | res/lang/pl.bin | bin | 22514 -> 22665 bytes | |||
-rw-r--r-- | res/lang/ru.bin | bin | 32745 -> 32896 bytes | |||
-rw-r--r-- | res/lang/sr.bin | bin | 32150 -> 32301 bytes | |||
-rw-r--r-- | res/lang/tok.bin | bin | 19891 -> 20042 bytes | |||
-rw-r--r-- | res/lang/zh_Hans.bin | bin | 18667 -> 18818 bytes | |||
-rw-r--r-- | res/lang/zh_Hant.bin | bin | 18852 -> 19003 bytes | |||
-rw-r--r-- | src/app.c | 17 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 14 |
16 files changed, 42 insertions, 1 deletions
@@ -742,6 +742,18 @@ msgstr "Bookmark Link…" | |||
742 | msgid "link.download" | 742 | msgid "link.download" |
743 | msgstr "Download Linked File" | 743 | msgstr "Download Linked File" |
744 | 744 | ||
745 | msgid "link.file.delete" | ||
746 | msgstr "Delete File" | ||
747 | |||
748 | msgid "heading.file.delete" | ||
749 | msgstr "DELETE FILE" | ||
750 | |||
751 | msgid "dlg.file.delete.confirm" | ||
752 | msgstr "Are you sure you want to delete this file?" | ||
753 | |||
754 | msgid "dlg.file.delete" | ||
755 | msgstr "Delete" | ||
756 | |||
745 | msgid "heading.openlink" | 757 | msgid "heading.openlink" |
746 | msgstr "OPEN LINK" | 758 | msgstr "OPEN LINK" |
747 | 759 | ||
diff --git a/res/lang/de.bin b/res/lang/de.bin index ece02848..ad41666e 100644 --- a/res/lang/de.bin +++ b/res/lang/de.bin | |||
Binary files differ | |||
diff --git a/res/lang/en.bin b/res/lang/en.bin index 06781bb4..a107cec4 100644 --- a/res/lang/en.bin +++ b/res/lang/en.bin | |||
Binary files differ | |||
diff --git a/res/lang/es.bin b/res/lang/es.bin index b47e6fae..5ad57bc6 100644 --- a/res/lang/es.bin +++ b/res/lang/es.bin | |||
Binary files differ | |||
diff --git a/res/lang/fi.bin b/res/lang/fi.bin index 95b2108c..5167bea1 100644 --- a/res/lang/fi.bin +++ b/res/lang/fi.bin | |||
Binary files differ | |||
diff --git a/res/lang/fr.bin b/res/lang/fr.bin index 365a6d8e..dfa5f097 100644 --- a/res/lang/fr.bin +++ b/res/lang/fr.bin | |||
Binary files differ | |||
diff --git a/res/lang/ia.bin b/res/lang/ia.bin index b037a7ae..91e5336c 100644 --- a/res/lang/ia.bin +++ b/res/lang/ia.bin | |||
Binary files differ | |||
diff --git a/res/lang/ie.bin b/res/lang/ie.bin index 6c70c65a..d1cdb189 100644 --- a/res/lang/ie.bin +++ b/res/lang/ie.bin | |||
Binary files differ | |||
diff --git a/res/lang/pl.bin b/res/lang/pl.bin index b902baad..b65a2b52 100644 --- a/res/lang/pl.bin +++ b/res/lang/pl.bin | |||
Binary files differ | |||
diff --git a/res/lang/ru.bin b/res/lang/ru.bin index 74e2e20f..d962ec59 100644 --- a/res/lang/ru.bin +++ b/res/lang/ru.bin | |||
Binary files differ | |||
diff --git a/res/lang/sr.bin b/res/lang/sr.bin index 576b4b9c..bcd10900 100644 --- a/res/lang/sr.bin +++ b/res/lang/sr.bin | |||
Binary files differ | |||
diff --git a/res/lang/tok.bin b/res/lang/tok.bin index 97ef6273..8d4963bd 100644 --- a/res/lang/tok.bin +++ b/res/lang/tok.bin | |||
Binary files differ | |||
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin index bb2c6571..0a5bab01 100644 --- a/res/lang/zh_Hans.bin +++ b/res/lang/zh_Hans.bin | |||
Binary files differ | |||
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin index 36fc5eb2..53b05911 100644 --- a/res/lang/zh_Hant.bin +++ b/res/lang/zh_Hant.bin | |||
Binary files differ | |||
@@ -2303,6 +2303,23 @@ iBool handleCommand_App(const char *cmd) { | |||
2303 | } | 2303 | } |
2304 | setCurrent_Root(oldRoot); | 2304 | setCurrent_Root(oldRoot); |
2305 | } | 2305 | } |
2306 | else if (equal_Command(cmd, "file.delete")) { | ||
2307 | const char *path = suffixPtr_Command(cmd, "path"); | ||
2308 | if (argLabel_Command(cmd, "confirm")) { | ||
2309 | makeQuestion_Widget( | ||
2310 | uiHeading_ColorEscape "${heading.file.delete}", | ||
2311 | format_CStr("${dlg.file.delete.confirm}\n%s", path), | ||
2312 | (iMenuItem[]){ | ||
2313 | { "${cancel}", 0, 0, NULL }, | ||
2314 | { uiTextCaution_ColorEscape "${dlg.file.delete}", 0, 0, | ||
2315 | format_CStr("!file.delete path:%s", path) } }, | ||
2316 | 2); | ||
2317 | } | ||
2318 | else { | ||
2319 | remove(path); | ||
2320 | } | ||
2321 | return iTrue; | ||
2322 | } | ||
2306 | else if (equal_Command(cmd, "document.request.cancelled")) { | 2323 | else if (equal_Command(cmd, "document.request.cancelled")) { |
2307 | /* TODO: How should cancelled requests be treated in the history? */ | 2324 | /* TODO: How should cancelled requests be treated in the history? */ |
2308 | #if 0 | 2325 | #if 0 |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index a3ac208a..20c0370a 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -3348,6 +3348,18 @@ static iBool processEvent_DocumentWidget_(iDocumentWidget *d, const SDL_Event *e | |||
3348 | d->contextLink->linkId) }); | 3348 | d->contextLink->linkId) }); |
3349 | } | 3349 | } |
3350 | } | 3350 | } |
3351 | if (equalCase_Rangecc(scheme, "file")) { | ||
3352 | /* Local files may be deleted. */ | ||
3353 | pushBack_Array( | ||
3354 | &items, | ||
3355 | &(iMenuItem){ delete_Icon " " uiTextCaution_ColorEscape | ||
3356 | " ${link.file.delete}", | ||
3357 | 0, | ||
3358 | 0, | ||
3359 | format_CStr("!file.delete confirm:1 path:%s", | ||
3360 | cstrCollect_String( | ||
3361 | localFilePathFromUrl_String(linkUrl))) }); | ||
3362 | } | ||
3351 | } | 3363 | } |
3352 | else if (deviceType_App() == desktop_AppDeviceType) { | 3364 | else if (deviceType_App() == desktop_AppDeviceType) { |
3353 | if (!isEmpty_Range(&d->selectMark)) { | 3365 | if (!isEmpty_Range(&d->selectMark)) { |
@@ -4484,7 +4496,7 @@ static void draw_DocumentWidget_(const iDocumentWidget *d) { | |||
4484 | /* Text markers. */ | 4496 | /* Text markers. */ |
4485 | const iBool isTouchSelecting = (flags_Widget(w) & touchDrag_WidgetFlag) != 0; | 4497 | const iBool isTouchSelecting = (flags_Widget(w) & touchDrag_WidgetFlag) != 0; |
4486 | if (!isEmpty_Range(&d->foundMark) || !isEmpty_Range(&d->selectMark)) { | 4498 | if (!isEmpty_Range(&d->foundMark) || !isEmpty_Range(&d->selectMark)) { |
4487 | SDL_Renderer *render = renderer_Window(get_Window()); | 4499 | SDL_Renderer *render = renderer_Window(get_Window()); |
4488 | ctx.firstMarkRect = zero_Rect(); | 4500 | ctx.firstMarkRect = zero_Rect(); |
4489 | ctx.lastMarkRect = zero_Rect(); | 4501 | ctx.lastMarkRect = zero_Rect(); |
4490 | SDL_SetRenderDrawBlendMode(render, | 4502 | SDL_SetRenderDrawBlendMode(render, |