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.download.UIDownloadEvent
|
||||||
import com.muwire.core.search.QueryEvent
|
import com.muwire.core.search.QueryEvent
|
||||||
import com.muwire.core.search.SearchEvent
|
import com.muwire.core.search.SearchEvent
|
||||||
|
import com.muwire.core.trust.TrustEvent
|
||||||
|
import com.muwire.core.trust.TrustLevel
|
||||||
|
|
||||||
@ArtifactProviderFor(GriffonController)
|
@ArtifactProviderFor(GriffonController)
|
||||||
class MainFrameController {
|
class MainFrameController {
|
||||||
|
@ -33,15 +35,31 @@ class MainFrameController {
|
||||||
replyTo: core.me.destination, receivedOn: core.me.destination))
|
replyTo: core.me.destination, receivedOn: core.me.destination))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ControllerAction
|
private def selectedResult() {
|
||||||
void download() {
|
|
||||||
def resultsTable = builder.getVariable("results-table")
|
def resultsTable = builder.getVariable("results-table")
|
||||||
int row = resultsTable.getSelectedRow()
|
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)
|
def file = new File(application.context.get("muwire-settings").downloadLocation, result.name)
|
||||||
core.eventBus.publish(new UIDownloadEvent(result : result, target : file))
|
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) {
|
void mvcGroupInit(Map<String, String> args) {
|
||||||
application.addPropertyChangeListener("core", {e->
|
application.addPropertyChangeListener("core", {e->
|
||||||
core = e.getNewValue()
|
core = e.getNewValue()
|
||||||
|
|
|
@ -75,8 +75,8 @@ class MainFrameView {
|
||||||
}
|
}
|
||||||
panel(constraints : BorderLayout.SOUTH) {
|
panel(constraints : BorderLayout.SOUTH) {
|
||||||
button(text : "Download", downloadAction)
|
button(text : "Download", downloadAction)
|
||||||
button(text : "Trust")
|
button(text : "Trust", trustAction)
|
||||||
button(text : "Distrust")
|
button(text : "Distrust", distrustAction)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
panel (constraints : JSplitPane.BOTTOM) {
|
panel (constraints : JSplitPane.BOTTOM) {
|
||||||
|
|
Loading…
Reference in New Issue