option to disable sharing of downloaded files

This commit is contained in:
Zlatin Balevsky
2019-06-05 17:46:55 +01:00
parent 581fce4643
commit 33c5b3b18e
7 changed files with 26 additions and 4 deletions

View File

@@ -56,6 +56,10 @@ class OptionsController {
boolean onlyTrusted = view.allowUntrustedCheckbox.model.isSelected()
model.onlyTrusted = onlyTrusted
settings.setAllowUntrusted(!onlyTrusted)
boolean shareDownloaded = view.shareDownloadedCheckbox.model.isSelected()
model.shareDownloadedFiles = shareDownloaded
settings.shareDownloadedFiles = shareDownloaded
File settingsFile = new File(core.home, "MuWire.properties")
settingsFile.withOutputStream {

View File

@@ -265,6 +265,8 @@ class MainFrameModel {
}
void onFileDownloadedEvent(FileDownloadedEvent e) {
if (!core.muOptions.shareDownloadedFiles)
return
infoHashes.add(e.downloadedFile.infoHash)
runInsideUIAsync {
shared << e.downloadedFile

View File

@@ -12,6 +12,7 @@ class OptionsModel {
@Observable String downloadRetryInterval
@Observable String updateCheckInterval
@Observable boolean onlyTrusted
@Observable boolean shareDownloadedFiles
// i2p options
@Observable String inboundLength
@@ -24,6 +25,7 @@ class OptionsModel {
downloadRetryInterval = settings.downloadRetryInterval
updateCheckInterval = settings.updateCheckInterval
onlyTrusted = !settings.allowUntrusted()
shareDownloadedFiles = settings.shareDownloadedFiles
Core core = application.context.get("core")
inboundLength = core.i2pOptions["inbound.length"]

View File

@@ -28,6 +28,7 @@ class OptionsView {
def retryField
def updateField
def allowUntrustedCheckbox
def shareDownloadedCheckbox
def inboundLengthField
def inboundQuantityField
@@ -54,6 +55,9 @@ class OptionsView {
label(text : "Only allow trusted connections", constraints : gbc(gridx: 0, gridy : 2))
allowUntrustedCheckbox = checkBox(selected : bind {model.onlyTrusted}, constraints : gbc(gridx: 1, gridy : 2))
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:3))
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:3))
}
i = builder.panel {