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 /src/ui/documentwidget.c | |
parent | c4d6adb36cd4c28ff5c15b6692c1de46e9481b8c (diff) |
DocumentWidget: Deleting local files via link context menu
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r-- | src/ui/documentwidget.c | 14 |
1 files changed, 13 insertions, 1 deletions
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, |