From 58c7955c6439041d8a1ddaf84694a5636f33bb32 Mon Sep 17 00:00:00 2001
From: Nils Maier
Date: Thu, 12 Sep 2019 11:19:41 +0200
Subject: [PATCH] Add Delete Files action
Closes #92
---
TODO.md | 1 -
_locales/en/messages.json | 24 ++++++++++++---
lib/browser.ts | 1 +
style/manager.css | 15 ++++++++++
windows/manager.html | 7 +++++
windows/manager/removaldlg.ts | 56 ++++++++++++++++++++++++++++++++++-
windows/manager/table.ts | 39 +++++++++++++++++++++++-
7 files changed, 136 insertions(+), 7 deletions(-)
diff --git a/TODO.md b/TODO.md
index c95cad6..3544a47 100644
--- a/TODO.md
+++ b/TODO.md
@@ -10,7 +10,6 @@ Planned for later.
* Soft errors and retry logic
* Big caveat: When the server still responds, like 50x errors which would be recoverable, we actually have no way of knowing it did in respond in such a way. See P4 - Handle Errors remarks.
-* Delete files (well, as far as the browser allows)
* Inter-addon API (basic)
* Add downloads
* vtable perf: cache column widths
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 58d3497..9b23067 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -207,6 +207,22 @@
"description": "button text",
"message": "Delete"
},
+ "deletefiles": {
+ "description": "menu action",
+ "message": "Delete Files"
+ },
+ "deletefiles_button": {
+ "description": "button text",
+ "message": "Delete"
+ },
+ "deletefiles_text": {
+ "description": "messagebox text",
+ "message": "Are you sure you want to delete the following files?"
+ },
+ "deletefiles_title": {
+ "description": "messagebox title",
+ "message": "Delete Files"
+ },
"description": {
"description": "Description (keep it short); e.g. the description column in select",
"message": "Description"
@@ -529,10 +545,6 @@
"description": "Status text; manager",
"message": "Paused"
},
- "pref_sounds": {
- "description": "checkbox text",
- "message": "Play sounds"
- },
"pref_add_paused": {
"description": "Preferences/General",
"message": "Add new downloads paused, instead of starting them immediately"
@@ -585,6 +597,10 @@
"description": "Preferences/General",
"message": "Show URLs instead of Names"
},
+ "pref_sounds": {
+ "description": "checkbox text",
+ "message": "Play sounds"
+ },
"pref_text_links": {
"description": "Preferences/General",
"message": "Try to find links in the website text (slower)"
diff --git a/lib/browser.ts b/lib/browser.ts
index 73f8b95..8788360 100644
--- a/lib/browser.ts
+++ b/lib/browser.ts
@@ -81,6 +81,7 @@ interface Downloads {
search(query: DownloadsQuery): Promise;
getFileIcon(id: number, options?: any): Promise;
setShelfEnabled(state: boolean): void;
+ removeFile(manId: number): Promise;
onCreated: ExtensionListener;
onChanged: ExtensionListener;
onErased: ExtensionListener;
diff --git a/style/manager.css b/style/manager.css
index 56f7b4d..06112ac 100644
--- a/style/manager.css
+++ b/style/manager.css
@@ -511,4 +511,19 @@ body > * {
height: 100%;
width: 100%;
background: var(--done-color);
+}
+
+.deletefiles-list {
+ padding-left: 1ex;
+ padding-right: 1.5ex;
+ border: 1px solid lightgray;
+ border-radius: 6px;
+ background-color: rgba(128,128,128,0.1);
+ max-height: 8em;
+ overflow-y: auto;
+}
+.deletefiles-list > li {
+ list-style-type: none;
+ padding: 0;
+ margin: 0;
}
\ No newline at end of file
diff --git a/windows/manager.html b/windows/manager.html
index 4861848..78089bf 100644
--- a/windows/manager.html
+++ b/windows/manager.html
@@ -75,6 +75,7 @@
- Open File
- Open Directory
+
- -
- Resume
- Pause
@@ -125,6 +126,12 @@
+
+
+
+
+
+