add option to disable searching in comments

This commit is contained in:
Zlatin Balevsky
2019-10-16 19:57:18 +01:00
parent 5fa21b2360
commit 02441ca1e3
8 changed files with 38 additions and 17 deletions

View File

@@ -85,7 +85,8 @@ class MainFrameController {
def terms = replaced.split(" ")
def nonEmpty = []
terms.each { if (it.length() > 0) nonEmpty << it }
searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true)
searchEvent = new SearchEvent(searchTerms : nonEmpty, uuid : uuid, oobInfohash: true,
searchComments : core.muOptions.searchComments)
}
boolean firstHop = core.muOptions.allowUntrusted || core.muOptions.searchExtraHop
core.eventBus.publish(new QueryEvent(searchEvent : searchEvent, firstHop : firstHop,

View File

@@ -70,6 +70,10 @@ class OptionsController {
model.updateCheckInterval = text
settings.updateCheckInterval = Integer.valueOf(text)
boolean searchComments = view.searchCommentsCheckbox.model.isSelected()
model.searchComments = searchComments
settings.searchComments = searchComments
boolean autoDownloadUpdate = view.autoDownloadUpdateCheckbox.model.isSelected()
model.autoDownloadUpdate = autoDownloadUpdate
settings.autoDownloadUpdate = autoDownloadUpdate

View File

@@ -14,6 +14,7 @@ class OptionsModel {
@Observable boolean autoDownloadUpdate
@Observable boolean shareDownloadedFiles
@Observable String downloadLocation
@Observable boolean searchComments
// i2p options
@Observable String inboundLength
@@ -50,6 +51,7 @@ class OptionsModel {
autoDownloadUpdate = settings.autoDownloadUpdate
shareDownloadedFiles = settings.shareDownloadedFiles
downloadLocation = settings.downloadLocation.getAbsolutePath()
searchComments = settings.searchComments
Core core = application.context.get("core")
inboundLength = core.i2pOptions["inbound.length"]

View File

@@ -35,6 +35,7 @@ class OptionsView {
def updateField
def autoDownloadUpdateCheckbox
def shareDownloadedCheckbox
def searchCommentsCheckbox
def inboundLengthField
def inboundQuantityField
@@ -69,23 +70,26 @@ class OptionsView {
d.setResizable(false)
p = builder.panel {
gridBagLayout()
label(text : "Retry failed downloads every", constraints : gbc(gridx: 0, gridy: 0))
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2, constraints : gbc(gridx: 1, gridy: 0))
label(text : "seconds", constraints : gbc(gridx : 2, gridy: 0))
label(text : "Search in comments", constraints:gbc(gridx: 0, gridy:0))
searchCommentsCheckbox = checkBox(selected : bind {model.searchComments}, constraints : gbc(gridx:1, gridy:0))
label(text : "Retry failed downloads every", constraints : gbc(gridx: 0, gridy: 1))
retryField = textField(text : bind { model.downloadRetryInterval }, columns : 2, constraints : gbc(gridx: 1, gridy: 1))
label(text : "seconds", constraints : gbc(gridx : 2, gridy: 1))
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 1))
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 1))
label(text : "hours", constraints : gbc(gridx: 2, gridy : 1))
label(text : "Check for updates every", constraints : gbc(gridx : 0, gridy: 2))
updateField = textField(text : bind {model.updateCheckInterval }, columns : 2, constraints : gbc(gridx : 1, gridy: 2))
label(text : "hours", constraints : gbc(gridx: 2, gridy : 2))
label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 2))
autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate}, constraints : gbc(gridx:1, gridy : 2))
label(text : "Download updates automatically", constraints: gbc(gridx :0, gridy : 3))
autoDownloadUpdateCheckbox = checkBox(selected : bind {model.autoDownloadUpdate}, constraints : gbc(gridx:1, gridy : 3))
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:3))
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:3))
label(text : "Share downloaded files", constraints : gbc(gridx : 0, gridy:4))
shareDownloadedCheckbox = checkBox(selected : bind {model.shareDownloadedFiles}, constraints : gbc(gridx :1, gridy:4))
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:4))
button(text : "Choose", constraints : gbc(gridx : 1, gridy:4), downloadLocationAction)
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:5, gridwidth:2))
label(text : "Save downloaded files to:", constraints: gbc(gridx:0, gridy:5))
button(text : "Choose", constraints : gbc(gridx : 1, gridy:5), downloadLocationAction)
label(text : bind {model.downloadLocation}, constraints: gbc(gridx:0, gridy:6, gridwidth:2))
}
i = builder.panel {