"Download all" when receiving multiple files

This commit is contained in:
RobinLinus 2020-12-20 21:30:28 +01:00
parent 2c6ea6e008
commit 26352be478
3 changed files with 26 additions and 3 deletions

View file

@ -71,8 +71,12 @@
<h3>File Received</h3> <h3>File Received</h3>
<div class="font-subheading" id="fileName">Filename</div> <div class="font-subheading" id="fileName">Filename</div>
<div class="font-body2" id="fileSize"></div> <div class="font-body2" id="fileSize"></div>
<div class="row">
<label for="autoDownload" class="grow">Ask to save each file before downloading</label>
<input type="checkbox" id="autoDownload" checked="">
</div>
<div class="row-reverse"> <div class="row-reverse">
<a class="button" close id="download" title="Download File" autofocus>Download</a> <a class="button" close id="download" title="Download File" autofocus>Save</a>
<button class="button" close>Ignore</button> <button class="button" close>Ignore</button>
</div> </div>
</x-paper> </x-paper>

View file

@ -261,6 +261,11 @@ class ReceiveDialog extends Dialog {
$a.href = url; $a.href = url;
$a.download = file.name; $a.download = file.name;
if(this._autoDownload()){
$a.click()
return
}
this.$el.querySelector('#fileName').textContent = file.name; this.$el.querySelector('#fileName').textContent = file.name;
this.$el.querySelector('#fileSize').textContent = this._formatFileSize(file.size); this.$el.querySelector('#fileSize').textContent = this._formatFileSize(file.size);
this.show(); this.show();
@ -289,6 +294,11 @@ class ReceiveDialog extends Dialog {
super.hide(); super.hide();
this._dequeueFile(); this._dequeueFile();
} }
_autoDownload(){
return !this.$el.querySelector('#autoDownload').checked
}
} }

View file

@ -50,6 +50,10 @@ body {
justify-content: center; justify-content: center;
} }
.grow {
flex-grow: 1;
}
.full { .full {
position: absolute; position: absolute;
top: 0; top: 0;
@ -357,11 +361,17 @@ x-dialog .row-reverse>.button {
margin-left: 8px; margin-left: 8px;
} }
x-dialog a{ x-dialog a {
color: var(--primary-color); color: var(--primary-color);
} }
/* Receive Dialog */ /* Receive Dialog */
#receiveDialog .row{
margin-top: 24px;
margin-bottom: 8px;
}
/* Receive Text Dialog */
#receiveTextDialog #text { #receiveTextDialog #text {
width: 100%; width: 100%;
@ -469,7 +479,6 @@ button::-moz-focus-inner {
/* Text Input */ /* Text Input */
input,
textarea { textarea {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;