From b3f775f59af41616c81b1f607b4cce14982c47d3 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 6 Nov 2019 18:13:07 +0000 Subject: [PATCH] show trust status in certificates view --- .../com/muwire/gui/BrowseController.groovy | 17 +++++++++-------- .../gui/FetchCertificatesController.groovy | 11 ++++++----- .../com/muwire/gui/SearchTabController.groovy | 4 ++-- .../com/muwire/gui/FetchCertificatesView.groovy | 1 + 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/gui/griffon-app/controllers/com/muwire/gui/BrowseController.groovy b/gui/griffon-app/controllers/com/muwire/gui/BrowseController.groovy index 20b65995..27a5156c 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/BrowseController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/BrowseController.groovy @@ -8,6 +8,7 @@ import net.i2p.data.Base64 import javax.annotation.Nonnull +import com.muwire.core.Core import com.muwire.core.EventBus import com.muwire.core.download.UIDownloadEvent import com.muwire.core.search.BrowseStatus @@ -22,18 +23,18 @@ class BrowseController { @MVCMember @Nonnull BrowseView view - EventBus eventBus + Core core void register() { - eventBus.register(BrowseStatusEvent.class, this) - eventBus.register(UIResultEvent.class, this) - eventBus.publish(new UIBrowseEvent(host : model.host)) + core.eventBus.register(BrowseStatusEvent.class, this) + core.eventBus.register(UIResultEvent.class, this) + core.eventBus.publish(new UIBrowseEvent(host : model.host)) } void mvcGroupDestroy() { - eventBus.unregister(BrowseStatusEvent.class, this) - eventBus.unregister(UIResultEvent.class, this) + core.eventBus.unregister(BrowseStatusEvent.class, this) + core.eventBus.unregister(UIResultEvent.class, this) } void onBrowseStatusEvent(BrowseStatusEvent e) { @@ -69,7 +70,7 @@ class BrowseController { selectedResults.each { result -> def file = new File(application.context.get("muwire-settings").downloadLocation, result.name) - eventBus.publish(new UIDownloadEvent( + core.eventBus.publish(new UIDownloadEvent( result : [result], sources : [model.host.destination], target : file, @@ -109,7 +110,7 @@ class BrowseController { def params = [:] params['result'] = result - params['eventBus'] = eventBus + params['core'] = core mvcGroup.createMVCGroup("fetch-certificates", params) } } \ No newline at end of file diff --git a/gui/griffon-app/controllers/com/muwire/gui/FetchCertificatesController.groovy b/gui/griffon-app/controllers/com/muwire/gui/FetchCertificatesController.groovy index f1ba25e3..0caadd57 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/FetchCertificatesController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/FetchCertificatesController.groovy @@ -7,6 +7,7 @@ import griffon.metadata.ArtifactProviderFor import javax.annotation.Nonnull import javax.swing.JOptionPane +import com.muwire.core.Core import com.muwire.core.EventBus import com.muwire.core.filecert.CertificateFetchEvent import com.muwire.core.filecert.CertificateFetchStatus @@ -21,10 +22,10 @@ class FetchCertificatesController { @MVCMember @Nonnull FetchCertificatesView view - EventBus eventBus + Core core void register() { - eventBus.with { + core.eventBus.with { register(CertificateFetchEvent.class, this) register(CertificateFetchedEvent.class, this) publish(new UIFetchCertificatesEvent(host : model.result.sender, infoHash : model.result.infohash)) @@ -32,8 +33,8 @@ class FetchCertificatesController { } void mvcGroupDestroy() { - eventBus.unregister(CertificateFetchEvent.class, this) - eventBus.unregister(CertificateFetchedEvent.class, this) + core.eventBus.unregister(CertificateFetchEvent.class, this) + core.eventBus.unregister(CertificateFetchedEvent.class, this) } void onCertificateFetchEvent(CertificateFetchEvent e) { @@ -58,7 +59,7 @@ class FetchCertificatesController { if (selectedCerts == null) return selectedCerts.each { - eventBus.publish(new UIImportCertificateEvent(certificate : it)) + core.eventBus.publish(new UIImportCertificateEvent(certificate : it)) } JOptionPane.showMessageDialog(null, "Certificates imported.") } diff --git a/gui/griffon-app/controllers/com/muwire/gui/SearchTabController.groovy b/gui/griffon-app/controllers/com/muwire/gui/SearchTabController.groovy index 1421f032..50780b6c 100644 --- a/gui/griffon-app/controllers/com/muwire/gui/SearchTabController.groovy +++ b/gui/griffon-app/controllers/com/muwire/gui/SearchTabController.groovy @@ -99,7 +99,7 @@ class SearchTabController { String groupId = sender.getHumanReadableName() Map params = new HashMap<>() params['host'] = sender - params['eventBus'] = core.eventBus + params['core'] = core mvcGroup.createMVCGroup("browse", groupId, params) } @@ -136,7 +136,7 @@ class SearchTabController { def params = [:] params['result'] = event - params['eventBus'] = core.eventBus + params['core'] = core mvcGroup.createMVCGroup("fetch-certificates", params) } } \ No newline at end of file diff --git a/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy b/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy index 4e1216d3..f2dcbdb9 100644 --- a/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy +++ b/gui/griffon-app/views/com/muwire/gui/FetchCertificatesView.groovy @@ -52,6 +52,7 @@ class FetchCertificatesView { certsTable = table(autoCreateRowSorter : true, rowHeight : rowHeight) { tableModel(list : model.certificates) { closureColumn(header : "Issuer", preferredWidth : 200, type : String, read : {it.issuer.getHumanReadableName()}) + closureColumn(header : "Trust Status", preferredWidth: 50, type : String, read : {controller.core.trustService.getLevel(it.issuer.destination)}) closureColumn(header : "Name", preferredWidth : 200, type: String, read : {it.name.name.toString()}) closureColumn(header : "Issued", preferredWidth : 100, type : String, read : { def date = new Date(it.timestamp)