Skip to content

Commit

Permalink
Show progress on .cyberducksegment parent folder for segemented downl…
Browse files Browse the repository at this point in the history
…oads.
  • Loading branch information
dkocher committed Nov 26, 2024
1 parent bdc7bd9 commit 501923f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ public void transfer(final Session<?> source, final Session<?> destination, fina
}
// Transfer
final Download download = source.getFeature(Download.class);
final IconService.Icon icon = IconServiceFactory.iconFor(local);
final IconService.Icon icon = IconServiceFactory.iconFor(segment.isSegment() ? folder : local);
download.download(file, local, bandwidth, this.options.icon ?
new IconServiceStreamListener(icon, listener, segment) : listener, segment, prompt);
new IconServiceStreamListener(this, icon, listener) : listener, segment, prompt);
// Remove custom icon if complete
if(segment.isComplete()) {
icon.remove();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,26 @@
* feedback@cyberduck.ch
*/

import ch.cyberduck.core.BytecountStreamListener;
import ch.cyberduck.core.io.DelegateStreamListener;
import ch.cyberduck.core.io.StreamListener;
import ch.cyberduck.core.local.IconService;
import ch.cyberduck.core.transfer.Transfer;
import ch.cyberduck.core.transfer.TransferProgress;
import ch.cyberduck.core.transfer.TransferStatus;

public class IconServiceStreamListener extends BytecountStreamListener {
public class IconServiceStreamListener extends DelegateStreamListener {

private final Transfer transfer;
private final IconService.Icon icon;
private final TransferStatus status;

public IconServiceStreamListener(final IconService.Icon icon, final StreamListener delegate, final TransferStatus status) {
public IconServiceStreamListener(final Transfer transfer, final IconService.Icon icon, final StreamListener delegate) {
super(delegate);
this.transfer = transfer;
this.icon = icon;
this.status = status;
}

@Override
public void sent(final long bytes) {
super.sent(bytes);
icon.update(new TransferProgress(status.getLength(), this.getSent()));
icon.update(new TransferProgress(transfer.getSize(), transfer.getTransferred()));
}
}

0 comments on commit 501923f

Please sign in to comment.