diff --git a/style/common.css b/style/common.css index 28b5eb3..99b14cd 100644 --- a/style/common.css +++ b/style/common.css @@ -18,6 +18,7 @@ --folder-color: rgb(214, 165, 4); --maskbutton-color: rgb(236, 185, 16); --missing-color: rgb(0, 82, 204); + --open-color: rgba(236, 185, 16, 0.8); } html[data-platform="mac"] { diff --git a/style/manager.css b/style/manager.css index b5714d1..f16fdbd 100644 --- a/style/manager.css +++ b/style/manager.css @@ -154,6 +154,10 @@ body > * { height: 26px; } +.virtualtable-row.opening { + background: var(--open-color) !important; +} + .virtualtable-progress-container { border-radius: 2px; } diff --git a/windows/manager/table.ts b/windows/manager/table.ts index aac8148..b460348 100644 --- a/windows/manager/table.ts +++ b/windows/manager/table.ts @@ -144,6 +144,8 @@ export class DownloadItem extends EventEmitter { private largeIconField?: string; + public opening: boolean; + constructor(owner: DownloadTable, raw: any, stats?: Stats) { super(); Object.assign(this, raw); @@ -802,20 +804,29 @@ export class DownloadTable extends VirtualTable { } async openFile() { - if (this.focusRow < 0) { + const {focusRow} = this; + if (focusRow < 0) { return; } - const item = this.downloads.filtered[this.focusRow]; + const item = this.downloads.filtered[focusRow]; if (!item || !item.manId || item.state !== DownloadState.DONE) { return; } + item.opening = true; try { + this.invalidateRow(focusRow); await downloads.open(item.manId); } catch (ex) { console.error(ex, ex.toString(), ex); PORT.post("missing", {sid: item.sessionId}); } + finally { + setTimeout(() => { + item.opening = false; + this.invalidateRow(focusRow); + }, 500); + } } async openDirectory() { @@ -1112,7 +1123,16 @@ export class DownloadTable extends VirtualTable { if (!item) { return null; } + if (item.opening) { + return ["opening"]; + } const cls = StateClasses.get(item.state); + if (cls && item.opening) { + return [cls, "opening"]; + } + if (item.opening) { + return ["opening"]; + } return cls && [cls] || null; }