fix manual re-attempts of hopeless downloads

dbus-notify
Zlatin Balevsky 2022-03-08 15:46:46 +00:00
parent 30cfa6fc7e
commit 622c18730c
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package com.muwire.gui
import com.muwire.core.download.DownloadHopelessEvent
import com.muwire.core.messenger.MessageFolderLoadingEvent
import com.muwire.core.search.ResultsEvent
@ -296,6 +297,7 @@ class MainFrameModel {
me = core.me.getHumanReadableName()
core.eventBus.register(UIResultBatchEvent.class, this)
core.eventBus.register(DownloadStartedEvent.class, this)
core.eventBus.register(DownloadHopelessEvent.class, this)
core.eventBus.register(ConnectionEvent.class, this)
core.eventBus.register(DisconnectionEvent.class, this)
core.eventBus.register(FileHashedEvent.class, this)
@ -421,6 +423,12 @@ class MainFrameModel {
downloadInfoHashes.add(e.downloader.infoHash)
}
}
void onDownloadHopelessEvent(DownloadHopelessEvent event) {
runInsideUIAsync {
downloadInfoHashes.remove(event.downloader.getInfoHash())
}
}
void onConnectionEvent(ConnectionEvent e) {
if (e.getStatus() != ConnectionAttemptStatus.SUCCESSFUL)