mirror of https://github.com/zlatinb/muwire
hook up trust buttons
parent
3c9883785a
commit
e7c463a3be
|
@ -13,6 +13,8 @@ import com.muwire.core.download.DownloadStartedEvent
|
|||
import com.muwire.core.download.UIDownloadEvent
|
||||
import com.muwire.core.search.QueryEvent
|
||||
import com.muwire.core.search.SearchEvent
|
||||
import com.muwire.core.trust.TrustEvent
|
||||
import com.muwire.core.trust.TrustLevel
|
||||
|
||||
@ArtifactProviderFor(GriffonController)
|
||||
class MainFrameController {
|
||||
|
@ -33,15 +35,31 @@ class MainFrameController {
|
|||
replyTo: core.me.destination, receivedOn: core.me.destination))
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void download() {
|
||||
private def selectedResult() {
|
||||
def resultsTable = builder.getVariable("results-table")
|
||||
int row = resultsTable.getSelectedRow()
|
||||
def result = model.results[row]
|
||||
model.results[row]
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void download() {
|
||||
def result = selectedResult()
|
||||
def file = new File(application.context.get("muwire-settings").downloadLocation, result.name)
|
||||
core.eventBus.publish(new UIDownloadEvent(result : result, target : file))
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void trust() {
|
||||
def result = selectedResult()
|
||||
core.eventBus.publish( new TrustEvent(destination : result.sender.destination, level : TrustLevel.TRUSTED))
|
||||
}
|
||||
|
||||
@ControllerAction
|
||||
void distrust() {
|
||||
def result = selectedResult()
|
||||
core.eventBus.publish( new TrustEvent(destination : result.sender.destination, level : TrustLevel.DISTRUSTED))
|
||||
}
|
||||
|
||||
void mvcGroupInit(Map<String, String> args) {
|
||||
application.addPropertyChangeListener("core", {e->
|
||||
core = e.getNewValue()
|
||||
|
|
|
@ -75,8 +75,8 @@ class MainFrameView {
|
|||
}
|
||||
panel(constraints : BorderLayout.SOUTH) {
|
||||
button(text : "Download", downloadAction)
|
||||
button(text : "Trust")
|
||||
button(text : "Distrust")
|
||||
button(text : "Trust", trustAction)
|
||||
button(text : "Distrust", distrustAction)
|
||||
}
|
||||
}
|
||||
panel (constraints : JSplitPane.BOTTOM) {
|
||||
|
|
Loading…
Reference in New Issue